mirror of https://github.com/wolfSSL/wolfssl.git
Added QAT DRBG support.
parent
73567853d3
commit
f008350afd
|
@ -530,14 +530,13 @@ int wc_InitRng_ex(WC_RNG* rng, void* heap, int devId)
|
|||
#endif
|
||||
|
||||
/* configure async RNG source if available */
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(HAVE_CAVIUM)
|
||||
#ifdef WOLFSSL_ASYNC_CRYPT
|
||||
ret = wolfAsync_DevCtxInit(&rng->asyncDev, WOLFSSL_ASYNC_MARKER_RNG,
|
||||
rng->heap, rng->devId);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef HAVE_INTEL_RDRAND
|
||||
/* if CPU supports RDRAND, use it directly and by-pass DRBG init */
|
||||
if (IS_INTEL_RDRAND)
|
||||
|
@ -610,9 +609,16 @@ int wc_RNG_GenerateBlock(WC_RNG* rng, byte* output, word32 sz)
|
|||
return wc_GenerateRand_IntelRD(NULL, output, sz);
|
||||
#endif
|
||||
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(HAVE_CAVIUM)
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT)
|
||||
if (rng->asyncDev.marker == WOLFSSL_ASYNC_MARKER_RNG) {
|
||||
/* these are blocking */
|
||||
#ifdef HAVE_CAVIUM
|
||||
return NitroxRngGenerateBlock(rng, output, sz);
|
||||
#elif defined(HAVE_INTEL_QA)
|
||||
return IntelQaDrbg(&rng->asyncDev, output, sz);
|
||||
#else
|
||||
/* simulator not supported */
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -685,7 +691,7 @@ int wc_FreeRng(WC_RNG* rng)
|
|||
if (rng == NULL)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT) && defined(HAVE_CAVIUM)
|
||||
#if defined(WOLFSSL_ASYNC_CRYPT)
|
||||
wolfAsync_DevCtxFree(&rng->asyncDev, WOLFSSL_ASYNC_MARKER_RNG);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -37,7 +37,11 @@
|
|||
|
||||
/* Maximum generate block length */
|
||||
#ifndef RNG_MAX_BLOCK_LEN
|
||||
#define RNG_MAX_BLOCK_LEN (0x10000)
|
||||
#ifdef HAVE_INTEL_QA
|
||||
#define RNG_MAX_BLOCK_LEN (0xFFFF)
|
||||
#else
|
||||
#define RNG_MAX_BLOCK_LEN (0x10000)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Size of the BRBG seed */
|
||||
|
|
Loading…
Reference in New Issue