From 07c7d28a844e14605906c3085bef5912d031561d Mon Sep 17 00:00:00 2001 From: Subrahmanya Manikanta Venkateswarlu Bhamidipati Kameswara Sri Date: Wed, 26 Jul 2023 01:10:22 +0000 Subject: [PATCH] Update the TimeoutAuthenticationMultiSid test Update TimeoutAuthenticationMultiSid test to support generateKey for Strongbox implementations without factory attestation. Bug: 293211157 Test: run vts -m VtsAidlKeyMintTarget Change-Id: I27bf08d2fd2d9e0217a90ee8ccb789adfd9d5f7f --- security/keymint/aidl/vts/functional/AuthTest.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/security/keymint/aidl/vts/functional/AuthTest.cpp b/security/keymint/aidl/vts/functional/AuthTest.cpp index 290e8fcf64..ecaee11f6f 100644 --- a/security/keymint/aidl/vts/functional/AuthTest.cpp +++ b/security/keymint/aidl/vts/functional/AuthTest.cpp @@ -453,8 +453,18 @@ TEST_P(AuthTest, TimeoutAuthenticationMultiSid) { vector keyblob; vector key_characteristics; vector cert_chain; - ASSERT_EQ(ErrorCode::OK, - GenerateKey(builder, std::nullopt, &keyblob, &key_characteristics, &cert_chain)); + auto result = GenerateKey(builder, std::nullopt, &keyblob, &key_characteristics, &cert_chain); + if (SecLevel() == SecurityLevel::STRONGBOX) { + if (result == ErrorCode::ATTESTATION_KEYS_NOT_PROVISIONED) { + result = GenerateKeyWithSelfSignedAttestKey(AuthorizationSetBuilder() + .EcdsaKey(EcCurve::P_256) + .AttestKey() + .SetDefaultValidity(), + builder, &keyblob, &key_characteristics, + &cert_chain); + } + } + ASSERT_EQ(ErrorCode::OK, result); // Verify first user to get a HAT that should work. const uint64_t challenge = 42;