mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-03-07 06:09:42 +00:00
EdDSA speed improvement
This commit is contained in:
12
Signature.h
12
Signature.h
@@ -377,7 +377,7 @@ namespace crypto
|
||||
EDDSAPoint (BIGNUM * x1, BIGNUM * y1): x(x1), y(y1) {};
|
||||
~EDDSAPoint () { BN_free (x); BN_free (y); };
|
||||
|
||||
EDDSAPoint& operator= (EDDSAPoint&& other)
|
||||
EDDSAPoint& operator=(EDDSAPoint&& other)
|
||||
{
|
||||
if (x) BN_free (x);
|
||||
if (y) BN_free (y);
|
||||
@@ -386,10 +386,18 @@ namespace crypto
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator== (const EDDSAPoint& other) const
|
||||
bool operator==(const EDDSAPoint& other) const
|
||||
{
|
||||
return !BN_cmp (x, other.x) && !BN_cmp (y, other.y);
|
||||
}
|
||||
|
||||
EDDSAPoint operator-() const
|
||||
{
|
||||
BIGNUM * x1 = NULL, * y1 = NULL;
|
||||
if (x) { x1 = BN_dup (x); BN_set_negative (x1, !BN_is_negative (x)); };
|
||||
if (y) y1 = BN_dup (y);
|
||||
return EDDSAPoint {x1, y1};
|
||||
}
|
||||
};
|
||||
|
||||
const size_t EDDSA25519_PUBLIC_KEY_LENGTH = 32;
|
||||
|
||||
Reference in New Issue
Block a user