forked from wolfSSL/wolfssl
fix ed25519 sing msg test failure
better random number handling
This commit is contained in:
@ -2175,10 +2175,16 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
|||||||
|
|
||||||
int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz)
|
||||||
{
|
{
|
||||||
int i;
|
word32 rand;
|
||||||
|
while (sz > 0) {
|
||||||
for (i = 0; i< sz; i++) {
|
word32 len = sizeof(rand);
|
||||||
output[i] = esp_random( );
|
if (sz < len)
|
||||||
|
len = sz;
|
||||||
|
/* Get one random 32-bit word from hw RNG */
|
||||||
|
rand = esp_random( );
|
||||||
|
XMEMCPY(output, &rand, sz);
|
||||||
|
output += len;
|
||||||
|
sz -= len;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -752,6 +752,9 @@ static WC_INLINE int Sha512Final(wc_Sha512* sha512)
|
|||||||
defined(NO_WOLFSSL_ESP32WROOM32_CRYPT_HASH)
|
defined(NO_WOLFSSL_ESP32WROOM32_CRYPT_HASH)
|
||||||
ret = Transform_Sha512(sha512);
|
ret = Transform_Sha512(sha512);
|
||||||
#else
|
#else
|
||||||
|
if(sha512->ctx.mode == ESP32_SHA_INIT) {
|
||||||
|
esp_sha_try_hw_lock(&sha512->ctx);
|
||||||
|
}
|
||||||
ret = esp_sha512_process(sha512);
|
ret = esp_sha512_process(sha512);
|
||||||
if(ret == 0 && sha512->ctx.mode == ESP32_SHA_SW){
|
if(ret == 0 && sha512->ctx.mode == ESP32_SHA_SW){
|
||||||
ret = Transform_Sha512(sha512);
|
ret = Transform_Sha512(sha512);
|
||||||
|
Reference in New Issue
Block a user