From 11614e58638e2a3775eabeb1a5021c5bd2ba40d2 Mon Sep 17 00:00:00 2001
From: markus <>
Date: Mon, 23 May 2005 23:08:24 +0000
Subject: no need to byteswap for AES_ASM, from tom@

---
 src/lib/libcrypto/engine/hw_cryptodev.c         | 10 +++++++++-
 src/lib/libssl/src/crypto/engine/hw_cryptodev.c | 10 +++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

(limited to 'src')

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,
     const unsigned char *iv, int enc)
 {
 	AES_KEY *k = ctx->cipher_data;
+#ifndef AES_ASM
 	int i;
+#endif
 
 	bzero(k, sizeof *k);
 	if (enc)
@@ -722,9 +724,15 @@ xcrypt_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
 	else
 		AES_set_decrypt_key(key, ctx->key_len * 8, k);
 
-	/* Damn OpenSSL byte swaps the expanded key!! */
+#ifndef AES_ASM
+	/*
+	 * XXX Damn OpenSSL byte swaps the expanded key!!
+	 *
+	 * XXX But only if we're using the C implementation of AES
+	 */
 	for (i = 0; i < 4 * (AES_MAXNR + 1); i++)
 		k->rd_key[i] = htonl(k->rd_key[i]);
+#endif
 
 	return (1);
 }
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,
     const unsigned char *iv, int enc)
 {
 	AES_KEY *k = ctx->cipher_data;
+#ifndef AES_ASM
 	int i;
+#endif
 
 	bzero(k, sizeof *k);
 	if (enc)
@@ -722,9 +724,15 @@ xcrypt_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key,
 	else
 		AES_set_decrypt_key(key, ctx->key_len * 8, k);
 
-	/* Damn OpenSSL byte swaps the expanded key!! */
+#ifndef AES_ASM
+	/*
+	 * XXX Damn OpenSSL byte swaps the expanded key!!
+	 *
+	 * XXX But only if we're using the C implementation of AES
+	 */
 	for (i = 0; i < 4 * (AES_MAXNR + 1); i++)
 		k->rd_key[i] = htonl(k->rd_key[i]);
+#endif
 
 	return (1);
 }
-- 
cgit v1.2.3-55-g6feb