Fix const-ness in HMQV and FHMQV
parent
176cab0dc5
commit
84c4ae429f
14
fhmqv.h
14
fhmqv.h
|
|
@ -126,7 +126,7 @@ public:
|
||||||
const byte *staticOtherPublicKey, const byte *ephemeralOtherPublicKey,
|
const byte *staticOtherPublicKey, const byte *ephemeralOtherPublicKey,
|
||||||
bool validateStaticOtherPublicKey=true) const
|
bool validateStaticOtherPublicKey=true) const
|
||||||
{
|
{
|
||||||
byte *XX = NULLPTR, *YY = NULLPTR, *AA = NULLPTR, *BB = NULLPTR;
|
const byte *XX = NULLPTR, *YY = NULLPTR, *AA = NULLPTR, *BB = NULLPTR;
|
||||||
size_t xxs = 0, yys = 0, aas = 0, bbs = 0;
|
size_t xxs = 0, yys = 0, aas = 0, bbs = 0;
|
||||||
|
|
||||||
// Depending on the role, this will hold either A's or B's static
|
// Depending on the role, this will hold either A's or B's static
|
||||||
|
|
@ -144,11 +144,11 @@ public:
|
||||||
Element B = params.ExponentiateBase(b);
|
Element B = params.ExponentiateBase(b);
|
||||||
params.EncodeElement(true, B, tt);
|
params.EncodeElement(true, B, tt);
|
||||||
|
|
||||||
XX = const_cast<byte*>(ephemeralOtherPublicKey);
|
XX = ephemeralOtherPublicKey;
|
||||||
xxs = EphemeralPublicKeyLength();
|
xxs = EphemeralPublicKeyLength();
|
||||||
YY = const_cast<byte*>(ephemeralPrivateKey) + StaticPrivateKeyLength();
|
YY = ephemeralPrivateKey + StaticPrivateKeyLength();
|
||||||
yys = EphemeralPublicKeyLength();
|
yys = EphemeralPublicKeyLength();
|
||||||
AA = const_cast<byte*>(staticOtherPublicKey);
|
AA = staticOtherPublicKey;
|
||||||
aas = StaticPublicKeyLength();
|
aas = StaticPublicKeyLength();
|
||||||
BB = tt.BytePtr();
|
BB = tt.BytePtr();
|
||||||
bbs = tt.SizeInBytes();
|
bbs = tt.SizeInBytes();
|
||||||
|
|
@ -159,13 +159,13 @@ public:
|
||||||
Element A = params.ExponentiateBase(a);
|
Element A = params.ExponentiateBase(a);
|
||||||
params.EncodeElement(true, A, tt);
|
params.EncodeElement(true, A, tt);
|
||||||
|
|
||||||
XX = const_cast<byte*>(ephemeralPrivateKey) + StaticPrivateKeyLength();
|
XX = ephemeralPrivateKey + StaticPrivateKeyLength();
|
||||||
xxs = EphemeralPublicKeyLength();
|
xxs = EphemeralPublicKeyLength();
|
||||||
YY = const_cast<byte*>(ephemeralOtherPublicKey);
|
YY = ephemeralOtherPublicKey;
|
||||||
yys = EphemeralPublicKeyLength();
|
yys = EphemeralPublicKeyLength();
|
||||||
AA = tt.BytePtr();
|
AA = tt.BytePtr();
|
||||||
aas = tt.SizeInBytes();
|
aas = tt.SizeInBytes();
|
||||||
BB = const_cast<byte*>(staticOtherPublicKey);
|
BB = staticOtherPublicKey;
|
||||||
bbs = StaticPublicKeyLength();
|
bbs = StaticPublicKeyLength();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
14
hmqv.h
14
hmqv.h
|
|
@ -125,7 +125,7 @@ public:
|
||||||
const byte *staticOtherPublicKey, const byte *ephemeralOtherPublicKey,
|
const byte *staticOtherPublicKey, const byte *ephemeralOtherPublicKey,
|
||||||
bool validateStaticOtherPublicKey=true) const
|
bool validateStaticOtherPublicKey=true) const
|
||||||
{
|
{
|
||||||
byte *XX = NULLPTR, *YY = NULLPTR, *AA = NULLPTR, *BB = NULLPTR;
|
const byte *XX = NULLPTR, *YY = NULLPTR, *AA = NULLPTR, *BB = NULLPTR;
|
||||||
size_t xxs = 0, yys = 0, aas = 0, bbs = 0;
|
size_t xxs = 0, yys = 0, aas = 0, bbs = 0;
|
||||||
|
|
||||||
// Depending on the role, this will hold either A's or B's static
|
// Depending on the role, this will hold either A's or B's static
|
||||||
|
|
@ -143,11 +143,11 @@ public:
|
||||||
Element B = params.ExponentiateBase(b);
|
Element B = params.ExponentiateBase(b);
|
||||||
params.EncodeElement(true, B, tt);
|
params.EncodeElement(true, B, tt);
|
||||||
|
|
||||||
XX = const_cast<byte*>(ephemeralOtherPublicKey);
|
XX = ephemeralOtherPublicKey;
|
||||||
xxs = EphemeralPublicKeyLength();
|
xxs = EphemeralPublicKeyLength();
|
||||||
YY = const_cast<byte*>(ephemeralPrivateKey) + StaticPrivateKeyLength();
|
YY = ephemeralPrivateKey + StaticPrivateKeyLength();
|
||||||
yys = EphemeralPublicKeyLength();
|
yys = EphemeralPublicKeyLength();
|
||||||
AA = const_cast<byte*>(staticOtherPublicKey);
|
AA = staticOtherPublicKey;
|
||||||
aas = StaticPublicKeyLength();
|
aas = StaticPublicKeyLength();
|
||||||
BB = tt.BytePtr();
|
BB = tt.BytePtr();
|
||||||
bbs = tt.SizeInBytes();
|
bbs = tt.SizeInBytes();
|
||||||
|
|
@ -158,13 +158,13 @@ public:
|
||||||
Element A = params.ExponentiateBase(a);
|
Element A = params.ExponentiateBase(a);
|
||||||
params.EncodeElement(true, A, tt);
|
params.EncodeElement(true, A, tt);
|
||||||
|
|
||||||
XX = const_cast<byte*>(ephemeralPrivateKey) + StaticPrivateKeyLength();
|
XX = ephemeralPrivateKey + StaticPrivateKeyLength();
|
||||||
xxs = EphemeralPublicKeyLength();
|
xxs = EphemeralPublicKeyLength();
|
||||||
YY = const_cast<byte*>(ephemeralOtherPublicKey);
|
YY = ephemeralOtherPublicKey;
|
||||||
yys = EphemeralPublicKeyLength();
|
yys = EphemeralPublicKeyLength();
|
||||||
AA = tt.BytePtr();
|
AA = tt.BytePtr();
|
||||||
aas = tt.SizeInBytes();
|
aas = tt.SizeInBytes();
|
||||||
BB = const_cast<byte*>(staticOtherPublicKey);
|
BB = staticOtherPublicKey;
|
||||||
bbs = StaticPublicKeyLength();
|
bbs = StaticPublicKeyLength();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue