summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/libcrypto/engine/hw_cryptodev.c10
-rw-r--r--src/lib/libssl/src/crypto/engine/hw_cryptodev.c10
2 files changed, 18 insertions, 2 deletions
diff --git a/src/lib/libcrypto/engine/hw_cryptodev.c b/src/lib/libcrypto/engine/hw_cryptodev.c
index 41184b6786..924e379ab5 100644
--- a/src/lib/libcrypto/engine/hw_cryptodev.c
+++ b/src/lib/libcrypto/engine/hw_cryptodev.c
@@ -714,7 +714,9 @@ xcrypt_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
714 const unsigned char *iv, int enc) 714 const unsigned char *iv, int enc)
715{ 715{
716 AES_KEY *k = ctx->cipher_data; 716 AES_KEY *k = ctx->cipher_data;
717#ifndef AES_ASM
717 int i; 718 int i;
719#endif
718 720
719 bzero(k, sizeof *k); 721 bzero(k, sizeof *k);
720 if (enc) 722 if (enc)
@@ -722,9 +724,15 @@ xcrypt_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
722 else 724 else
723 AES_set_decrypt_key(key, ctx->key_len * 8, k); 725 AES_set_decrypt_key(key, ctx->key_len * 8, k);
724 726
725 /* Damn OpenSSL byte swaps the expanded key!! */ 727#ifndef AES_ASM
728 /*
729 * XXX Damn OpenSSL byte swaps the expanded key!!
730 *
731 * XXX But only if we're using the C implementation of AES
732 */
726 for (i = 0; i < 4 * (AES_MAXNR + 1); i++) 733 for (i = 0; i < 4 * (AES_MAXNR + 1); i++)
727 k->rd_key[i] = htonl(k->rd_key[i]); 734 k->rd_key[i] = htonl(k->rd_key[i]);
735#endif
728 736
729 return (1); 737 return (1);
730} 738}
diff --git a/src/lib/libssl/src/crypto/engine/hw_cryptodev.c b/src/lib/libssl/src/crypto/engine/hw_cryptodev.c
index 41184b6786..924e379ab5 100644
--- a/src/lib/libssl/src/crypto/engine/hw_cryptodev.c
+++ b/src/lib/libssl/src/crypto/engine/hw_cryptodev.c
@@ -714,7 +714,9 @@ xcrypt_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
714 const unsigned char *iv, int enc) 714 const unsigned char *iv, int enc)
715{ 715{
716 AES_KEY *k = ctx->cipher_data; 716 AES_KEY *k = ctx->cipher_data;
717#ifndef AES_ASM
717 int i; 718 int i;
719#endif
718 720
719 bzero(k, sizeof *k); 721 bzero(k, sizeof *k);
720 if (enc) 722 if (enc)
@@ -722,9 +724,15 @@ xcrypt_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
722 else 724 else
723 AES_set_decrypt_key(key, ctx->key_len * 8, k); 725 AES_set_decrypt_key(key, ctx->key_len * 8, k);
724 726
725 /* Damn OpenSSL byte swaps the expanded key!! */ 727#ifndef AES_ASM
728 /*
729 * XXX Damn OpenSSL byte swaps the expanded key!!
730 *
731 * XXX But only if we're using the C implementation of AES
732 */
726 for (i = 0; i < 4 * (AES_MAXNR + 1); i++) 733 for (i = 0; i < 4 * (AES_MAXNR + 1); i++)
727 k->rd_key[i] = htonl(k->rd_key[i]); 734 k->rd_key[i] = htonl(k->rd_key[i]);
735#endif
728 736
729 return (1); 737 return (1);
730} 738}