2013-01-11 18:54:40 -05:00
|
|
|
#ifndef ED25519_NO_SEED
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
#include <Windows.h>
|
|
|
|
#include <Wincrypt.h>
|
|
|
|
#else
|
|
|
|
#include <stdio.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
int ed25519_create_seed(unsigned char *seed) {
|
2013-01-11 20:38:34 -05:00
|
|
|
#ifdef _WIN32
|
|
|
|
int i;
|
|
|
|
HCRYPTPROV hCryptProv;
|
2013-01-11 18:54:40 -05:00
|
|
|
|
2013-01-11 20:38:34 -05:00
|
|
|
if (!CryptAcquireContext(&hCryptProv, NULL, NULL, PROV_RSA_FULL | CRYPT_VERIFYCONTEXT, 0)) {
|
|
|
|
return 1;
|
|
|
|
}
|
2013-01-11 18:54:40 -05:00
|
|
|
|
2013-01-11 20:38:34 -05:00
|
|
|
CryptGenRandom(hCryptProv, 32, seed);
|
|
|
|
CryptReleaseContext(hCryptProv, 0);
|
|
|
|
#else
|
|
|
|
#endif
|
|
|
|
return 0;
|
2013-01-11 18:54:40 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|