Commit a8140a42 authored by Matt Caswell's avatar Matt Caswell
Browse files

Ensure code is compiled with correct BIGNUM assembler defines

parent 444ab3ab
Loading
Loading
Loading
Loading
+24 −6
Original line number Diff line number Diff line
@@ -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/);
+8 −8
Original line number Diff line number Diff line
@@ -38,11 +38,7 @@ 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
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)
@@ -69,7 +65,11 @@ 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

/*
 * 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);