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
This commit is contained in:
Cong Lin
2023-09-25 15:40:23 -07:00
committed by Robert Shih
parent 8d77db54d0
commit 64124a7832

View File

@@ -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.