Skip to content

[Windows] Replace CryptGenRandom with BCryptGenRandom #260

@AronParker

Description

@AronParker

CryptGenRandom is currently marked as deprecated:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa379942(v=vs.85).aspx

It has been replaced with:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa375458(v=vs.85).aspx

The new API is compatible with Vista+ and additionally since Rust officially only supports Windows 7 afaik, you could even take a little shortcut by passing the flag BCRYPT_USE_SYSTEM_PREFERRED_RNG, which enables omitting hAlgorithm and therefore requires no additional handles.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions