aws-c-common icon indicating copy to clipboard operation
aws-c-common copied to clipboard

Avoiding allocating a handle in the Windows RNG.

Open teo-tsirpanis opened this issue 1 year ago • 3 comments

Issue #, if available:

Description of changes:

This PR uses the BCRYPT_USE_SYSTEM_PREFERRED_RNG option in the call to BCryptGenRandom to avoid allocating an algorithm handle, and simplifying the code a bit.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

teo-tsirpanis avatar Jul 26 '23 15:07 teo-tsirpanis

Can you please explain why you would want to avoid allocating an algorithm handle?

jmklix avatar Feb 06 '24 19:02 jmklix

Greetings! It looks like this PR hasn’t been active in longer than a week, add a comment or an upvote to prevent automatic closure, or if the issue is already closed, please feel free to open a new one.

github-actions[bot] avatar Feb 16 '24 20:02 github-actions[bot]

Can you please explain why you would want to avoid allocating an algorithm handle?

It reduces global state and slightly simplifies the code. This approach is being used by OpenSSL and .NET among others.

teo-tsirpanis avatar Feb 17 '24 01:02 teo-tsirpanis

Thanks!

graebm avatar Jul 29 '24 22:07 graebm