summaryrefslogtreecommitdiff
path: root/security/keymint/support/remote_prov_utils.cpp
diff options
context:
space:
mode:
authorSeth Moore <sethmo@google.com>2021-06-22 16:47:48 -0700
committerSeth Moore <sethmo@google.com>2021-06-25 10:48:33 -0700
commit42a2f6b6e26dac1b282d91e7726203f10f4b4249 (patch)
tree723ddd2a627c26212e7def3b6bb7cb2cf7762cf1 /security/keymint/support/remote_prov_utils.cpp
parent2e749339455083665428a0d91e350be7ad73c446 (diff)
Add a unit test for remote_prov_utils
This functionality will be used for the factory tooling, so we should test it. Additionally, some new functionality will soon be added, and it also needs to be tested. Test: libkeymint_remote_prov_support_test Bug: 191301285 Change-Id: I6a8798fc4b09fff1e829185a4b9e471921e5d2a9 Merged-In: I6a8798fc4b09fff1e829185a4b9e471921e5d2a9
Diffstat (limited to 'security/keymint/support/remote_prov_utils.cpp')
-rw-r--r--security/keymint/support/remote_prov_utils.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/security/keymint/support/remote_prov_utils.cpp b/security/keymint/support/remote_prov_utils.cpp
index 33f1ed3353..ac7cb6219f 100644
--- a/security/keymint/support/remote_prov_utils.cpp
+++ b/security/keymint/support/remote_prov_utils.cpp
@@ -31,6 +31,10 @@ bytevec randomBytes(size_t numBytes) {
}
ErrMsgOr<EekChain> generateEekChain(size_t length, const bytevec& eekId) {
+ if (length < 2) {
+ return "EEK chain must contain at least 2 certs.";
+ }
+
auto eekChain = cppbor::Array();
bytevec prev_priv_key;