From 64124a783232c232583b3059f0e44fcd924153bd Mon Sep 17 00:00:00 2001 From: Cong Lin Date: Mon, 25 Sep 2023 15:40:23 -0700 Subject: [PATCH] Add BCC validation to oemcrypto unit tests The returned BCC from OEMCrypto_GetBootCertificateChain() can be validated by unit tests with BccValidator. Test: run_fake_l1_tests, opk_ta_p40 Bug: 300304834 Bug: 307968622 Change-Id: I6312cb45548f5d8a711c13ea0356d6ec8db51082 --- libwvdrmengine/oemcrypto/test/oemcrypto_provisioning_test.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libwvdrmengine/oemcrypto/test/oemcrypto_provisioning_test.cpp b/libwvdrmengine/oemcrypto/test/oemcrypto_provisioning_test.cpp index 7047d8c6..5b0eb16c 100644 --- a/libwvdrmengine/oemcrypto/test/oemcrypto_provisioning_test.cpp +++ b/libwvdrmengine/oemcrypto/test/oemcrypto_provisioning_test.cpp @@ -5,6 +5,7 @@ #include "oemcrypto_provisioning_test.h" +#include "bcc_validator.h" #include "log.h" #include "platform.h" #include "test_sleep.h" @@ -232,6 +233,9 @@ TEST_F(OEMCryptoProv40Test, GetBootCertificateChainSuccess) { additional_signature.data(), &additional_signature_size), OEMCrypto_SUCCESS); + util::BccValidator validator; + EXPECT_EQ(util::CborMessageStatus::kCborParseOk, validator.Parse(bcc)); + EXPECT_EQ(util::CborMessageStatus::kCborValidateOk, validator.Validate()); } // Verifies that short buffer error returns when the buffer is short.