Merge "Updated the digest to SHA_2_256 in key upgrade tests." am: 2831fa2bf2 am: 962b7bb557 am: 8639c667d6

Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2393752

Change-Id: Ida58bf7a9ab4ccfc8f3eb6b3a39e6b6802a2a53a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2023-02-03 01:50:07 +00:00 committed by Automerger Merge Worker
commit f2b88676d3

View file

@ -297,14 +297,14 @@ TEST_P(KeyBlobUpgradeTest, CreateKeyBlobsBefore) {
.Authorization(TAG_NO_AUTH_REQUIRED)},
{"hmac-key", AuthorizationSetBuilder()
.HmacKey(128)
.Digest(Digest::SHA1)
.Digest(Digest::SHA_2_256)
.Authorization(TAG_MIN_MAC_LENGTH, 128)
.Authorization(TAG_NO_AUTH_REQUIRED)},
{"rsa-key", AuthorizationSetBuilder()
.RsaEncryptionKey(2048, 65537)
.Authorization(TAG_PURPOSE, KeyPurpose::SIGN)
.Digest(Digest::NONE)
.Digest(Digest::SHA1)
.Digest(Digest::SHA_2_256)
.Padding(PaddingMode::NONE)
.Authorization(TAG_NO_AUTH_REQUIRED)
.SetDefaultValidity()},
@ -314,7 +314,7 @@ TEST_P(KeyBlobUpgradeTest, CreateKeyBlobsBefore) {
.EcdsaSigningKey(EcCurve::P_256)
.Authorization(TAG_PURPOSE, KeyPurpose::AGREE_KEY)
.Digest(Digest::NONE)
.Digest(Digest::SHA1)
.Digest(Digest::SHA_2_256)
.Authorization(TAG_NO_AUTH_REQUIRED)
.SetDefaultValidity(),
},
@ -471,7 +471,7 @@ TEST_P(KeyBlobUpgradeTest, UseKeyBlobsBeforeOrAfter) {
string plaintext = DecryptMessage(keyblob, ciphertext, builder);
EXPECT_EQ(message, plaintext);
} else if (name.find("hmac-key") != std::string::npos) {
builder.Digest(Digest::SHA1);
builder.Digest(Digest::SHA_2_256);
auto sign_builder = builder;
sign_builder.Authorization(TAG_MAC_LENGTH, 128);
string tag = SignMessage(keyblob, message, sign_builder);
@ -481,7 +481,7 @@ TEST_P(KeyBlobUpgradeTest, UseKeyBlobsBeforeOrAfter) {
string signature = SignMessage(keyblob, message, builder);
LocalVerifyMessage(cert, message, signature, builder);
} else if (name.find("p256-key") != std::string::npos) {
builder.Digest(Digest::SHA1);
builder.Digest(Digest::SHA_2_256);
string signature = SignMessage(keyblob, message, builder);
LocalVerifyMessage(cert, message, signature, builder);
} else if (name.find("ed25519-key") != std::string::npos) {