Skip to content

Commit

Permalink
Align guard macros for OPENSSL_cpuid_setup (#2111)
Browse files Browse the repository at this point in the history
### Issues:
Addresses aws/aws-lc-rs#655

### Description of changes: 
* The criteria for invoking `OPENSSL_cpuid_setup` should align with the
criteria for defining `OPENSSL_cpuid_setup`.

### Call-outs:
Consumers building `aws-lc-fips-sys` for `s390x` were seeing the
following failure:
```
.../boringssl_prefix_symbols.h:20:26: error: implicit declaration of function 'aws_lc_fips_0_13_1_OPENSSL_cpuid_setup'; did you mean 'aws_lc_fips_0_13_1_OPENSSL_sk_set'? [-Werror=implicit-function-declaration]
```

### Testing:
I verified this fix works for the `aws-lc-fips-sys` build for
`s390x-unknown-linux-gnu`.

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license and the ISC license.
  • Loading branch information
justsmth authored Jan 14, 2025
1 parent a4fec03 commit e76db6c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crypto/fipsmodule/bcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ static void BORINGSSL_bcm_power_on_self_test(void) {
// TODO: remove !defined(OPENSSL_PPC64BE) from the check below when starting to support
// PPC64BE that has VCRYPTO capability. In that case, add `|| defined(OPENSSL_PPC64BE)`
// to `#if defined(OPENSSL_PPC64LE)` wherever it occurs.
#if !defined(OPENSSL_NO_ASM) && !defined(OPENSSL_PPC32BE) && !defined(OPENSSL_PPC64BE)
#if defined(HAS_OPENSSL_CPUID_SETUP) && !defined(OPENSSL_NO_ASM)
OPENSSL_cpuid_setup();
#endif

Expand Down
1 change: 1 addition & 0 deletions crypto/fipsmodule/cpucap/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ extern "C" {

#if defined(OPENSSL_X86) || defined(OPENSSL_X86_64) || defined(OPENSSL_ARM) || \
defined(OPENSSL_AARCH64) || defined(OPENSSL_PPC64LE)
#define HAS_OPENSSL_CPUID_SETUP
// OPENSSL_cpuid_setup initializes the platform-specific feature cache.
void OPENSSL_cpuid_setup(void);
#endif
Expand Down

0 comments on commit e76db6c

Please sign in to comment.