Ignore:
Timestamp:
Feb 7, 2019, 8:36:33 AM (5 years ago)
Author:
coas-nagasima
Message:

wolfsslを3.15.7にバージョンアップ

File:
1 edited

Legend:

Unmodified
Added
Removed
  • asp3_tinet_ecnl_rx/trunk/wolfssl-3.12.2/wolfssl/wolfcrypt/random.h

    r337 r372  
    2020 */
    2121
     22/*!
     23    \file wolfssl/wolfcrypt/random.h
     24*/
     25
    2226
    2327
     
    2731#include <wolfssl/wolfcrypt/types.h>
    2832
    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))
    3141#include <cyassl/ctaocrypt/random.h>
    3242#endif
     
    5868/* make sure Hash DRBG is enabled, unless WC_NO_HASHDRBG is defined
    5969    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)
    6171    #undef  HAVE_HASHDRBG
    6272    #define HAVE_HASHDRBG
     
    6777
    6878
    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))
    7082
    7183/* RNG supports the following sources (in order):
     
    95107#elif defined(HAVE_WNR)
    96108     /* 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)
    98112    #error No RNG source defined!
    99113#endif
     
    131145    typedef struct WC_RNG WC_RNG;
    132146    #define WC_RNG_TYPE_DEFINED
    133 #endif
    134 
    135 #ifdef HAVE_HASHDRBG
    136     /* Private DRBG state */
    137     struct DRBG;
    138147#endif
    139148
     
    153162};
    154163
    155 #endif /* HAVE_FIPS */
     164#endif /* NO FIPS or have FIPS v2*/
    156165
    157166/* NO_OLD_RNGNAME removes RNG struct name to prevent possible type conflicts,
     
    172181#endif /* HAVE_WNR */
    173182
    174 
     183#ifndef WC_NO_RNG
    175184WOLFSSL_API int  wc_InitRng(WC_RNG*);
    176185WOLFSSL_API int  wc_InitRng_ex(WC_RNG* rng, void* heap, int devId);
     186WOLFSSL_API int  wc_InitRngNonce(WC_RNG* rng, byte* nonce, word32 nonceSz);
     187WOLFSSL_API int  wc_InitRngNonce_ex(WC_RNG* rng, byte* nonce, word32 nonceSz,
     188                                    void* heap, int devId);
    177189WOLFSSL_API int  wc_RNG_GenerateBlock(WC_RNG*, byte*, word32 sz);
    178190WOLFSSL_API int  wc_RNG_GenerateByte(WC_RNG*, byte*);
    179191WOLFSSL_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
    180203
    181204
    182205#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);
    183209    WOLFSSL_API int wc_RNG_HealthTest(int reseed,
    184210                                        const byte* entropyA, word32 entropyASz,
    185211                                        const byte* entropyB, word32 entropyBSz,
    186212                                        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);
    187219#endif /* HAVE_HASHDRBG */
    188220
Note: See TracChangeset for help on using the changeset viewer.