mirror of https://github.com/ARMmbed/mbed-os.git
[M487/NUC472] zeroize random data on the stack memory
parent
76c2c19853
commit
e252b10148
|
@ -92,10 +92,10 @@ int trng_get_bytes(trng_t *obj, uint8_t *output, size_t length, size_t *output_l
|
||||||
output += 32;
|
output += 32;
|
||||||
}
|
}
|
||||||
if( length > *output_length ) {
|
if( length > *output_length ) {
|
||||||
trng_zeroize(tmpBuff, sizeof(tmpBuff));
|
|
||||||
trng_get(tmpBuff);
|
trng_get(tmpBuff);
|
||||||
memcpy(output, &tmpBuff, (length - *output_length));
|
memcpy(output, &tmpBuff, (length - *output_length));
|
||||||
*output_length = length;
|
*output_length = length;
|
||||||
|
trng_zeroize(tmpBuff, sizeof(tmpBuff));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -97,10 +97,10 @@ int trng_get_bytes(trng_t *obj, uint8_t *output, size_t length, size_t *output_l
|
||||||
output += 32;
|
output += 32;
|
||||||
}
|
}
|
||||||
if( length > *output_length ) {
|
if( length > *output_length ) {
|
||||||
trng_zeroize(tmpBuff, sizeof(tmpBuff));
|
|
||||||
trng_get(tmpBuff);
|
trng_get(tmpBuff);
|
||||||
memcpy(output, &tmpBuff, (length - *output_length));
|
memcpy(output, &tmpBuff, (length - *output_length));
|
||||||
*output_length = length;
|
*output_length = length;
|
||||||
|
trng_zeroize(tmpBuff, sizeof(tmpBuff));
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue