Loading security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp +9 −4 Original line number Diff line number Diff line Loading @@ -44,7 +44,9 @@ using std::unique_ptr; using ::testing::AssertionFailure; using ::testing::AssertionResult; using ::testing::AssertionSuccess; using ::testing::ElementsAreArray; using ::testing::MatchesRegex; using ::testing::Not; ::std::ostream& operator<<(::std::ostream& os, const AuthorizationSet& set) { if (set.size() == 0) Loading Loading @@ -1548,14 +1550,17 @@ void check_maced_pubkey(const MacedPublicKey& macedPubKey, bool testMode, EXPECT_EQ(extractedTag.size(), 32U); // Compare with tag generated with kTestMacKey. Should only match in test mode auto testTag = cppcose::generateCoseMac0Mac(remote_prov::kTestMacKey, {} /* external_aad */, payload->value()); auto macFunction = [](const cppcose::bytevec& input) { return cppcose::generateHmacSha256(remote_prov::kTestMacKey, input); }; auto testTag = cppcose::generateCoseMac0Mac(macFunction, {} /* external_aad */, payload->value()); ASSERT_TRUE(testTag) << "Tag calculation failed: " << testTag.message(); if (testMode) { EXPECT_EQ(*testTag, extractedTag); EXPECT_THAT(*testTag, ElementsAreArray(extractedTag)); } else { EXPECT_NE(*testTag, extractedTag); EXPECT_THAT(*testTag, Not(ElementsAreArray(extractedTag))); } if (payload_value != nullptr) { *payload_value = payload->value(); Loading Loading
security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp +9 −4 Original line number Diff line number Diff line Loading @@ -44,7 +44,9 @@ using std::unique_ptr; using ::testing::AssertionFailure; using ::testing::AssertionResult; using ::testing::AssertionSuccess; using ::testing::ElementsAreArray; using ::testing::MatchesRegex; using ::testing::Not; ::std::ostream& operator<<(::std::ostream& os, const AuthorizationSet& set) { if (set.size() == 0) Loading Loading @@ -1548,14 +1550,17 @@ void check_maced_pubkey(const MacedPublicKey& macedPubKey, bool testMode, EXPECT_EQ(extractedTag.size(), 32U); // Compare with tag generated with kTestMacKey. Should only match in test mode auto testTag = cppcose::generateCoseMac0Mac(remote_prov::kTestMacKey, {} /* external_aad */, payload->value()); auto macFunction = [](const cppcose::bytevec& input) { return cppcose::generateHmacSha256(remote_prov::kTestMacKey, input); }; auto testTag = cppcose::generateCoseMac0Mac(macFunction, {} /* external_aad */, payload->value()); ASSERT_TRUE(testTag) << "Tag calculation failed: " << testTag.message(); if (testMode) { EXPECT_EQ(*testTag, extractedTag); EXPECT_THAT(*testTag, ElementsAreArray(extractedTag)); } else { EXPECT_NE(*testTag, extractedTag); EXPECT_THAT(*testTag, Not(ElementsAreArray(extractedTag))); } if (payload_value != nullptr) { *payload_value = payload->value(); Loading