Merge "KeyMint VTS: x25519 pubkey as SubjectPublicKeyInfo" am: 53cf63d1fd
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2092269 Change-Id: I8f4b806aafc64d97942aa0bb5cf6248a7efc7d06 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
0b4d491139
1 changed files with 11 additions and 10 deletions
|
@ -7482,7 +7482,6 @@ class KeyAgreementTest : public KeyMintAidlTestBase {
|
|||
uint8_t privKeyData[32];
|
||||
uint8_t pubKeyData[32];
|
||||
X25519_keypair(pubKeyData, privKeyData);
|
||||
*localPublicKey = vector<uint8_t>(pubKeyData, pubKeyData + 32);
|
||||
*localPrivKey = EVP_PKEY_Ptr(EVP_PKEY_new_raw_private_key(
|
||||
EVP_PKEY_X25519, nullptr, privKeyData, sizeof(privKeyData)));
|
||||
} else {
|
||||
|
@ -7494,16 +7493,15 @@ class KeyAgreementTest : public KeyMintAidlTestBase {
|
|||
ASSERT_EQ(EC_KEY_generate_key(ecKey.get()), 1);
|
||||
*localPrivKey = EVP_PKEY_Ptr(EVP_PKEY_new());
|
||||
ASSERT_EQ(EVP_PKEY_set1_EC_KEY(localPrivKey->get(), ecKey.get()), 1);
|
||||
|
||||
// Get encoded form of the public part of the locally generated key...
|
||||
unsigned char* p = nullptr;
|
||||
int localPublicKeySize = i2d_PUBKEY(localPrivKey->get(), &p);
|
||||
ASSERT_GT(localPublicKeySize, 0);
|
||||
*localPublicKey =
|
||||
vector<uint8_t>(reinterpret_cast<const uint8_t*>(p),
|
||||
reinterpret_cast<const uint8_t*>(p + localPublicKeySize));
|
||||
OPENSSL_free(p);
|
||||
}
|
||||
|
||||
// Get encoded form of the public part of the locally generated key...
|
||||
unsigned char* p = nullptr;
|
||||
int localPublicKeySize = i2d_PUBKEY(localPrivKey->get(), &p);
|
||||
ASSERT_GT(localPublicKeySize, 0);
|
||||
*localPublicKey = vector<uint8_t>(reinterpret_cast<const uint8_t*>(p),
|
||||
reinterpret_cast<const uint8_t*>(p + localPublicKeySize));
|
||||
OPENSSL_free(p);
|
||||
}
|
||||
|
||||
void GenerateKeyMintEcKey(EcCurve curve, EVP_PKEY_Ptr* kmPubKey) {
|
||||
|
@ -7598,6 +7596,9 @@ TEST_P(KeyAgreementTest, Ecdh) {
|
|||
//
|
||||
for (auto curve : ValidCurves()) {
|
||||
for (auto localCurve : ValidCurves()) {
|
||||
SCOPED_TRACE(testing::Message()
|
||||
<< "local-curve-" << localCurve << "-keymint-curve-" << curve);
|
||||
|
||||
// Generate EC key locally (with access to private key material)
|
||||
EVP_PKEY_Ptr localPrivKey;
|
||||
vector<uint8_t> localPublicKey;
|
||||
|
|
Loading…
Reference in a new issue