Mailing List Archive

[PATCH] rijndael: remove unused use_xxx flags
* cipher/rijndael-internal.h (RIJNDAEL_context_s): Remove unused
'use_padlock', 'use_aesni', 'use_ssse3', 'use_arm_ce', 'use_ppc_crypto'
and 'use_ppc9le_crypto'.
* cipher/rijndael.c (do_setkey): Do not setup 'use_padlock',
'use_aesni', 'use_ssse3', 'use_arm_ce', 'use_ppc_crypto' and
'use_ppc9le_crypto'.
--

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
---
cipher/rijndael-internal.h | 20 ++------------------
cipher/rijndael.c | 24 ------------------------
2 files changed, 2 insertions(+), 42 deletions(-)

diff --git a/cipher/rijndael-internal.h b/cipher/rijndael-internal.h
index 447a773a..7e01f6b0 100644
--- a/cipher/rijndael-internal.h
+++ b/cipher/rijndael-internal.h
@@ -164,26 +164,10 @@ typedef struct RIJNDAEL_context_s
} u2;
int rounds; /* Key-length-dependent number of rounds. */
unsigned int decryption_prepared:1; /* The decryption key schedule is available. */
-#ifdef USE_PADLOCK
- unsigned int use_padlock:1; /* Padlock shall be used. */
-#endif /*USE_PADLOCK*/
#ifdef USE_AESNI
- unsigned int use_aesni:1; /* AES-NI shall be used. */
- unsigned int use_avx:1; /* AVX shall be used. */
- unsigned int use_avx2:1; /* AVX2 shall be used. */
+ unsigned int use_avx:1; /* AVX shall be used by AES-NI implementation. */
+ unsigned int use_avx2:1; /* AVX2 shall be used by AES-NI implementation. */
#endif /*USE_AESNI*/
-#ifdef USE_SSSE3
- unsigned int use_ssse3:1; /* SSSE3 shall be used. */
-#endif /*USE_SSSE3*/
-#ifdef USE_ARM_CE
- unsigned int use_arm_ce:1; /* ARMv8 CE shall be used. */
-#endif /*USE_ARM_CE*/
-#ifdef USE_PPC_CRYPTO
- unsigned int use_ppc_crypto:1; /* PowerPC crypto shall be used. */
-#endif /*USE_PPC_CRYPTO*/
-#ifdef USE_PPC_CRYPTO_WITH_PPC9LE
- unsigned int use_ppc9le_crypto:1; /* POWER9 LE crypto shall be used. */
-#endif
#ifdef USE_S390X_CRYPTO
byte km_func;
byte km_func_xts;
diff --git a/cipher/rijndael.c b/cipher/rijndael.c
index 2b1aa5e5..6ab6d542 100644
--- a/cipher/rijndael.c
+++ b/cipher/rijndael.c
@@ -441,24 +441,6 @@ do_setkey (RIJNDAEL_context *ctx, const byte *key, const unsigned keylen,
hwfeatures = _gcry_get_hw_features ();

ctx->decryption_prepared = 0;
-#ifdef USE_PADLOCK
- ctx->use_padlock = 0;
-#endif
-#ifdef USE_AESNI
- ctx->use_aesni = 0;
-#endif
-#ifdef USE_SSSE3
- ctx->use_ssse3 = 0;
-#endif
-#ifdef USE_ARM_CE
- ctx->use_arm_ce = 0;
-#endif
-#ifdef USE_PPC_CRYPTO
- ctx->use_ppc_crypto = 0;
-#endif
-#ifdef USE_PPC_CRYPTO_WITH_PPC9LE
- ctx->use_ppc9le_crypto = 0;
-#endif

/* Setup default bulk encryption routines. */
memset (bulk_ops, 0, sizeof(*bulk_ops));
@@ -486,7 +468,6 @@ do_setkey (RIJNDAEL_context *ctx, const byte *key, const unsigned keylen,
ctx->prefetch_enc_fn = NULL;
ctx->prefetch_dec_fn = NULL;
ctx->prepare_decryption = _gcry_aes_aesni_prepare_decryption;
- ctx->use_aesni = 1;
ctx->use_avx = !!(hwfeatures & HWF_INTEL_AVX);
ctx->use_avx2 = !!(hwfeatures & HWF_INTEL_AVX2);

@@ -509,7 +490,6 @@ do_setkey (RIJNDAEL_context *ctx, const byte *key, const unsigned keylen,
ctx->prefetch_enc_fn = NULL;
ctx->prefetch_dec_fn = NULL;
ctx->prepare_decryption = _gcry_aes_padlock_prepare_decryption;
- ctx->use_padlock = 1;
memcpy (ctx->padlockkey, key, keylen);
}
#endif
@@ -522,7 +502,6 @@ do_setkey (RIJNDAEL_context *ctx, const byte *key, const unsigned keylen,
ctx->prefetch_enc_fn = NULL;
ctx->prefetch_dec_fn = NULL;
ctx->prepare_decryption = _gcry_aes_ssse3_prepare_decryption;
- ctx->use_ssse3 = 1;

/* Setup SSSE3 bulk encryption routines. */
bulk_ops->cfb_enc = _gcry_aes_ssse3_cfb_enc;
@@ -543,7 +522,6 @@ do_setkey (RIJNDAEL_context *ctx, const byte *key, const unsigned keylen,
ctx->prefetch_enc_fn = NULL;
ctx->prefetch_dec_fn = NULL;
ctx->prepare_decryption = _gcry_aes_armv8_ce_prepare_decryption;
- ctx->use_arm_ce = 1;

/* Setup ARM-CE bulk encryption routines. */
bulk_ops->cfb_enc = _gcry_aes_armv8_ce_cfb_enc;
@@ -565,7 +543,6 @@ do_setkey (RIJNDAEL_context *ctx, const byte *key, const unsigned keylen,
ctx->prefetch_enc_fn = NULL;
ctx->prefetch_dec_fn = NULL;
ctx->prepare_decryption = _gcry_aes_ppc8_prepare_decryption;
- ctx->use_ppc_crypto = 1; /* same key-setup as USE_PPC_CRYPTO */
ctx->use_ppc9le_crypto = 1;

/* Setup PPC9LE bulk encryption routines. */
@@ -588,7 +565,6 @@ do_setkey (RIJNDAEL_context *ctx, const byte *key, const unsigned keylen,
ctx->prefetch_enc_fn = NULL;
ctx->prefetch_dec_fn = NULL;
ctx->prepare_decryption = _gcry_aes_ppc8_prepare_decryption;
- ctx->use_ppc_crypto = 1;

/* Setup PPC8 bulk encryption routines. */
bulk_ops->cfb_enc = _gcry_aes_ppc8_cfb_enc;
--
2.27.0


_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel