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!
This commit is contained in:
martin 2023-06-27 07:31:36 +00:00
parent 2fe366aabb
commit 4903132d4d
5 changed files with 16 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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"

View File

@ -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"

View File

@ -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"