Fix const-ness in HMQV and FHMQV

This commit is contained in:
Jeffrey Walton 2019-08-03 03:24:26 -04:00
parent 176cab0dc5
commit 84c4ae429f
No known key found for this signature in database
GPG Key ID: B36AB348921B1838
2 changed files with 14 additions and 14 deletions

14
fhmqv.h
View File

@ -126,7 +126,7 @@ public:
const byte *staticOtherPublicKey, const byte *ephemeralOtherPublicKey,
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;
// Depending on the role, this will hold either A's or B's static
@ -144,11 +144,11 @@ public:
Element B = params.ExponentiateBase(b);
params.EncodeElement(true, B, tt);
XX = const_cast<byte*>(ephemeralOtherPublicKey);
XX = ephemeralOtherPublicKey;
xxs = EphemeralPublicKeyLength();
YY = const_cast<byte*>(ephemeralPrivateKey) + StaticPrivateKeyLength();
YY = ephemeralPrivateKey + StaticPrivateKeyLength();
yys = EphemeralPublicKeyLength();
AA = const_cast<byte*>(staticOtherPublicKey);
AA = staticOtherPublicKey;
aas = StaticPublicKeyLength();
BB = tt.BytePtr();
bbs = tt.SizeInBytes();
@ -159,13 +159,13 @@ public:
Element A = params.ExponentiateBase(a);
params.EncodeElement(true, A, tt);
XX = const_cast<byte*>(ephemeralPrivateKey) + StaticPrivateKeyLength();
XX = ephemeralPrivateKey + StaticPrivateKeyLength();
xxs = EphemeralPublicKeyLength();
YY = const_cast<byte*>(ephemeralOtherPublicKey);
YY = ephemeralOtherPublicKey;
yys = EphemeralPublicKeyLength();
AA = tt.BytePtr();
aas = tt.SizeInBytes();
BB = const_cast<byte*>(staticOtherPublicKey);
BB = staticOtherPublicKey;
bbs = StaticPublicKeyLength();
}
else

14
hmqv.h
View File

@ -125,7 +125,7 @@ public:
const byte *staticOtherPublicKey, const byte *ephemeralOtherPublicKey,
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;
// Depending on the role, this will hold either A's or B's static
@ -143,11 +143,11 @@ public:
Element B = params.ExponentiateBase(b);
params.EncodeElement(true, B, tt);
XX = const_cast<byte*>(ephemeralOtherPublicKey);
XX = ephemeralOtherPublicKey;
xxs = EphemeralPublicKeyLength();
YY = const_cast<byte*>(ephemeralPrivateKey) + StaticPrivateKeyLength();
YY = ephemeralPrivateKey + StaticPrivateKeyLength();
yys = EphemeralPublicKeyLength();
AA = const_cast<byte*>(staticOtherPublicKey);
AA = staticOtherPublicKey;
aas = StaticPublicKeyLength();
BB = tt.BytePtr();
bbs = tt.SizeInBytes();
@ -158,13 +158,13 @@ public:
Element A = params.ExponentiateBase(a);
params.EncodeElement(true, A, tt);
XX = const_cast<byte*>(ephemeralPrivateKey) + StaticPrivateKeyLength();
XX = ephemeralPrivateKey + StaticPrivateKeyLength();
xxs = EphemeralPublicKeyLength();
YY = const_cast<byte*>(ephemeralOtherPublicKey);
YY = ephemeralOtherPublicKey;
yys = EphemeralPublicKeyLength();
AA = tt.BytePtr();
aas = tt.SizeInBytes();
BB = const_cast<byte*>(staticOtherPublicKey);
BB = staticOtherPublicKey;
bbs = StaticPublicKeyLength();
}
else