Only use additional entropy source when configured within transit and sys random (#15734)

- When an end-user specifies the all source type within
   transit/random and sys/tools/random, only use the additional source
   if we are actually configured with an external entropy source
This commit is contained in:
Steven Clark 2022-06-01 14:56:39 -04:00 committed by GitHub
parent c07ab7047e
commit 95b1971193
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -71,10 +71,10 @@ func HandleRandomAPI(d *framework.FieldData, additionalSource io.Reader) (*logic
}
randBytes, err = uuid.GenerateRandomBytesWithReader(bytes, additionalSource)
case "all":
var sealBytes []byte
sealBytes, err = uuid.GenerateRandomBytesWithReader(bytes, additionalSource)
if err == nil {
randBytes, err = uuid.GenerateRandomBytes(bytes)
randBytes, err = uuid.GenerateRandomBytes(bytes)
if err == nil && rand.Reader != additionalSource {
var sealBytes []byte
sealBytes, err = uuid.GenerateRandomBytesWithReader(bytes, additionalSource)
if err == nil {
randBytes, err = xor.XORBytes(sealBytes, randBytes)
}