fix redefinition of OS_Seed error with FIPS Ready on some compilers

This commit is contained in:
Chris Conlon
2021-12-01 10:42:31 -07:00
parent 5c172ca955
commit 9eabf16ed8
2 changed files with 12 additions and 11 deletions

View File

@ -64,9 +64,9 @@ This library defines the interface APIs for X509 certificates.
#define WC_RSAKEY_TYPE_DEFINED #define WC_RSAKEY_TYPE_DEFINED
#endif #endif
#ifndef WC_RNG_TYPE_DEFINED #ifndef WC_RNG_TYPE_DEFINED
typedef struct OS_Seed OS_Seed;
typedef struct WC_RNG WC_RNG; typedef struct WC_RNG WC_RNG;
#ifdef WC_RNG_SEED_CB #ifdef WC_RNG_SEED_CB
typedef struct OS_Seed OS_Seed;
typedef int (*wc_RngSeed_Cb)(OS_Seed* os, byte* seed, word32 sz); typedef int (*wc_RngSeed_Cb)(OS_Seed* os, byte* seed, word32 sz);
#endif #endif
#define WC_RNG_TYPE_DEFINED #define WC_RNG_TYPE_DEFINED

View File

@ -130,9 +130,17 @@
#endif #endif
#endif #endif
#ifndef WC_RNG_TYPE_DEFINED /* guard on redeclaration */
typedef struct OS_Seed OS_Seed;
typedef struct WC_RNG WC_RNG;
#ifdef WC_RNG_SEED_CB
typedef int (*wc_RngSeed_Cb)(OS_Seed* os, byte* seed, word32 sz);
#endif
#define WC_RNG_TYPE_DEFINED
#endif
/* OS specific seeder */ /* OS specific seeder */
typedef struct OS_Seed { struct OS_Seed {
#if defined(USE_WINDOWS_API) #if defined(USE_WINDOWS_API)
ProviderHandle handle; ProviderHandle handle;
#else #else
@ -141,13 +149,7 @@ typedef struct OS_Seed {
#if defined(WOLF_CRYPTO_CB) #if defined(WOLF_CRYPTO_CB)
int devId; int devId;
#endif #endif
} OS_Seed; };
#ifndef WC_RNG_TYPE_DEFINED /* guard on redeclaration */
typedef struct WC_RNG WC_RNG;
#define WC_RNG_TYPE_DEFINED
#endif
#ifdef HAVE_HASHDRBG #ifdef HAVE_HASHDRBG
struct DRBG_internal { struct DRBG_internal {
@ -168,7 +170,7 @@ struct DRBG_internal {
/* RNG context */ /* RNG context */
struct WC_RNG { struct WC_RNG {
OS_Seed seed; struct OS_Seed seed;
void* heap; void* heap;
#ifdef HAVE_HASHDRBG #ifdef HAVE_HASHDRBG
/* Hash-based Deterministic Random Bit Generator */ /* Hash-based Deterministic Random Bit Generator */
@ -234,7 +236,6 @@ WOLFSSL_API int wc_FreeRng(WC_RNG*);
#endif #endif
#ifdef WC_RNG_SEED_CB #ifdef WC_RNG_SEED_CB
typedef int (*wc_RngSeed_Cb)(OS_Seed* os, byte* seed, word32 sz);
WOLFSSL_API int wc_SetSeed_Cb(wc_RngSeed_Cb cb); WOLFSSL_API int wc_SetSeed_Cb(wc_RngSeed_Cb cb);
#endif #endif