Module Name:    src
Committed By:   martin
Date:           Tue Jun 27 07:31:37 UTC 2023

Modified Files:
        src/crypto/external/bsd/openssl/include/crypto: bn_conf.h
        src/crypto/external/bsd/openssl/include/openssl: configuration.h
        src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64: crypto.inc
            ec.inc sha.inc

Log Message:
PR 57472: adjust the BIGNUM configuration for sparc64 to match a native
openssl build [internally called bn(64/32)] and make the BN limbs be 32bit.
The sparc64 ASM code only deals with this layout.

Enable all sparc64 optimized asm code and define OPENSSL_NO_EC_NISTP_64_GCC_128
as this optimization is not valid on sparc64 (bigendian, alignement
critical) - again matching the native build.

Analyzed by Taylor and Harold, thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
    src/crypto/external/bsd/openssl/include/crypto/bn_conf.h
cvs rdiff -u -r1.3 -r1.4 \
    src/crypto/external/bsd/openssl/include/openssl/configuration.h
cvs rdiff -u -r1.9 -r1.10 \
    src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/crypto.inc
cvs rdiff -u -r1.3 -r1.4 \
    src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/ec.inc
cvs rdiff -u -r1.1 -r1.2 \
    src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/sha.inc

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/crypto/external/bsd/openssl/include/crypto/bn_conf.h
diff -u src/crypto/external/bsd/openssl/include/crypto/bn_conf.h:1.2 src/crypto/external/bsd/openssl/include/crypto/bn_conf.h:1.3
--- src/crypto/external/bsd/openssl/include/crypto/bn_conf.h:1.2	Sun May  7 18:41:35 2023
+++ src/crypto/external/bsd/openssl/include/crypto/bn_conf.h	Tue Jun 27 07:31:36 2023
@@ -22,12 +22,15 @@
 /* Should we define BN_DIV2W here? */
 
 /* Only one for the following should be defined */
-#ifdef _LP64
+#if defined(_LP64) && !defined(__sparc64__)	/* sparc64 asm needs 32bit BN limbs */
 #define SIXTY_FOUR_BIT_LONG
 #elif _ILP64
 #define SIXTY_FOUR_BIT
 #else
 #define THIRTY_TWO_BIT
 #endif
+#ifdef __sparc64__
+#define BN_LLONG
+#endif
 
 #endif

Index: src/crypto/external/bsd/openssl/include/openssl/configuration.h
diff -u src/crypto/external/bsd/openssl/include/openssl/configuration.h:1.3 src/crypto/external/bsd/openssl/include/openssl/configuration.h:1.4
--- src/crypto/external/bsd/openssl/include/openssl/configuration.h:1.3	Thu May 11 14:36:11 2023
+++ src/crypto/external/bsd/openssl/include/openssl/configuration.h	Tue Jun 27 07:31:36 2023
@@ -120,7 +120,7 @@ extern "C" {
 #  undef BN_LLONG
 /* Only one for the following should be defined */
 #  undef SIXTY_FOUR_BIT
-#  ifdef __LP64__
+#  if defined(__LP64__) && !defined(__sparc64__)	/* sparc64 asm needs 32bit BN limbs */
 #   define SIXTY_FOUR_BIT_LONG
 #   undef THIRTY_TWO_BIT
 #  else
@@ -128,6 +128,9 @@ extern "C" {
 #   define THIRTY_TWO_BIT
 #  endif
 # endif
+#ifdef __sparc64__
+# define BN_LLONG
+#endif
 
 # define RC4_INT unsigned int
 

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/crypto.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/crypto.inc:1.9 src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/crypto.inc:1.10
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/crypto.inc:1.9	Thu May 25 15:52:29 2023
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/crypto.inc	Tue Jun 27 07:31:36 2023
@@ -2,6 +2,9 @@
 CPUID_SRCS = sparcv9cap.c sparccpuid.S sparcv9-mont.S sparcv9a-mont.S
 CPUID_SRCS += sparct4-mont.S vis3-mont.S
 CPUID = yes
-#CPPFLAGS += -DOPENSSL_BN_ASM_MONT
+
+CPPFLAGS += -DOPENSSL_BN_ASM_MONT
+CPUID_SRCS+=bn_sparc.c
+
 CPPFLAGS += -DOPENSSL_CPUID_OBJ
 .include "../../crypto.inc"

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/ec.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/ec.inc:1.3 src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/ec.inc:1.4
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/ec.inc:1.3	Thu May 25 15:52:29 2023
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/ec.inc	Tue Jun 27 07:31:36 2023
@@ -2,6 +2,7 @@
 EC_SRCS += \
 ecp_nistz256-sparcv9.S
 ECCPPFLAGS+= -DECP_NISTZ256_ASM
-
+ECCPPFLAGS+= -DOPENSSL_NO_EC_NISTP_64_GCC_128
 ECNI = yes
+COPTS.bn_exp.c+=-Wno-error=stack-protector
 .include "../../ec.inc"

Index: src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/sha.inc
diff -u src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/sha.inc:1.1 src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/sha.inc:1.2
--- src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/sha.inc:1.1	Sun Mar  2 08:58:02 2014
+++ src/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/sha.inc	Tue Jun 27 07:31:36 2023
@@ -1,4 +1,4 @@
 .PATH.S: ${.PARSEDIR}
-SHA_SRCS = sha1-sparcv9.S
-SHACPPFLAGS = -DSHA1_ASM
+SHA_SRCS = sha1-sparcv9.S sha256-sparcv9.S sha512-sparcv9.S 
+SHACPPFLAGS = -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM
 .include "../../sha.inc"

Reply via email to