Ensure code is compiled with correct BIGNUM assembler defines

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/9130)
This commit is contained in:
Matt Caswell 2019-06-11 13:49:43 +01:00
parent 444ab3abb1
commit a8140a42f5
2 changed files with 32 additions and 14 deletions

View File

@ -1407,13 +1407,31 @@ unless ($disabled{asm}) {
$target{bn_asm_src} =~ s/\w+-gf2m.c// if (defined($disabled{ec2m}));
# bn-586 is the only one implementing bn_*_part_words
push @{$config{lib_defines}}, "OPENSSL_BN_ASM_PART_WORDS" if ($target{bn_asm_src} =~ /bn-586/);
push @{$config{lib_defines}}, "OPENSSL_IA32_SSE2" if (!$disabled{sse2} && $target{bn_asm_src} =~ /86/);
if ($target{bn_asm_src} =~ /bn-586/) {
push @{$config{lib_defines}}, "OPENSSL_BN_ASM_PART_WORDS";
push @{$config{module_defines}}, "OPENSSL_BN_ASM_PART_WORDS";
}
if (!$disabled{sse2} && $target{bn_asm_src} =~ /86/) {
push @{$config{lib_defines}}, "OPENSSL_IA32_SSE2";
push @{$config{module_defines}}, "OPENSSL_IA32_SSE2";
}
push @{$config{lib_defines}}, "OPENSSL_BN_ASM_MONT" if ($target{bn_asm_src} =~ /-mont/);
push @{$config{lib_defines}}, "OPENSSL_BN_ASM_MONT5" if ($target{bn_asm_src} =~ /-mont5/);
push @{$config{lib_defines}}, "OPENSSL_BN_ASM_GF2m" if ($target{bn_asm_src} =~ /-gf2m/);
push @{$config{lib_defines}}, "BN_DIV3W" if ($target{bn_asm_src} =~ /-div3w/);
if ($target{bn_asm_src} =~ /-mont/) {
push @{$config{lib_defines}}, "OPENSSL_BN_ASM_MONT";
push @{$config{module_defines}}, "OPENSSL_BN_ASM_MONT";
}
if ($target{bn_asm_src} =~ /-mont5/) {
push @{$config{lib_defines}}, "OPENSSL_BN_ASM_MONT5";
push @{$config{module_defines}}, "OPENSSL_BN_ASM_MONT5";
}
if ($target{bn_asm_src} =~ /-gf2m/) {
push @{$config{lib_defines}}, "OPENSSL_BN_ASM_GF2m";
push @{$config{module_defines}}, "OPENSSL_BN_ASM_GF2m";
}
if ($target{bn_asm_src} =~ /-div3w/) {
push @{$config{lib_defines}}, "BN_DIV3W";
push @{$config{module_defines}}, "BN_DIV3W";
}
if ($target{sha1_asm_src}) {
push @{$config{lib_defines}}, "SHA1_ASM" if ($target{sha1_asm_src} =~ /sx86/ || $target{sha1_asm_src} =~ /sha1/);

View File

@ -38,12 +38,8 @@ unsigned int OPENSSL_ppccap_P = 0;
static sigset_t all_masked;
/*
* TODO(3.0): Temporarily disabled some assembler that hasn't been brought into
* the FIPS module yet.
*/
#ifndef FIPS_MODE
# ifdef OPENSSL_BN_ASM_MONT
#ifdef OPENSSL_BN_ASM_MONT
int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
const BN_ULONG *np, const BN_ULONG *n0, int num)
{
@ -68,8 +64,12 @@ int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp,
return bn_mul_mont_int(rp, ap, bp, np, n0, num);
}
# endif
#endif
/*
* TODO(3.0): Temporarily disabled some assembler that hasn't been brought into
* the FIPS module yet.
*/
#ifndef FIPS_MODE
void sha256_block_p8(void *ctx, const void *inp, size_t len);
void sha256_block_ppc(void *ctx, const void *inp, size_t len);
void sha256_block_data_order(void *ctx, const void *inp, size_t len);