Answer the question
In order to leave comments, you need to log in
Exception in the program, how to fix it?
I am writing a program that simulates the generation of a shared key using isogenies of elliptic curves. Isogenies are fully implemented in the Microsoft library, the program only calls ready-made functions of this library. When executing the program, an exception "access violation while executing at address 0x00000000" occurs in the highlighted line. What could be wrong?
Program text:
struct KeysStruct {
unsigned char *PrivateKey;
unsigned char *PublicKey;
} KeysA, KeysB;
int main()
{
/*Инициализация эллиптической кривой*/
PCurveIsogenyStruct CurveIsogeny = { 0 };
extern CurveIsogenyStaticData CurveIsogeny_SIDHp751;
CurveIsogenyStaticData *PCurveData;
PCurveData = &CurveIsogeny_SIDHp751;
CurveIsogeny = SIDH_curve_allocate(PCurveData);
CRYPTO_STATUS Status = CRYPTO_SUCCESS;
if (CurveIsogeny == NULL)
{
printf("not work");
sleep(SEC);
return 0;
}
Status = SIDH_curve_initialize(CurveIsogeny, CurveIsogeny->RandomBytesFunction, PCurveData);
if (Status != CRYPTO_SUCCESS)
{
printf("not work");
sleep(SEC);
return 0;
}
/*Генерация ключа Алисы*/
unsigned int i, pbytes = (PCurveData->pwordbits + 7) / 8;
unsigned int obytes = (PCurveData->owordbits + 7) / 8;
Status = CRYPTO_SUCCESS;
bool ok = true;
srand(time(NULL));
KeysA.PrivateKey = (unsigned char*)calloc(1, obytes);
KeysA.PublicKey = (unsigned char*)calloc(1, 4 * 2 * pbytes);
Status = EphemeralKeyGeneration_A(KeysA.PrivateKey, KeysA.PublicKey, CurveIsogeny);
if (Status != CRYPTO_SUCCESS)
ok = false;
printf("work");
sleep(SEC);
return 0;
}
Answer the question
In order to leave comments, you need to log in
Status = SIDH_curve_initialize(CurveIsogeny, CurveIsogeny->RandomBytesFunction, PCurveData);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question