Complete rewrite of XP Algorithm (w/ comments). Now fully optimized and readable

This commit is contained in:
Andrew
2023-06-04 22:01:09 +03:00
parent 21e31fd1b6
commit 9812529903
4 changed files with 188 additions and 180 deletions

View File

@@ -84,4 +84,19 @@ EC_GROUP *initializeEllipticCurve(
BN_CTX_free(context);
return eCurve;
}
int BN_bn2lebin(const BIGNUM *a, unsigned char *to, int tolen) {
if (a == nullptr || to == nullptr)
return 0;
int len = BN_bn2bin(a, to);
if (len > tolen)
return -1;
// Choke point inside BN_bn2lebinpad: OpenSSL uses len instead of tolen.
endian(to, tolen);
return len;
}