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/inc/UsefulBuf.h b/lib/ext/qcbor/inc/UsefulBuf.h
index 0aaa9b6..682646e 100644
--- a/lib/ext/qcbor/inc/UsefulBuf.h
+++ b/lib/ext/qcbor/inc/UsefulBuf.h
@@ -1,7 +1,6 @@
/*==============================================================================
Copyright (c) 2016-2018, The Linux Foundation.
Copyright (c) 2018-2019, Laurence Lundblade.
- All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
@@ -42,6 +41,7 @@
when who what, where, why
-------- ---- ---------------------------------------------------
+ 3/6/2019 llundblade Add UsefulBuf_IsValue()
12/17/2018 llundblade Remove const from UsefulBuf and UsefulBufC .len
12/13/2018 llundblade Documentation improvements
09/18/2018 llundblade Cleaner distinction between UsefulBuf and UsefulBufC
@@ -480,10 +480,10 @@
/**
- @brief Compare two UsefulBufCs
+ @brief Compare two UsefulBufCs.
- @param[in] UB1 The destination buffer to copy into
- @param[in] UB2 The source to copy from
+ @param[in] UB1 First UsefulBufC to compare.
+ @param[in] UB2 Second UsefulBufC to compare.
@return 0 if equal...
@@ -504,6 +504,27 @@
/**
+ @brief Find first byte that is not a particular byte value.
+
+ @param[in] UB The destination buffer for byte comparison.
+ @param[in] uValue The byte value to compare to.
+
+ @return Offset of first byte that isn't \c uValue or
+ SIZE_MAX if all bytes are \c uValue.
+
+ Note that unlike most comparison functions, 0
+ does not indicate a successful comparison, so the
+ test for match is:
+
+ UsefulBuf_IsValue(...) == SIZE_MAX
+
+ If \c UB is NULL or empty, there is no match
+ and 0 is returned.
+ */
+size_t UsefulBuf_IsValue(const UsefulBufC UB, uint8_t uValue);
+
+
+/**
@brief Find one UsefulBuf in another
@param[in] BytesToSearch UsefulBuf to search through