Closed 05nelsonm closed 1 year ago
Thanks!
Will fix it Do you have any idea on how to properly test it?
Do you have any idea on how to properly test it?
I just tested the fillCompletely
extension function HERE and of course the actual implementation to ensure the ByteArray
was actually filled with non-empty values within a certain threshold (b/c some indices will still remain empty) HERE. AFAIK, there's no real good way to get the result
to return a specific value that would make the reading of /dev/urandom
testable.
fixed in https://github.com/whyoleg/cryptography-kotlin/commit/3e6e004ea0f9ab5c1f2f052e88dd4111ee5c5bd7
Real stress test was added in https://github.com/whyoleg/cryptography-kotlin/commit/6d596b5951bacbe80eb9bd7aa0a0fe830b5ac406
Thx for findings!
Current Linux implementation for
PlatformRandom
only checks for an error, but does not check if the number returned (the number of bytes retrieved from/dev/urandom
) filled theByteArray
completely.See fillCompletely
And fillCompletelyUsage
for pointers