- Timestamp:
- Feb 7, 2019, 8:36:33 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
asp3_tinet_ecnl_arm/trunk/wolfssl-3.12.2/wolfssl/wolfcrypt/random.h
r352 r372 20 20 */ 21 21 22 /*! 23 \file wolfssl/wolfcrypt/random.h 24 */ 25 22 26 23 27 … … 27 31 #include <wolfssl/wolfcrypt/types.h> 28 32 29 #ifdef HAVE_FIPS 30 /* for fips @wc_fips */ 33 #if defined(HAVE_FIPS) && \ 34 defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2) 35 #include <wolfssl/wolfcrypt/fips.h> 36 #endif /* HAVE_FIPS_VERSION >= 2 */ 37 38 /* included for fips @wc_fips */ 39 #if defined(HAVE_FIPS) && \ 40 (!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2)) 31 41 #include <cyassl/ctaocrypt/random.h> 32 42 #endif … … 58 68 /* make sure Hash DRBG is enabled, unless WC_NO_HASHDRBG is defined 59 69 or CUSTOM_RAND_GENERATE_BLOCK is defined*/ 60 #if !defined(WC_NO_HASHDRBG) ||!defined(CUSTOM_RAND_GENERATE_BLOCK)70 #if !defined(WC_NO_HASHDRBG) && !defined(CUSTOM_RAND_GENERATE_BLOCK) 61 71 #undef HAVE_HASHDRBG 62 72 #define HAVE_HASHDRBG … … 67 77 68 78 69 #ifndef HAVE_FIPS /* avoid redefining structs and macros */ 79 /* avoid redefinition of structs */ 80 #if !defined(HAVE_FIPS) || \ 81 (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)) 70 82 71 83 /* RNG supports the following sources (in order): … … 95 107 #elif defined(HAVE_WNR) 96 108 /* allow whitewood as direct RNG source using wc_GenerateSeed directly */ 97 #else 109 #elif defined(HAVE_INTEL_RDRAND) 110 /* Intel RDRAND or RDSEED */ 111 #elif !defined(WC_NO_RNG) 98 112 #error No RNG source defined! 99 113 #endif … … 131 145 typedef struct WC_RNG WC_RNG; 132 146 #define WC_RNG_TYPE_DEFINED 133 #endif134 135 #ifdef HAVE_HASHDRBG136 /* Private DRBG state */137 struct DRBG;138 147 #endif 139 148 … … 153 162 }; 154 163 155 #endif /* HAVE_FIPS*/164 #endif /* NO FIPS or have FIPS v2*/ 156 165 157 166 /* NO_OLD_RNGNAME removes RNG struct name to prevent possible type conflicts, … … 172 181 #endif /* HAVE_WNR */ 173 182 174 183 #ifndef WC_NO_RNG 175 184 WOLFSSL_API int wc_InitRng(WC_RNG*); 176 185 WOLFSSL_API int wc_InitRng_ex(WC_RNG* rng, void* heap, int devId); 186 WOLFSSL_API int wc_InitRngNonce(WC_RNG* rng, byte* nonce, word32 nonceSz); 187 WOLFSSL_API int wc_InitRngNonce_ex(WC_RNG* rng, byte* nonce, word32 nonceSz, 188 void* heap, int devId); 177 189 WOLFSSL_API int wc_RNG_GenerateBlock(WC_RNG*, byte*, word32 sz); 178 190 WOLFSSL_API int wc_RNG_GenerateByte(WC_RNG*, byte*); 179 191 WOLFSSL_API int wc_FreeRng(WC_RNG*); 192 #else 193 #include <wolfssl/wolfcrypt/error-crypt.h> 194 #define wc_InitRng(rng) NOT_COMPILED_IN 195 #define wc_InitRng_ex(rng, h, d) NOT_COMPILED_IN 196 #define wc_InitRngNonce(rng, n, s) NOT_COMPILED_IN 197 #define wc_InitRngNonce_ex(rng, n, s, h, d) NOT_COMPILED_IN 198 #define wc_RNG_GenerateBlock(rng, b, s) NOT_COMPILED_IN 199 #define wc_RNG_GenerateByte(rng, b) NOT_COMPILED_IN 200 #define wc_FreeRng(rng) (void)NOT_COMPILED_IN 201 #endif 202 180 203 181 204 182 205 #ifdef HAVE_HASHDRBG 206 WOLFSSL_LOCAL int wc_RNG_DRBG_Reseed(WC_RNG* rng, const byte* entropy, 207 word32 entropySz); 208 WOLFSSL_API int wc_RNG_TestSeed(const byte* seed, word32 seedSz); 183 209 WOLFSSL_API int wc_RNG_HealthTest(int reseed, 184 210 const byte* entropyA, word32 entropyASz, 185 211 const byte* entropyB, word32 entropyBSz, 186 212 byte* output, word32 outputSz); 213 WOLFSSL_API int wc_RNG_HealthTest_ex(int reseed, 214 const byte* nonce, word32 nonceSz, 215 const byte* entropyA, word32 entropyASz, 216 const byte* entropyB, word32 entropyBSz, 217 byte* output, word32 outputSz, 218 void* heap, int devId); 187 219 #endif /* HAVE_HASHDRBG */ 188 220
Note:
See TracChangeset
for help on using the changeset viewer.