Add Device info validator to oemcrypto util and unit tests

Validator that can parse and validate device info Cbor object.
This is to support better prov40 unit tests regarding
OEMCrypto_GetDeviceInformation() later.

Test: opk_ta_p40
Bug: 300304834
Change-Id: Ic260a6626dffcbef5d6b386263839499f83a69db
This commit is contained in:
Cong Lin
2023-11-29 13:00:51 -08:00
committed by Robert Shih
parent d5157c536d
commit d8ce542ff9
4 changed files with 314 additions and 0 deletions

View File

@@ -68,6 +68,12 @@ class CborValidator {
// Writes validation output |msg| to |validate_messages_|, and updates
// |message_status_| if the |status| is more severe than the current value.
void AddValidationMessage(CborMessageStatus status, const std::string& msg);
static const cppbor::Item* GetMapEntry(const cppbor::Map& map,
const std::string& entry_name);
// Checks whether an entry with |entry_name| and |major_type| exists in |map|.
static std::string CheckMapEntry(const cppbor::Map& map,
cppbor::MajorType major_type,
const std::string& entry_name);
CborMessageStatus message_status_ = kCborUninitialized;
private: