Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/crypto/external/bsd/openssl PR 57472: adjust the BIGNUM conf...



details:   https://anonhg.NetBSD.org/src/rev/78cdb4e3b354
branches:  trunk
changeset: 376647:78cdb4e3b354
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Jun 27 07:31:36 2023 +0000

description:
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!

diffstat:

 crypto/external/bsd/openssl/include/crypto/bn_conf.h              |  5 ++++-
 crypto/external/bsd/openssl/include/openssl/configuration.h       |  5 ++++-
 crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/crypto.inc |  5 ++++-
 crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/ec.inc     |  3 ++-
 crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/sha.inc    |  4 ++--
 5 files changed, 16 insertions(+), 6 deletions(-)

diffs (78 lines):

diff -r f3226f69104a -r 78cdb4e3b354 crypto/external/bsd/openssl/include/crypto/bn_conf.h
--- a/crypto/external/bsd/openssl/include/crypto/bn_conf.h      Tue Jun 27 07:27:31 2023 +0000
+++ b/crypto/external/bsd/openssl/include/crypto/bn_conf.h      Tue Jun 27 07:31:36 2023 +0000
@@ -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
diff -r f3226f69104a -r 78cdb4e3b354 crypto/external/bsd/openssl/include/openssl/configuration.h
--- a/crypto/external/bsd/openssl/include/openssl/configuration.h       Tue Jun 27 07:27:31 2023 +0000
+++ b/crypto/external/bsd/openssl/include/openssl/configuration.h       Tue Jun 27 07:31:36 2023 +0000
@@ -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
 
diff -r f3226f69104a -r 78cdb4e3b354 crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/crypto.inc
--- a/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/crypto.inc Tue Jun 27 07:27:31 2023 +0000
+++ b/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/crypto.inc Tue Jun 27 07:31:36 2023 +0000
@@ -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"
diff -r f3226f69104a -r 78cdb4e3b354 crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/ec.inc
--- a/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/ec.inc     Tue Jun 27 07:27:31 2023 +0000
+++ b/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/ec.inc     Tue Jun 27 07:31:36 2023 +0000
@@ -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"
diff -r f3226f69104a -r 78cdb4e3b354 crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/sha.inc
--- a/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/sha.inc    Tue Jun 27 07:27:31 2023 +0000
+++ b/crypto/external/bsd/openssl/lib/libcrypto/arch/sparc64/sha.inc    Tue Jun 27 07:31:36 2023 +0000
@@ -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"



Home | Main Index | Thread Index | Old Index