Complete rewrite of XP Algorithm (w/ comments). Now fully optimized and readable
This commit is contained in:
15
src/util.cpp
15
src/util.cpp
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user