diff --git a/Makefile.psa b/Makefile.psa index dbf6c4de..05aca3ff 100644 --- a/Makefile.psa +++ b/Makefile.psa @@ -64,7 +64,7 @@ INC=-I inc -I test -I src ALL_INC=$(INC) $(CRYPTO_INC) $(QCBOR_INC) CFLAGS=$(CMD_LINE) $(ALL_INC) $(C_OPTS) $(TEST_CONFIG_OPTS) $(CRYPTO_CONFIG_OPTS) -SRC_OBJ=src/t_cose_sign1_verify.o src/t_cose_sign1_sign.o src/t_cose_util.o src/t_cose_parameters.o +SRC_OBJ=src/t_cose_sign1_verify.o src/t_cose_sign1_sign.o src/t_cose_util.o src/t_cose_parameters.o src/t_cose_sign_mini_verify.o .PHONY: all install install_headers install_so uninstall clean diff --git a/examples/t_cose_basic_example_psa.c b/examples/t_cose_basic_example_psa.c index 58afb0fc..2b7752a2 100644 --- a/examples/t_cose_basic_example_psa.c +++ b/examples/t_cose_basic_example_psa.c @@ -14,6 +14,8 @@ #include "t_cose/t_cose_sign1_verify.h" #include "t_cose/q_useful_buf.h" +#include "t_cose/t_cose_sign_mini_verify.h" + #include "psa/crypto.h" #include @@ -595,11 +597,82 @@ int two_step_sign_example(void) return (int)return_value; } + +void mini() +{ + struct t_cose_sign1_sign_ctx sign_ctx; + enum t_cose_err_t return_value; + Q_USEFUL_BUF_MAKE_STACK_UB( signed_cose_buffer, 300); + struct q_useful_buf_c signed_cose; + struct q_useful_buf_c payload; + struct t_cose_key key_pair; + + + return_value = make_psa_ecdsa_key_pair(T_COSE_ALGORITHM_ES384, &key_pair); + + /* ------ Initialize for signing ------ + * + * Initialize the signing context by telling it the signing + * algorithm and signing options. No options are set here hence + * the 0 value. + * + * Set up the signing key and kid (key ID). No kid is passed here + * hence the NULL_Q_USEFUL_BUF_C. + */ + + t_cose_sign1_sign_init(&sign_ctx, T_COSE_OPT_OMIT_CBOR_TAG, T_COSE_ALGORITHM_ES384); + + t_cose_sign1_set_signing_key(&sign_ctx, key_pair, NULL_Q_USEFUL_BUF_C); + + printf("Initialized t_cose and configured signing key\n"); + + + /* ------ Sign ------ + * + * This performs encoding of the headers, the signing and formatting + * in one shot. + * + * With this API the payload ends up in memory twice, once as the + * input and once in the output. If the payload is large, this + * needs about double the size of the payload to work. + */ + return_value = t_cose_sign1_sign(/* The context set up with signing key */ + &sign_ctx, + /* Pointer and length of payload to be + * signed. + */ + Q_USEFUL_BUF_FROM_SZ_LITERAL("XX"), + /* Non-const pointer and length of the + * buffer where the completed output is + * written to. The length here is that + * of the whole buffer. + */ + signed_cose_buffer, + /* Const pointer and actual length of + * the completed, signed and encoded + * COSE_Sign1 message. This points + * into the output buffer and has the + * lifetime of the output buffer. + */ + &signed_cose); + + + + return_value = + t_cose_sign1_mini_verify(signed_cose, + key_pair, + &payload); + + +} + int main(int argc, const char * argv[]) { (void)argc; /* Avoid unused parameter error */ (void)argv; + mini(); + one_step_sign_example(); two_step_sign_example(); } diff --git a/inc/t_cose/t_cose_sign_mini_verify.h b/inc/t_cose/t_cose_sign_mini_verify.h new file mode 100644 index 00000000..66fd3c70 --- /dev/null +++ b/inc/t_cose/t_cose_sign_mini_verify.h @@ -0,0 +1,80 @@ +/* + * t_cose_sign_mini_verify.h + * + * Copyright 2022-2023, Laurence Lundblade + * + * Created by Laurence Lundblade on 8/17/22. + * + * SPDX-License-Identifier: BSD-3-Clause + * + * See BSD-3-Clause license in README.md + */ + +#ifndef t_cose_sign_mini_verify_h +#define t_cose_sign_mini_verify_h + +#include "t_cose/q_useful_buf.h" +#include "t_cose/t_cose_common.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +/* + * The algorithm is set at compile time for mini sign and can't be + * changed. Only one algorithm is + * supported at a time. Define one of these to configure the algorithm. If + * none are configured, ES256 is selected. + +#define T_COSE_MINI_VERIFY_SELECT_ES256 +#define T_COSE_MINI_VERIFY_SELECT_ES384 +#define T_COSE_MINI_VERIFY_SELECT_ES512 +*/ + +#if !defined(T_COSE_MINI_VERIFY_SELECT_ES256) && \ + !defined(T_COSE_MINI_VERIFY_SELECT_ES384) && \ + !defined(T_COSE_MINI_VERIFY_SELECT_ES512) +#define T_COSE_MINI_VERIFY_SELECT_ES256 +#endif + + +/** + * @brief Minature verification of COSE_Sign1 + * + * @param[in] cose_sign1 The COSE_Sign1 to verify. + * @param[in] verification_key The verification key. + * @param[out] payload Pointer and length of verified payload. + * + * @return The error result. + * + * This is an implementation of \c COSE_Sign1 verification + * with very small, near minimun code size. It has + * almost no external dependency, except a crypto library, + * not even a CBOR library. + * + * Only one algorithm is supported at a time. If the + * input \c COSE_Sign1 doesn't use that algorithm + * an error is returned. + * + * There is no header decoding to retrieve a key ID, so + * identification of the key must be by some other means. + * + * It simply checks that the algorithm header parameter + * matches what it compiled to support, decodes + * the payload and the signature, verifies the + * signature and returns the verified payload. + * + * This has very crude error reporting in order to keep + * the code size small. Success is always success and failure + * always failure, but the failure reported might be misleading + * as to the actual reason for the failure. + */ +enum t_cose_err_t +t_cose_sign1_mini_verify(struct q_useful_buf_c cose_sign1, + struct t_cose_key verification_key, + struct q_useful_buf_c *payload); + + + +#endif /* t_cose_sign_mini_verify_h */ diff --git a/src/t_cose_sign_mini_verify.c b/src/t_cose_sign_mini_verify.c new file mode 100644 index 00000000..ee80a75a --- /dev/null +++ b/src/t_cose_sign_mini_verify.c @@ -0,0 +1,329 @@ +/* + * t_cose_sign_mini_verify.c + * + * Copyright 2022-2023, Laurence Lundblade + * + * Created by Laurence Lundblade on 8/17/22. + * + * SPDX-License-Identifier: BSD-3-Clause + * + * See BSD-3-Clause license in README.md + */ + +#include "t_cose/t_cose_sign_mini_verify.h" +#include "t_cose_crypto.h" + + +/* + This has only two external dependencies. + + First is just the definition of struct useful_buf and struct useful_buf_c. + These are simpler each containing only a pointer and length. + There is no code generated from these. + + The second is the crypto adapter layer for the hash + and signature verification algorithms. + + + WARNING: at this point this code is not tested or carefully + reviewed for issues with pointer manipulation. It does not + use the UsefulBuf functions so gains little memory safety + from the use of struct useful_buf. + + That said, this code was + derived from QCBOR and t_cose which are highly tested, but + this should be reviewed, fuzzed and such to be sure before + use in critical commercial applications like boot + verification. + + */ + + + +#ifdef T_COSE_MINI_VERIFY_SELECT_ES256 +#define HASH_ALG_TO_USE -16 /* IANA registration for SHA 256 */ +#define SIG_ALG_TO_USE T_COSE_ALGORITHM_ES256 +#define HASH_LENGTH 32 /* Length of SHA 256 */ +#define PROT_HEADERS_FRAG "\x44\xA1\x01\x26" // For ES256 +#endif /* T_COSE_MINI_VERIFY_SELECT_ES256 */ + +#ifdef T_COSE_MINI_VERIFY_SELECT_ES384 +#define HASH_ALG_TO_USE -43 /* IANA registration for SHA 384 */ +#define SIG_ALG_TO_USE T_COSE_ALGORITHM_ES384 +#define HASH_LENGTH 48 /* Length of SHA 384 */ +#define PROT_HEADERS_FRAG "\x44\xA1\x01\x38\x22" // For ES384 +#endif /* T_COSE_MINI_VERIFY_SELECT_ES384 */ + +#ifdef T_COSE_MINI_VERIFY_SELECT_ES512 +#define HASH_ALG_TO_USE -44 /* IANA registration for SHA 512 */ +#define SIG_ALG_TO_USE T_COSE_ALGORITHM_ES512 +#define HASH_LENGTH 96 /* Length of SHA 512 */ +#define PROT_HEADERS_FRAG "\x44\xA1\x01\x38\x23" // For ES512 +#endif /* T_COSE_MINI_VERIFY_SELECT_ES512 */ + + +/* + * Hard coded CBOR fragments used both for comparison to expected + * input and for making the Sig_structure. + */ +#define NULL_BSTR_FRAG "\x40" +#define ARRAY_OF_FOUR_FRAG "\x84" +#define EMPTY_MAP_FRAG "\xa0" + +#define FIRST_PART ARRAY_OF_FOUR_FRAG PROT_HEADERS_FRAG EMPTY_MAP_FRAG + + + + +static inline enum t_cose_err_t +create_tbs_hash(const struct q_useful_buf_c encoded_payload, + struct q_useful_buf buffer_for_hash, + struct q_useful_buf_c *hash) +{ + enum t_cose_err_t return_value; + struct t_cose_crypto_hash hash_ctx; + + return_value = t_cose_crypto_hash_start(&hash_ctx, HASH_ALG_TO_USE); + if(return_value) { + goto Done; + } + + /* + * Format of to-be-signed bytes. This is defined in COSE (RFC + * 8152) section 4.4. It is the input to the hash. + * + * Sig_structure = [ + * context : "Signature" / "Signature1" / "CounterSignature", + * body_protected : empty_or_serialized_map, + * ? sign_protected : empty_or_serialized_map, + * external_aad : bstr, + * payload : bstr + * ] + * + * body_protected refers to the protected parameters from the main + * COSE_Sign1 structure. This is a little hard to to understand in the + * spec. + * + * sign_protected is not used with COSE_Sign1 since there is no + * signer chunk. + * + * external_aad allows external data to be covered by the + * signature, but may be a NULL_Q_USEFUL_BUF_C in which case a + * zero-length bstr will be correctly hashed into the result. + * + * Instead of formatting the TBS bytes in one buffer, they are + * formatted in chunks and fed into the hash. If actually + * formatted, the TBS bytes are slightly larger than the payload, + * so this saves a lot of memory. + */ + + /* Hand-constructed CBOR everything but the payload. */ + t_cose_crypto_hash_update(&hash_ctx, + Q_USEFUL_BUF_FROM_SZ_LITERAL( + ARRAY_OF_FOUR_FRAG + "\x6A" + COSE_SIG_CONTEXT_STRING_SIGNATURE1 + PROT_HEADERS_FRAG + NULL_BSTR_FRAG)); + + /* The payload is passed in encoded as a bstr so use it directly. */ + t_cose_crypto_hash_update(&hash_ctx, encoded_payload); + + + /* Finish the hash and set up to return it */ + return_value = t_cose_crypto_hash_finish(&hash_ctx, + buffer_for_hash, + hash); +Done: + return return_value; +} + + + + +/* Standard CBOR Major type for an array of arbitrary 8-bit bytes. + * (The only type decoded here in mini_verify). */ +#define CBOR_MAJOR_TYPE_BYTE_STRING 2 + + +/* + These are special values for the AdditionalInfo bits that are part of + the first byte. Mostly they encode the length of the data item. + */ +#define LEN_IS_ONE_BYTE 24 +#define LEN_IS_TWO_BYTES 25 +#define LEN_IS_FOUR_BYTES 26 +#define LEN_IS_EIGHT_BYTES 27 +#define ADDINFO_RESERVED1 28 +#define ADDINFO_RESERVED2 29 +#define ADDINFO_RESERVED3 30 +#define LEN_IS_INDEFINITE 31 + + +/* + * The expects a CBOR byte string at the start of + * input_cbor. Anything else will result in an error. + * + * The pointer and length of the decoded byte string + * is returned in decoded_byte_string. + * + * This is derived/copied from the core of QCBOR. It is specifically + * for decoding only byte strings. The byte string must be less than UINT32_MAX + * in length. This choice is made so the code is smaller on 32-bit machines + * with no need for 64-bit ints. + * + * This is called twice so don't inline. + * + * WARNING: the pointer manipulation here needs review, + * fuzzing and testing. + */ +static enum t_cose_err_t +decode_byte_string(struct q_useful_buf_c input_cbor, + struct q_useful_buf_c *decoded_byte_string, + struct q_useful_buf_c *encoded_byte_string ) +{ + uint32_t byte_string_length; + + const uint8_t *p = input_cbor.ptr; + const uint8_t * const p_end = (const uint8_t *)input_cbor.ptr + input_cbor.len; + + if(input_cbor.len < 1) { + return T_COSE_ERR_CBOR_NOT_WELL_FORMED; + } + const int nInitialByte = (int)*p; + const int nTmpMajorType = nInitialByte >> 5; + const int nAdditionalInfo = nInitialByte & 0x1f; + + if(nTmpMajorType != CBOR_MAJOR_TYPE_BYTE_STRING) { + return T_COSE_ERR_SIGN1_FORMAT; /* Not a byte string */ + } + + p++; + if(nAdditionalInfo >= LEN_IS_ONE_BYTE && nAdditionalInfo <= LEN_IS_FOUR_BYTES) { + /* Need to get 1,2 or 4 additional argument bytes. Map + * LEN_IS_ONE_BYTE..LEN_IS_FOUR_BYTES to actual length. + */ + static const uint8_t aIterate[] = {1,2,4}; + + /* Loop getting all the bytes in the argument */ + byte_string_length = 0; + for(int i = aIterate[nAdditionalInfo - LEN_IS_ONE_BYTE]; i; i--) { + /* This shift and add gives the endian conversion. */ + byte_string_length = (byte_string_length << 8) + *p; + p++; + if(p > p_end) { + return T_COSE_ERR_CBOR_NOT_WELL_FORMED; /* off end of input */ + } + } + } else if(nAdditionalInfo >= LEN_IS_EIGHT_BYTES && nAdditionalInfo <= LEN_IS_INDEFINITE) { + /* The reserved and thus-far unused additional info values, + * indefinite length strings and 8-byte length strings. + */ + return T_COSE_ERR_CBOR_FORMATTING; + } else { + /* Less than 24, additional info is argument or 31, an + * indefinite-length. No more bytes to get. + */ + byte_string_length = (uint32_t)nAdditionalInfo; + } + + if(p + byte_string_length > p_end) { + /* String contents is off the end. */ + return T_COSE_ERR_CBOR_NOT_WELL_FORMED; + } + + decoded_byte_string->ptr = p; + decoded_byte_string->len = byte_string_length; + + encoded_byte_string->ptr = input_cbor.ptr; + encoded_byte_string->len = (size_t)(p - (const uint8_t *)input_cbor.ptr) + byte_string_length; + + return T_COSE_SUCCESS; +} + + +/* + * Public function. See t_cose_sign_mini_verify.h. + */ +enum t_cose_err_t +t_cose_sign1_mini_verify(struct q_useful_buf_c cose_sign1, + struct t_cose_key verification_key, + struct q_useful_buf_c *payload) +{ + struct q_useful_buf_c signature; + struct q_useful_buf_c encoded_byte_string; + struct q_useful_buf_c in; + Q_USEFUL_BUF_MAKE_STACK_UB( hash_buf, HASH_LENGTH); + struct q_useful_buf_c tbs_hash; + enum t_cose_err_t return_value; + const struct q_useful_buf_c expected_first_part = Q_USEFUL_BUF_FROM_SZ_LITERAL(FIRST_PART); + + + /* --- The opening of the array and alg ID header param --- */ + /* The first part of the input is just checked by + * a memcmp(). No decoding is done. It is always the + * same -- an array of 4, the compiled-in protected + * header with the signing algorithm identifier and the + * empty unprotected header. + */ + if(cose_sign1.len < expected_first_part.len) { + /* Input is too short */ + return T_COSE_ERR_SIGN1_FORMAT; + } + + if(memcmp(expected_first_part.ptr, cose_sign1.ptr, expected_first_part.len)) { + /* Badly formatted CBOR input or not the algorithm + * this was compiled for. */ + return T_COSE_ERR_SIGN1_FORMAT; + } + + /* there would be less pointer math by using + * UsefulInBuf, but the objective here is minimal + * lines of code and dependency for both code size + * and ease of security analysis. + */ + in = cose_sign1; + in.ptr = (uint8_t *)in.ptr + expected_first_part.len; + in.len -= expected_first_part.len; + + + /* --- The payload ---- */ + return_value = decode_byte_string(in, payload, &encoded_byte_string); + if(return_value != T_COSE_SUCCESS) { + return return_value; + } + + in.ptr = (uint8_t *)in.ptr + encoded_byte_string.len; + in.len -= encoded_byte_string.len; + + /* A nice trick here is that we can use the CBOR- + * encoded payload from the input CBOR as direct input to + * the TBS calculation because they are both the same + * CBOR-encoded byte string. This only works because of + * the incremental hashing used inside create_tbs_hash(). + */ + return_value = create_tbs_hash(encoded_byte_string, + hash_buf, + &tbs_hash); + if(return_value != T_COSE_SUCCESS) { + return return_value; + } + + + /* --- The signature --- */ + return_value = decode_byte_string(in, &signature, &encoded_byte_string); + if(return_value != T_COSE_SUCCESS) { + return return_value; + } + + if((in.len - encoded_byte_string.len) != 0) { + /* All the bytes in the input were not used. */ + return T_COSE_ERR_SIGN1_FORMAT; + } + + return t_cose_crypto_verify(SIG_ALG_TO_USE, /* in: algorithm_id */ + verification_key, /* in: verification key */ + NULL_Q_USEFUL_BUF_C, /* in: key id */ + tbs_hash, /* in: hash to verify */ + signature); /* in: signature */ +} diff --git a/t_cose.xcodeproj/project.pbxproj b/t_cose.xcodeproj/project.pbxproj index c57154e9..d0c1f62f 100644 --- a/t_cose.xcodeproj/project.pbxproj +++ b/t_cose.xcodeproj/project.pbxproj @@ -47,6 +47,15 @@ E73CDABE23A7316700D262E0 /* run_tests.c in Sources */ = {isa = PBXBuildFile; fileRef = E72FB01C231ADAA8000970FE /* run_tests.c */; }; E73CDABF23A7316700D262E0 /* t_cose_sign1_sign.c in Sources */ = {isa = PBXBuildFile; fileRef = E7E36E8E226CB9460040613B /* t_cose_sign1_sign.c */; }; E73CDAD423AD4F3900D262E0 /* t_cose_psa_crypto.c in Sources */ = {isa = PBXBuildFile; fileRef = E73CDAD223AD4E6D00D262E0 /* t_cose_psa_crypto.c */; }; + E73FDFA828ACCDA7002CF0CC /* t_cose_sign_mini_verify.c in Sources */ = {isa = PBXBuildFile; fileRef = E73FDFA728ACCDA7002CF0CC /* t_cose_sign_mini_verify.c */; }; + E73FDFAC28B09345002CF0CC /* libqcbor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E73FDFAB28B09337002CF0CC /* libqcbor.a */; }; + E73FDFAD28B09347002CF0CC /* libqcbor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E73FDFAB28B09337002CF0CC /* libqcbor.a */; }; + E73FDFAE28B09348002CF0CC /* libqcbor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E73FDFAB28B09337002CF0CC /* libqcbor.a */; }; + E73FDFAF28B09348002CF0CC /* libqcbor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E73FDFAB28B09337002CF0CC /* libqcbor.a */; }; + E73FDFB028B09349002CF0CC /* libqcbor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E73FDFAB28B09337002CF0CC /* libqcbor.a */; }; + E73FDFB128B0934A002CF0CC /* libqcbor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E73FDFAB28B09337002CF0CC /* libqcbor.a */; }; + E73FDFB228B0939B002CF0CC /* libmbedcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E751F9F027E1F90F00EBA5FA /* libmbedcrypto.a */; }; + E73FDFB328B0970A002CF0CC /* t_cose_sign_mini_verify.c in Sources */ = {isa = PBXBuildFile; fileRef = E73FDFA728ACCDA7002CF0CC /* t_cose_sign_mini_verify.c */; }; E74FFBBA263BAB38003B66FF /* libcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E74FFBB8263BAB0D003B66FF /* libcrypto.a */; }; E772026F23CAEC84006E966E /* t_cose_sign1_verify.c in Sources */ = {isa = PBXBuildFile; fileRef = E7E36E8A226CB9460040613B /* t_cose_sign1_verify.c */; }; E772027123CAEC84006E966E /* t_cose_test.c in Sources */ = {isa = PBXBuildFile; fileRef = E7F70AC52270DFAE007CE07F /* t_cose_test.c */; }; @@ -60,12 +69,6 @@ E772027C23CAEC84006E966E /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = E7E36E7B226CB8400040613B /* main.c */; }; E772027D23CAEC84006E966E /* run_tests.c in Sources */ = {isa = PBXBuildFile; fileRef = E72FB01C231ADAA8000970FE /* run_tests.c */; }; E772027E23CAEC84006E966E /* t_cose_sign1_sign.c in Sources */ = {isa = PBXBuildFile; fileRef = E7E36E8E226CB9460040613B /* t_cose_sign1_sign.c */; }; - E7C960A627F7569E00FB537C /* libqcbor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E7C960A527F7569500FB537C /* libqcbor.a */; }; - E7C960A727F7569F00FB537C /* libqcbor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E7C960A527F7569500FB537C /* libqcbor.a */; }; - E7C960A827F756A000FB537C /* libqcbor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E7C960A527F7569500FB537C /* libqcbor.a */; }; - E7C960AA27F756A100FB537C /* libqcbor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E7C960A527F7569500FB537C /* libqcbor.a */; }; - E7C960AB27F756A200FB537C /* libqcbor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E7C960A527F7569500FB537C /* libqcbor.a */; }; - E7C960AC27F756A300FB537C /* libqcbor.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E7C960A527F7569500FB537C /* libqcbor.a */; }; E7C960B527FC97A800FB537C /* libmbedcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E751F9F027E1F90F00EBA5FA /* libmbedcrypto.a */; }; E7C960B627FC97AF00FB537C /* libmbedcrypto.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E751F9F027E1F90F00EBA5FA /* libmbedcrypto.a */; }; E7E36E7C226CB8400040613B /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = E7E36E7B226CB8400040613B /* main.c */; }; @@ -160,6 +163,9 @@ E73BF71C23B07ACF00DF5C36 /* t_cose_basic_example_openssl */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = t_cose_basic_example_openssl; sourceTree = BUILT_PRODUCTS_DIR; }; E73CDAC623A7316700D262E0 /* t_cose_psa */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = t_cose_psa; sourceTree = BUILT_PRODUCTS_DIR; }; E73CDAD223AD4E6D00D262E0 /* t_cose_psa_crypto.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = t_cose_psa_crypto.c; sourceTree = ""; }; + E73FDFA728ACCDA7002CF0CC /* t_cose_sign_mini_verify.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = t_cose_sign_mini_verify.c; sourceTree = ""; }; + E73FDFA928B089FB002CF0CC /* t_cose_sign_mini_verify.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = t_cose_sign_mini_verify.h; path = t_cose/t_cose_sign_mini_verify.h; sourceTree = ""; }; + E73FDFAB28B09337002CF0CC /* libqcbor.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libqcbor.a; path = ../../../../../usr/local/lib/libqcbor.a; sourceTree = ""; }; E7489C9F259F8B4B0004634C /* qcbor_encode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = qcbor_encode.h; path = ../../../../../usr/local/include/qcbor/qcbor_encode.h; sourceTree = ""; }; E7489CA0259F8B4B0004634C /* qcbor_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = qcbor_common.h; path = ../../../../../usr/local/include/qcbor/qcbor_common.h; sourceTree = ""; }; E7489CA1259F8B4B0004634C /* qcbor_spiffy_decode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = qcbor_spiffy_decode.h; path = ../../../../../usr/local/include/qcbor/qcbor_spiffy_decode.h; sourceTree = ""; }; @@ -187,7 +193,6 @@ E751F9EE27E1F85000EBA5FA /* crypto_values.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = crypto_values.h; path = ../../../../../usr/local/include/psa/crypto_values.h; sourceTree = ""; }; E751F9F027E1F90F00EBA5FA /* libmbedcrypto.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmbedcrypto.a; path = ../../../../../usr/local/lib/libmbedcrypto.a; sourceTree = ""; }; E772028523CAEC84006E966E /* t_cose_psa_noss */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = t_cose_psa_noss; sourceTree = BUILT_PRODUCTS_DIR; }; - E7C960A527F7569500FB537C /* libqcbor.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libqcbor.a; path = ../../../../../usr/local/lib/libqcbor.a; sourceTree = ""; }; E7E36E78226CB8400040613B /* t_cose_openssl */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = t_cose_openssl; sourceTree = BUILT_PRODUCTS_DIR; }; E7E36E7B226CB8400040613B /* main.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = ""; }; E7E36E89226CB9460040613B /* t_cose_util.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = t_cose_util.c; sourceTree = ""; }; @@ -206,7 +211,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - E7C960A627F7569E00FB537C /* libqcbor.a in Frameworks */, + E73FDFAF28B09348002CF0CC /* libqcbor.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -214,7 +219,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - E7C960AA27F756A100FB537C /* libqcbor.a in Frameworks */, + E73FDFB228B0939B002CF0CC /* libmbedcrypto.a in Frameworks */, + E73FDFAC28B09345002CF0CC /* libqcbor.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -222,7 +228,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - E7C960AB27F756A200FB537C /* libqcbor.a in Frameworks */, + E73FDFB028B09349002CF0CC /* libqcbor.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -231,7 +237,7 @@ buildActionMask = 2147483647; files = ( E7C960B527FC97A800FB537C /* libmbedcrypto.a in Frameworks */, - E7C960A827F756A000FB537C /* libqcbor.a in Frameworks */, + E73FDFAD28B09347002CF0CC /* libqcbor.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -240,7 +246,7 @@ buildActionMask = 2147483647; files = ( E7C960B627FC97AF00FB537C /* libmbedcrypto.a in Frameworks */, - E7C960AC27F756A300FB537C /* libqcbor.a in Frameworks */, + E73FDFB128B0934A002CF0CC /* libqcbor.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -249,7 +255,7 @@ buildActionMask = 2147483647; files = ( E74FFBBA263BAB38003B66FF /* libcrypto.a in Frameworks */, - E7C960A727F7569F00FB537C /* libqcbor.a in Frameworks */, + E73FDFAE28B09348002CF0CC /* libqcbor.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -336,6 +342,7 @@ E7E36E82226CB9460040613B /* inc */ = { isa = PBXGroup; children = ( + E73FDFA928B089FB002CF0CC /* t_cose_sign_mini_verify.h */, E72EC9EF242E74EE006D3DD3 /* q_useful_buf.h */, E72EC9ED242E74EE006D3DD3 /* t_cose_common.h */, E72EC9EC242E74EE006D3DD3 /* t_cose_sign1_sign.h */, @@ -355,6 +362,7 @@ E7E36E8C226CB9460040613B /* t_cose_util.h */, E7E36E8D226CB9460040613B /* t_cose_crypto.h */, E7E36E8E226CB9460040613B /* t_cose_sign1_sign.c */, + E73FDFA728ACCDA7002CF0CC /* t_cose_sign_mini_verify.c */, ); path = src; sourceTree = ""; @@ -382,7 +390,7 @@ E7F70AB22270D989007CE07F /* Frameworks */ = { isa = PBXGroup; children = ( - E7C960A527F7569500FB537C /* libqcbor.a */, + E73FDFAB28B09337002CF0CC /* libqcbor.a */, E751F9F027E1F90F00EBA5FA /* libmbedcrypto.a */, E74FFBB8263BAB0D003B66FF /* libcrypto.a */, ); @@ -555,6 +563,7 @@ buildActionMask = 2147483647; files = ( E730E60B23612DAB00175CE0 /* t_cose_sign1_verify.c in Sources */, + E73FDFA828ACCDA7002CF0CC /* t_cose_sign_mini_verify.c in Sources */, E730E60C23612DAB00175CE0 /* run_tests.c in Sources */, E730E62123612E3900175CE0 /* t_cose_test_crypto.c in Sources */, E730E61123612DAB00175CE0 /* t_cose_parameters.c in Sources */, @@ -578,6 +587,7 @@ E73BF6E023AFFB4100DF5C36 /* t_cose_basic_example_psa.c in Sources */, E73BF6E323AFFB4100DF5C36 /* sha256.c in Sources */, E73BF6E723AFFB4100DF5C36 /* t_cose_sign1_sign.c in Sources */, + E73FDFB328B0970A002CF0CC /* t_cose_sign_mini_verify.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -690,8 +700,11 @@ buildSettings = { CODE_SIGN_STYLE = Automatic; "GCC_PREPROCESSOR_DEFINITIONS[arch=*]" = T_COSE_USE_PSA_CRYPTO; - HEADER_SEARCH_PATHS = ""; - "LIBRARY_SEARCH_PATHS[arch=*]" = "../../mbed-crypto/library"; + HEADER_SEARCH_PATHS = ( + inc, + /usr/local/include, + ); + LIBRARY_SEARCH_PATHS = /usr/local/lib; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; @@ -700,8 +713,11 @@ isa = XCBuildConfiguration; buildSettings = { CODE_SIGN_STYLE = Automatic; - HEADER_SEARCH_PATHS = ""; - "LIBRARY_SEARCH_PATHS[arch=*]" = "../../mbed-crypto/library/"; + HEADER_SEARCH_PATHS = ( + inc, + /usr/local/include, + ); + LIBRARY_SEARCH_PATHS = /usr/local/lib; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release;