Attest: Get option flags from challenge object
Special option flags (for test purpose) can be passed in for
attestation service. These flags are encoded in the challenge object.
Previously a 36 bytes long challenge object was used to carry these
4 extra bytes, but attestation API requires the challenge object to be
only 32, 48 or 64 bytes long.
With this change the option flags are packed in a 64 bytes long
challenge object which has a predefined value. If the challenge object
is 64 byte long and the bytes from 4 to 63 have 0 value in this case
the first 4 bytes are handled as the option flags.
Change-Id: I2a4d0bf417905d74cca0fbdb5070cdef085fe308
Signed-off-by: Laurence Lundblade <lgl@securitytheory.com>
Co-authored-by: Tamas Ban <tamas.ban@arm.com>
diff --git a/lib/ext/qcbor/test/UsefulBuf_Tests.c b/lib/ext/qcbor/test/UsefulBuf_Tests.c
index cfa1262..388f8cf 100644
--- a/lib/ext/qcbor/test/UsefulBuf_Tests.c
+++ b/lib/ext/qcbor/test/UsefulBuf_Tests.c
@@ -544,6 +544,30 @@
return "Copy null/empty failed";
}
+ if(UsefulBuf_IsValue(ExpectedShorter, '+') != SIZE_MAX) {
+ return "IsValue failed to match all";
+ }
+
+ if(UsefulBuf_IsValue(ExpectedShorter, '-') != 0) {
+ return "IsValue should have failed right away";
+ }
+
+ if(UsefulBuf_IsValue(NULLUsefulBufC, 0x00) != 0) {
+ return "IsValue failed on NULLUsefulBufC";
+ }
+
+ if(UsefulBuf_IsValue((UsefulBufC){(uint8_t[]){0x00}, 1}, 0x00) != SIZE_MAX) {
+ return "IsValue failed finding 0 in one byte of 0";
+ }
+
+ if(UsefulBuf_IsValue((UsefulBufC){(uint8_t[]){0x00}, 1}, 0x01) != 0) {
+ return "IsValue failed not finding 1 in one byte of 0";
+ }
+
+ if(UsefulBuf_IsValue(ExpectedSmaller, '+') != ExpectedSmaller.len -1) {
+ return "IsValue failed to find final *";
+ }
+
// Look for +++++... in +++++... and find it at the beginning
if(0 != UsefulBuf_FindBytes(ExpectedLonger, ExpectedShorter)){
return "Failed to find";