-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CryptAcquireContextW and CryptGenRandom are deprecated #513
Comments
I found this code #include <Windows.h>
#include <bcrypt.h>
#include <stdio.h>
#pragma comment(lib, "Bcrypt")
void func(void) {
BCRYPT_ALG_HANDLE Prov;
int Buffer;
if (!BCRYPT_SUCCESS(
BCryptOpenAlgorithmProvider(&Prov, BCRYPT_RNG_ALGORITHM,
NULL, 0))) {
/* handle error */
}
if (!BCRYPT_SUCCESS(BCryptGenRandom(Prov, (PUCHAR) (&Buffer),
sizeof(Buffer), 0))) {
/* handle error */
}
printf("Random number: %d\n", Buffer);
BCryptCloseAlgorithmProvider(Prov, 0);
} which uses The only problem could be, that this functions need at least Windows Vista. |
The documentation for
That's probably why the existing implementation stores the |
btw. feel free to open a PR with the appropriate changes. CI will take care if it builds but I won't have the possibility to test it. |
On Windows libtommath uses
CryptAcquireContextW
andCryptGenRandom
to generate random numbers.According to the documentation here and here both functions are deprecated.
In fact, I'm opening this issue, because I failed to compile libtommath for UWP where those functions were already removed.
libtomcrypt should probably replace the deprecated functions with the mentioned Cryptography Next Generation API.
The text was updated successfully, but these errors were encountered: