Improve the definition of STITCHED_CALL in e_rc4_hmac_md5.c
authorRichard Levitte <levitte@openssl.org>
Fri, 26 Aug 2016 07:59:55 +0000 (09:59 +0200)
committerRichard Levitte <richard@levitte.org>
Fri, 26 Aug 2016 15:34:30 +0000 (17:34 +0200)
The definition of STITCHED_CALL relies on OPENSSL_NO_ASM.  However,
when a configuration simply lacks the assembler implementation for RC4
(which is where we have implemented the stitched call), OPENSSL_NO_ASM
isn't implemented.  Better, then, to rely on specific macros that
indicated that RC4 (and MD5) are implemented in assembler.

For this to work properly, we must also make sure Configure adds the
definition of RC4_ASM among the C flags.

Reviewed-by: Andy Polyakov <appro@openssl.org>
(cherry picked from commit 216e8d91033d237880cff7da0d02d46d47bae41b)

Configure
crypto/evp/e_rc4_hmac_md5.c

index b30b57f209b69fa28247caf31d1c29ffb11c23ab..3604ba4f73eaed8b89d8b4bb4dc7ac6c78a55bee 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -1126,6 +1126,9 @@ unless ($disabled{asm}) {
        push @{$config{defines}}, "SHA256_ASM" if ($target{sha1_asm_src} =~ /sha256/);
        push @{$config{defines}}, "SHA512_ASM" if ($target{sha1_asm_src} =~ /sha512/);
     }
+    if ($target{rc4_asm_src} ne $table{DEFAULTS}->{rc4_asm_src}) {
+       push @{$config{defines}}, "RC4_ASM";
+    }
     if ($target{md5_asm_src}) {
        push @{$config{defines}}, "MD5_ASM";
     }
index 832daef1789cbdd6cabb337c716d8736bc87f1ca..e7aa1f86adbf7e84246f11c3f4f6db980946978c 100644 (file)
@@ -60,7 +60,7 @@ static int rc4_hmac_md5_init_key(EVP_CIPHER_CTX *ctx,
     return 1;
 }
 
-# if     !defined(OPENSSL_NO_ASM) &&     ( \
+# if     defined(RC4_ASM) && defined(MD5_ASM) &&     (    \
         defined(__x86_64)       || defined(__x86_64__)  || \
         defined(_M_AMD64)       || defined(_M_X64)      )
 #  define STITCHED_CALL