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 <levitte@openssl.org>
Fri, 26 Aug 2016 19:19:18 +0000 (21:19 +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.

(partly cherry picked from commit 216e8d91033d237880cff7da0d02d46d47bae41b)

Reviewed-by: Andy Polyakov <appro@openssl.org>
Configure
crypto/evp/e_rc4_hmac_md5.c

index 695b37d0730af7032b51eb7cb1d611b6359818df..684e9dc593ab8fa7aacc0934eb825f46b630441b 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -1558,8 +1558,15 @@ $cpuid_obj="mem_clr.o"   unless ($cpuid_obj =~ /\.o$/);
 $des_obj=$des_enc      unless ($des_obj =~ /\.o$/);
 $bf_obj=$bf_enc                unless ($bf_obj =~ /\.o$/);
 $cast_obj=$cast_enc    unless ($cast_obj =~ /\.o$/);
-$rc4_obj=$rc4_enc      unless ($rc4_obj =~ /\.o$/);
 $rc5_obj=$rc5_enc      unless ($rc5_obj =~ /\.o$/);
+if ($rc4_obj =~ /\.o$/)
+       {
+       $cflags.=" -DRC4_ASM";
+       }
+else
+       {
+       $rc4_obj=$rc4_enc;
+       }
 if ($sha1_obj =~ /\.o$/)
        {
 #      $sha1_obj=$sha1_enc;
index ba5979d47a75c502d2592d88cf1aac808c2699b4..5e92855dfdc01e7f342fdf74c8a4f811d49ea4a6 100644 (file)
@@ -99,7 +99,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)      || \
         defined(__INTEL__)              ) && \