-
Notifications
You must be signed in to change notification settings - Fork 211
Closed
Description
Hi,
I've been trying to use libtomcrypt's rsa_make_key on windows and noticed it was never succeeding.
I traced it to rand_prime which seems to fail on mp_prime_is_prime
I'm assuming this is a libtommath problem, not libtomcrypt
vcpkg baseline: 9a718185e570b2366fda05eb65f1fc826fbf1cef
libtommath: 1.3.0#1
libtomcrypt: 1.18.2#3
VS 17.13.1
Code (taken from docs "2.4 Functions that need a PRNG"):
#define USE_LTM
#define LTM_DESC
#include <tomcrypt.h>
#include <tommath.h>
#pragma comment(lib, "bcrypt.lib")
int main() {
rsa_key key;
int err;
ltc_mp = ltm_desc;
register_prng(&sprng_desc);
if ((err = rsa_make_key(NULL, find_prng("sprng"), 1024 / 8, 65537, &key)) != CRYPT_OK) {
printf("make_key error: %s\n", error_to_string(err));
return -1;
}
return 0;
}
Reduced to:
#define USE_LTM
#define LTM_DESC
#include <tomcrypt.h>
#include <tommath.h>
#pragma comment(lib, "bcrypt.lib")
int main() {
int err;
ltc_mp = ltm_desc;
register_prng(&sprng_desc);
void* p;
ltc_mp.init(&p);
if ((err = rand_prime(p, 64, NULL, find_prng("sprng"))) != CRYPT_OK) {
printf("rand_prime error: %s\n", error_to_string(err));
return -1;
}
return 0;
}
Metadata
Metadata
Assignees
Labels
No labels