Fix authenticated key agreement domain parameter consistency test
parent
7eeb954b23
commit
2e6ccd7fb1
|
|
@ -133,7 +133,7 @@ bool AuthenticatedKeyAgreementValidate(AuthenticatedKeyAgreementDomain &d)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AuthenticatedKeyAgreementValidateWithRoles(AuthenticatedKeyAgreementDomain &initiator, AuthenticatedKeyAgreementDomain &responder)
|
bool AuthenticatedKeyAgreementWithRolesValidate(AuthenticatedKeyAgreementDomain &initiator, AuthenticatedKeyAgreementDomain &responder)
|
||||||
{
|
{
|
||||||
if (initiator.GetCryptoParameters().Validate(GlobalRNG(), 3))
|
if (initiator.GetCryptoParameters().Validate(GlobalRNG(), 3))
|
||||||
std::cout << "passed authenticated key agreement domain parameters validation (initiator)" << std::endl;
|
std::cout << "passed authenticated key agreement domain parameters validation (initiator)" << std::endl;
|
||||||
|
|
@ -157,12 +157,12 @@ bool AuthenticatedKeyAgreementValidateWithRoles(AuthenticatedKeyAgreementDomain
|
||||||
initiator.EphemeralPublicKeyLength() != responder.EphemeralPublicKeyLength() ||
|
initiator.EphemeralPublicKeyLength() != responder.EphemeralPublicKeyLength() ||
|
||||||
initiator.AgreedValueLength() != responder.AgreedValueLength())
|
initiator.AgreedValueLength() != responder.AgreedValueLength())
|
||||||
{
|
{
|
||||||
std::cout << "passed authenticated key agreement domain parameter consistency" << std::endl;
|
std::cout << "FAILED authenticated key agreement domain parameter consistency" << std::endl;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
std::cout << "FAILED authenticated key agreement domain parameter consistency" << std::endl;
|
std::cout << "passed authenticated key agreement domain parameter consistency" << std::endl;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SecByteBlock spriv1(initiator.StaticPrivateKeyLength()), spriv2(responder.StaticPrivateKeyLength());
|
SecByteBlock spriv1(initiator.StaticPrivateKeyLength()), spriv2(responder.StaticPrivateKeyLength());
|
||||||
|
|
|
||||||
12
validat7.cpp
12
validat7.cpp
|
|
@ -91,7 +91,7 @@ bool ValidateHMQV()
|
||||||
const OID oid = ASN1::secp256r1();
|
const OID oid = ASN1::secp256r1();
|
||||||
ECHMQV< ECP >::Domain hmqvA256(oid, true /*client*/);
|
ECHMQV< ECP >::Domain hmqvA256(oid, true /*client*/);
|
||||||
|
|
||||||
success = AuthenticatedKeyAgreementValidateWithRoles(hmqvA256, hmqvB256) && success;
|
success = AuthenticatedKeyAgreementWithRolesValidate(hmqvA256, hmqvB256) && success;
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
|
|
||||||
|
|
@ -102,7 +102,7 @@ bool ValidateHMQV()
|
||||||
const OID oid384 = ASN1::secp384r1();
|
const OID oid384 = ASN1::secp384r1();
|
||||||
ECHMQV384 hmqvA384(oid384, true /*client*/);
|
ECHMQV384 hmqvA384(oid384, true /*client*/);
|
||||||
|
|
||||||
success = AuthenticatedKeyAgreementValidateWithRoles(hmqvA384, hmqvB384) && success;
|
success = AuthenticatedKeyAgreementWithRolesValidate(hmqvA384, hmqvB384) && success;
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
|
|
||||||
|
|
@ -113,7 +113,7 @@ bool ValidateHMQV()
|
||||||
const OID oid521 = ASN1::secp521r1();
|
const OID oid521 = ASN1::secp521r1();
|
||||||
ECHMQV512 hmqvA521(oid521, true /*client*/);
|
ECHMQV512 hmqvA521(oid521, true /*client*/);
|
||||||
|
|
||||||
success = AuthenticatedKeyAgreementValidateWithRoles(hmqvA521, hmqvB521) && success;
|
success = AuthenticatedKeyAgreementWithRolesValidate(hmqvA521, hmqvB521) && success;
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
@ -136,7 +136,7 @@ bool ValidateFHMQV()
|
||||||
const OID oid = ASN1::secp256r1();
|
const OID oid = ASN1::secp256r1();
|
||||||
ECFHMQV< ECP >::Domain fhmqvA256(oid, true /*client*/);
|
ECFHMQV< ECP >::Domain fhmqvA256(oid, true /*client*/);
|
||||||
|
|
||||||
success = AuthenticatedKeyAgreementValidateWithRoles(fhmqvA256, fhmqvB256) && success;
|
success = AuthenticatedKeyAgreementWithRolesValidate(fhmqvA256, fhmqvB256) && success;
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
|
|
||||||
|
|
@ -147,7 +147,7 @@ bool ValidateFHMQV()
|
||||||
const OID oid384 = ASN1::secp384r1();
|
const OID oid384 = ASN1::secp384r1();
|
||||||
ECHMQV384 fhmqvA384(oid384, true /*client*/);
|
ECHMQV384 fhmqvA384(oid384, true /*client*/);
|
||||||
|
|
||||||
success = AuthenticatedKeyAgreementValidateWithRoles(fhmqvA384, fhmqvB384) && success;
|
success = AuthenticatedKeyAgreementWithRolesValidate(fhmqvA384, fhmqvB384) && success;
|
||||||
|
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
|
|
||||||
|
|
@ -158,7 +158,7 @@ bool ValidateFHMQV()
|
||||||
const OID oid521 = ASN1::secp521r1();
|
const OID oid521 = ASN1::secp521r1();
|
||||||
ECHMQV512 fhmqvA521(oid521, true /*client*/);
|
ECHMQV512 fhmqvA521(oid521, true /*client*/);
|
||||||
|
|
||||||
success = AuthenticatedKeyAgreementValidateWithRoles(fhmqvA521, fhmqvB521) && success;
|
success = AuthenticatedKeyAgreementWithRolesValidate(fhmqvA521, fhmqvB521) && success;
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -344,7 +344,7 @@ bool RunTestDataFile(const char *filename, const NameValuePairs &overrideParamet
|
||||||
// Definitions in validat6.cpp
|
// Definitions in validat6.cpp
|
||||||
bool CryptoSystemValidate(PK_Decryptor &priv, PK_Encryptor &pub, bool thorough = false);
|
bool CryptoSystemValidate(PK_Decryptor &priv, PK_Encryptor &pub, bool thorough = false);
|
||||||
bool SimpleKeyAgreementValidate(SimpleKeyAgreementDomain &d);
|
bool SimpleKeyAgreementValidate(SimpleKeyAgreementDomain &d);
|
||||||
bool AuthenticatedKeyAgreementValidateWithRoles(AuthenticatedKeyAgreementDomain &initiator, AuthenticatedKeyAgreementDomain &responder);
|
bool AuthenticatedKeyAgreementWithRolesValidate(AuthenticatedKeyAgreementDomain &initiator, AuthenticatedKeyAgreementDomain &responder);
|
||||||
bool AuthenticatedKeyAgreementValidate(AuthenticatedKeyAgreementDomain &d);
|
bool AuthenticatedKeyAgreementValidate(AuthenticatedKeyAgreementDomain &d);
|
||||||
bool SignatureValidate(PK_Signer &priv, PK_Verifier &pub, bool thorough = false);
|
bool SignatureValidate(PK_Signer &priv, PK_Verifier &pub, bool thorough = false);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue