Rearrange rsaz
authorRichard Levitte <levitte@openssl.org>
Mon, 22 Jun 2015 23:55:46 +0000 (01:55 +0200)
committerRichard Levitte <levitte@openssl.org>
Tue, 23 Jun 2015 00:59:47 +0000 (02:59 +0200)
A small rearrangement so the inclusion of rsaz_exp.h would be
unconditional, but what that header defines becomes conditional.

This solves the weirdness where rsaz_exp.h gets in and out of the
dependency list for bn_exp.c, depending on the present architecture.

Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/bn/bn_exp.c
crypto/bn/rsaz_exp.c
crypto/bn/rsaz_exp.h

index 6ce6f8d168736f84c9e260f9026f37ac459715e1..10dc3eb35843b5650ee468d18a29b9d1cf67ede2 100644 (file)
 # include <alloca.h>
 #endif
 
 # include <alloca.h>
 #endif
 
-#undef RSAZ_ENABLED
-#if defined(OPENSSL_BN_ASM_MONT) && \
-        (defined(__x86_64) || defined(__x86_64__) || \
-         defined(_M_AMD64) || defined(_M_X64))
-# include "rsaz_exp.h"
-# define RSAZ_ENABLED
-#endif
+#include "rsaz_exp.h"
 
 #undef SPARC_T4_MONT
 #if defined(OPENSSL_BN_ASM_MONT) && (defined(__sparc__) || defined(__sparc))
 
 #undef SPARC_T4_MONT
 #if defined(OPENSSL_BN_ASM_MONT) && (defined(__sparc__) || defined(__sparc))
index a486b154c2e8ba800cefae36b811db5e4e1ec9db..c54c6feb51b560602b163c7639351afb85a17ec8 100644 (file)
@@ -42,6 +42,8 @@
 
 #include "rsaz_exp.h"
 
 
 #include "rsaz_exp.h"
 
+#ifdef RSAZ_ENABLED
+
 /*
  * See crypto/bn/asm/rsaz-avx2.pl for further details.
  */
 /*
  * See crypto/bn/asm/rsaz-avx2.pl for further details.
  */
@@ -334,3 +336,11 @@ void RSAZ_512_mod_exp(BN_ULONG result[8],
 
     OPENSSL_cleanse(storage, sizeof(storage));
 }
 
     OPENSSL_cleanse(storage, sizeof(storage));
 }
+
+#else
+
+# if defined(PEDANTIC) || defined(__DECC) || defined(__clang__)
+static void *dummy = &dummy;
+# endif
+
+#endif
index bb71fb1e197b225874d7f349b1f182d16b8d7379..33361de99572f22113be6299cef2e904f234446a 100644 (file)
 #ifndef RSAZ_EXP_H
 # define RSAZ_EXP_H
 
 #ifndef RSAZ_EXP_H
 # define RSAZ_EXP_H
 
-# include <openssl/bn.h>
+# undef RSAZ_ENABLED
+# if defined(OPENSSL_BN_ASM_MONT) && \
+        (defined(__x86_64) || defined(__x86_64__) || \
+         defined(_M_AMD64) || defined(_M_X64))
+#  define RSAZ_ENABLED
+
+#  include <openssl/bn.h>
 
 void RSAZ_1024_mod_exp_avx2(BN_ULONG result[16],
                             const BN_ULONG base_norm[16],
 
 void RSAZ_1024_mod_exp_avx2(BN_ULONG result[16],
                             const BN_ULONG base_norm[16],
@@ -44,4 +50,7 @@ void RSAZ_512_mod_exp(BN_ULONG result[8],
                       const BN_ULONG base_norm[8], const BN_ULONG exponent[8],
                       const BN_ULONG m_norm[8], BN_ULONG k0,
                       const BN_ULONG RR[8]);
                       const BN_ULONG base_norm[8], const BN_ULONG exponent[8],
                       const BN_ULONG m_norm[8], BN_ULONG k0,
                       const BN_ULONG RR[8]);
+
+# endif
+
 #endif
 #endif