Only build the body of e_padlock when there are lower level routines
authorRichard Levitte <levitte@openssl.org>
Mon, 29 Aug 2016 14:58:31 +0000 (16:58 +0200)
committerRichard Levitte <levitte@openssl.org>
Tue, 15 Nov 2016 14:14:15 +0000 (15:14 +0100)
engines/e_padlock.c assumes that for all x86 and x86_64 platforms, the
lower level routines will be present.  However, that's not always
true, for example for solaris-x86-cc, and that leads to build errors.

The better solution is to have configure detect if the lower level
padlock routines are being built, and define the macro PADLOCK_ASM if
they are, and use that macro in our C code.

Reviewed-by: Andy Polyakov <appro@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1510)

Configure
engines/e_padlock.c

index 70a59f51d9596498726db378107e20145b32f96b..2bdf87b243f2157a4028da9cef6dd5211dbe0def 100755 (executable)
--- a/Configure
+++ b/Configure
@@ -1206,6 +1206,9 @@ unless ($disabled{asm}) {
     if ($target{ec_asm_src} =~ /ecp_nistz256/) {
        push @{$config{defines}}, "ECP_NISTZ256_ASM";
     }
+    if ($target{padlock_asm_src} ne $table{DEFAULTS}->{padlock_asm_src}) {
+       push @{$config{defines}}, "PADLOCK_ASM";
+    }
     if ($target{poly1305_asm_src} ne "") {
        push @{$config{defines}}, "POLY1305_ASM";
     }
index 77cebe3de6f8d94848770f916de808d62f6caab4..b86f16550448130c2350dcdee7322872165bf124 100644 (file)
  */
 
 #  undef COMPILE_HW_PADLOCK
-#  if !defined(I386_ONLY) && !defined(OPENSSL_NO_ASM)
-#   if    defined(__i386__) || defined(__i386) ||    \
-        defined(__x86_64__) || defined(__x86_64) || \
-        defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64)
-#    define COMPILE_HW_PADLOCK
-#    ifdef OPENSSL_NO_DYNAMIC_ENGINE
+#  if !defined(I386_ONLY) && defined(PADLOCK_ASM)
+#   define COMPILE_HW_PADLOCK
+#   ifdef OPENSSL_NO_DYNAMIC_ENGINE
 static ENGINE *ENGINE_padlock(void);
-#    endif
 #   endif
 #  endif