Hello,
The entropy module uses a hash to mix the entropy. It uses SHA-512 if
present and SHA-256 otherwise. Depending on the hash function, the
entropy module can return either up to 64 bytes (SHA-512) or 32 bytes
(SHA-256). The CTR_DRBG module knows about this and requests only 32
bytes at a time if the entropy module only delivers 32 bytes at a time.
It looks like something goes wrong when CTR_DRBG tries to request 64
bytes. This could be, for example, because a buffer is too small
somewhere, or because of a limitation of the entropy source. You would
need to debug the call to mbedtls_entropy_func to know more.
As a workaround, you can enable MBEDTLS_ENTROPY_FORCE_SHA256. Then the
entropy module will use SHA-256 (even if MBEDTLS_SHA512_C is enabled)
and only return 32 bytes at a time, and CTR_DRBG understands this and
will only request 32 bytes.
--
Gilles Peskine
Mbed TLS developer
On 27/01/2021 06:08, T V LIJIN (EXT) via mbed-tls wrote:
> Hi,
> After enabling *MBEDTLS_NO_PLATFORM_ENTROPY* and*MBEDTLS_SHA512_C* ,
> /mbedtls_ctr_drbg_seed/ is returning *0x0034
> */(MBEDTLS_ERR_CTR_DRBG_ENTROPY_SOURCE_FAILED)/
> But if I just enable *MBEDTLS_NO_PLATFORM_ENTROPY* and keep
> *MBEDTLS_SHA512_C* disabled, it does not return any error for
> /mbedtls_ctr_drbg_seed./
> /
> /
> My project uses certificates with SHA384 signature, so it
> requires***MBEDTLS_SHA512_C *to be enabled.
> /*MBEDTLS_NO_PLATFORM_ENTROPY* and*MBEDTLS_SHA512_C* /both needs to be
> enabled in my project , but Iam facing issue withÂ
> mbedtls_ctr_drbg_seed returning 0x0034. Please guide me on this. What
> might be the reason for mbedtls_ctr_drbg_seed to fail while
> enabling/////*MBEDTLS_SHA512_C.*/////
> How to overcome this issue?
>
>
> Thanks,
> LIJIN T V
>