|
BSL v1.1.1 - 39.g9f43410
AMMOS Bundle Protocol Security Library (BSL)
|
Implementation of COSE structures [15]. More...
Include dependency graph for CoseMsg.c:Implementation of COSE structures [15].
| int BSLX_CoseMsg_Encrypt0_Decode | ( | QCBORDecodeContext * | dec, |
| BSLX_CoseMsg_Encrypt0_t * | obj | ||
| ) |
Match BSL_CBOR_Decode_f signature.
References ASSERT_ARG_NONNULL, BSL_ERR_DECODING, BSL_LOG_ERR, BSL_SUCCESS, BSLX_CoseMsg_Headers_Decode(), and BSLX_CoseMsg_Encrypt0_t::headers.
Referenced by BSLX_CoseSc_Encrypt0_VerifyAccept(), LLVMFuzzerTestOneInput(), and test_AppendixA_Example4_BCB_Source().
| void BSLX_CoseMsg_Encrypt0_Deinit | ( | BSLX_CoseMsg_Encrypt0_t * | obj | ) |
Deinitialize the struct.
References ASSERT_ARG_NONNULL, BSLX_CoseMsg_Headers_Deinit(), and BSLX_CoseMsg_Encrypt0_t::headers.
Referenced by BSLX_CoseSc_Encrypt0_Source(), BSLX_CoseSc_Encrypt0_VerifyAccept(), LLVMFuzzerTestOneInput(), and test_AppendixA_Example4_BCB_Source().
| int BSLX_CoseMsg_Encrypt0_Encode | ( | QCBOREncodeContext * | enc, |
| const BSLX_CoseMsg_Encrypt0_t * | obj | ||
| ) |
Match BSL_CBOR_Encode_f signature.
References ASSERT_ARG_NONNULL, BSL_SUCCESS, BSLX_CoseMsg_Headers_Encode(), and BSLX_CoseMsg_Encrypt0_t::headers.
Referenced by BSLX_CoseSc_Encrypt0_Source(), and LLVMFuzzerTestOneInput().
| void BSLX_CoseMsg_Encrypt0_Init | ( | BSLX_CoseMsg_Encrypt0_t * | obj | ) |
Initialize the struct.
References ASSERT_ARG_NONNULL, BSLX_CoseMsg_Headers_Init(), and BSLX_CoseMsg_Encrypt0_t::headers.
Referenced by BSLX_CoseSc_Encrypt0_Source(), BSLX_CoseSc_Encrypt0_VerifyAccept(), LLVMFuzzerTestOneInput(), and test_AppendixA_Example4_BCB_Source().
| int BSLX_CoseMsg_Encrypt_Decode | ( | QCBORDecodeContext * | dec, |
| BSLX_CoseMsg_Encrypt_t * | obj | ||
| ) |
Match BSL_CBOR_Decode_f signature.
References ASSERT_ARG_NONNULL, BSL_ERR_DECODING, BSL_LOG_ERR, BSL_SUCCESS, BSLX_CoseMsg_Headers_Decode(), BSLX_CoseMsg_RecipientList_Decode(), BSLX_CoseMsg_Encrypt_t::headers, and BSLX_CoseMsg_Encrypt_t::recipients.
Referenced by BSLX_CoseSc_Encrypt_VerifyAccept(), LLVMFuzzerTestOneInput(), test_AppendixA_Example5_BCB_Source(), and test_AppendixA_Example6_BCB_Source().
| void BSLX_CoseMsg_Encrypt_Deinit | ( | BSLX_CoseMsg_Encrypt_t * | obj | ) |
Deinitialize the struct.
References ASSERT_ARG_NONNULL, BSLX_CoseMsg_Headers_Deinit(), BSLX_CoseMsg_Encrypt_t::headers, and BSLX_CoseMsg_Encrypt_t::recipients.
Referenced by BSLX_CoseSc_Encrypt_Source(), BSLX_CoseSc_Encrypt_VerifyAccept(), LLVMFuzzerTestOneInput(), test_AppendixA_Example5_BCB_Source(), and test_AppendixA_Example6_BCB_Source().
| int BSLX_CoseMsg_Encrypt_Encode | ( | QCBOREncodeContext * | enc, |
| const BSLX_CoseMsg_Encrypt_t * | obj | ||
| ) |
Match BSL_CBOR_Encode_f signature.
References ASSERT_ARG_NONNULL, BSL_SUCCESS, BSLX_CoseMsg_Headers_Encode(), BSLX_CoseMsg_RecipientList_Encode(), BSLX_CoseMsg_Encrypt_t::headers, and BSLX_CoseMsg_Encrypt_t::recipients.
Referenced by BSLX_CoseSc_Encrypt_Source(), and LLVMFuzzerTestOneInput().
| void BSLX_CoseMsg_Encrypt_Init | ( | BSLX_CoseMsg_Encrypt_t * | obj | ) |
Initialize the struct.
References ASSERT_ARG_NONNULL, BSLX_CoseMsg_Headers_Init(), BSLX_CoseMsg_Encrypt_t::headers, and BSLX_CoseMsg_Encrypt_t::recipients.
Referenced by BSLX_CoseSc_Encrypt_Source(), BSLX_CoseSc_Encrypt_VerifyAccept(), LLVMFuzzerTestOneInput(), test_AppendixA_Example5_BCB_Source(), and test_AppendixA_Example6_BCB_Source().
| void BSLX_CoseMsg_HdrMapTree_update | ( | BSLX_CoseMsg_HdrMapTree_t | base, |
| const BSLX_CoseMsg_HdrMapTree_t | addl | ||
| ) |
Update a base map with an additional map, adding items when the key is not already present.
Referenced by BSLX_CoseSc_VerifyHeaders().
| int BSLX_CoseMsg_Headers_CheckCrit | ( | const BSLX_CoseMsg_Headers_t * | obj | ) |
Check for the presence of crit header referencing unsupported parameters.
| [in] | obj | The headers to search. |
References BSL_CBOR_Decode(), BSL_ERR_DECODING, BSL_IdValPair_GetAsRaw(), BSL_LOG_ERR, BSL_SUCCESS, BSLX_COSEMSG_HDR_CRIT, BSLX_CoseMsg_Headers_CheckCrit_Decode(), and BSLX_CoseMsg_Headers_Get().
Referenced by BSLX_CoseSc_VerifyHeaders().
|
static |
Decode a crit array and fail directly.
Matches BSL_CBOR_Decode_f signature.
References BSL_ERR_DECODING, BSL_LOG_ERR, BSL_SUCCESS, BSLX_COSEMSG_HDR_ALG, BSLX_COSEMSG_HDR_CONTENTTYPE, BSLX_COSEMSG_HDR_CRIT, BSLX_COSEMSG_HDR_IV, BSLX_COSEMSG_HDR_KID, BSLX_COSEMSG_HDR_KIDCONTEXT, BSLX_COSEMSG_HDR_PARTIALIV, and BSLX_COSEMSG_HDR_SALT.
Referenced by BSLX_CoseMsg_Headers_CheckCrit().
| int BSLX_CoseMsg_Headers_Decode | ( | QCBORDecodeContext * | dec, |
| BSLX_CoseMsg_Headers_t * | obj | ||
| ) |
Match BSL_CBOR_Decode_f signature.
References BSL_Data_CopyFrom(), BSL_ERR_DECODING, BSL_LOG_DEBUG, BSL_LOG_ERR, BSL_SUCCESS, BSLX_CoseMsg_Headers_Decode_Map(), BSL_Data_t::len, BSLX_CoseMsg_Headers_t::phdr, BSLX_CoseMsg_Headers_t::phdr_bstr, and BSLX_CoseMsg_Headers_t::uhdr.
Referenced by BSLX_CoseMsg_Encrypt0_Decode(), BSLX_CoseMsg_Encrypt_Decode(), BSLX_CoseMsg_Mac0_Decode(), BSLX_CoseMsg_Mac_Decode(), and BSLX_CoseMsg_Recipient_Decode().
| int BSLX_CoseMsg_Headers_Decode_Map | ( | QCBORDecodeContext * | dec, |
| BSLX_CoseMsg_HdrMapTree_t * | map | ||
| ) |
Decode a header parameter map.
Matches BSL_CBOR_Encode_f signature.
References BSL_ERR_DECODING, BSL_IdValPair_Decode(), and BSL_SUCCESS.
Referenced by BSLX_CoseMsg_Headers_Decode(), and BSLX_CoseSc_GetAndValidateAddlHeaders().
| void BSLX_CoseMsg_Headers_Deinit | ( | BSLX_CoseMsg_Headers_t * | obj | ) |
Deinitialize the struct.
References ASSERT_ARG_NONNULL, BSL_Data_Deinit(), BSLX_CoseMsg_Headers_t::phdr, BSLX_CoseMsg_Headers_t::phdr_bstr, and BSLX_CoseMsg_Headers_t::uhdr.
Referenced by BSLX_CoseMsg_Encrypt0_Deinit(), BSLX_CoseMsg_Encrypt_Deinit(), BSLX_CoseMsg_Mac0_Deinit(), BSLX_CoseMsg_Mac_Deinit(), and BSLX_CoseMsg_Recipient_Deinit().
| int BSLX_CoseMsg_Headers_DerivePhdr | ( | BSLX_CoseMsg_Headers_t * | obj | ) |
Derive BSLX_CoseMsg_Headers_t::phdr_bstr from protected headers in BSLX_CoseMsg_Headers_t::phdr.
This is needed before cryptographic calculation and encoding.
| [in,out] | obj | The headers to encode and store into. |
References BSL_CBOR_Encode_Twopass(), BSL_Data_Resize(), BSL_SUCCESS, BSLX_CoseMsg_Headers_Encode_Map(), BSLX_CoseMsg_Headers_t::phdr, and BSLX_CoseMsg_Headers_t::phdr_bstr.
Referenced by BSLX_CoseSc_SourceHeaders().
| int BSLX_CoseMsg_Headers_Encode | ( | QCBOREncodeContext * | enc, |
| const BSLX_CoseMsg_Headers_t * | obj | ||
| ) |
Match BSL_CBOR_Encode_f signature.
References BSL_SUCCESS, BSLX_CoseMsg_Headers_Encode_Map(), BSLX_CoseMsg_Headers_t::phdr_bstr, BSLX_CoseMsg_Headers_t::uhdr, and UsefulBufC_FROM_BSL_Data.
Referenced by BSLX_CoseMsg_Encrypt0_Encode(), BSLX_CoseMsg_Encrypt_Encode(), BSLX_CoseMsg_Mac0_Encode(), BSLX_CoseMsg_Mac_Encode(), and BSLX_CoseMsg_Recipient_Encode().
| int BSLX_CoseMsg_Headers_Encode_Map | ( | QCBOREncodeContext * | enc, |
| const BSLX_CoseMsg_HdrMapTree_t * | map | ||
| ) |
Encode a header parameter map.
Matches BSL_CBOR_Encode_f signature.
References BSL_IdValPair_Encode(), and BSL_SUCCESS.
Referenced by BSLX_CoseMsg_Headers_DerivePhdr(), and BSLX_CoseMsg_Headers_Encode().
| const BSL_IdValPair_t * BSLX_CoseMsg_Headers_Get | ( | const BSLX_CoseMsg_Headers_t * | obj, |
| int64_t | label, | ||
| bool | need_phdr | ||
| ) |
Get a desired header parameter.
| [in] | obj | The headers to search. |
| label | The label to search for. | |
| need_phdr | If true the parameter needs to be in the protected map when it is present. This does not imply that it needs to be present. |
References BSL_LOG_ERR, BSLX_CoseMsg_Headers_t::phdr, and BSLX_CoseMsg_Headers_t::uhdr.
Referenced by BSLX_CoseMsg_Headers_CheckCrit(), BSLX_CoseSc_ExtractIV(), BSLX_CoseSc_GetAndValidateKey(), BSLX_CoseSc_GetAndValidateTarget(), and BSLX_CoseSc_HkdfContentKey().
| void BSLX_CoseMsg_Headers_Init | ( | BSLX_CoseMsg_Headers_t * | obj | ) |
Initialize the struct.
References ASSERT_ARG_NONNULL, BSL_Data_Init(), BSLX_CoseMsg_Headers_t::phdr, BSLX_CoseMsg_Headers_t::phdr_bstr, and BSLX_CoseMsg_Headers_t::uhdr.
Referenced by BSLX_CoseMsg_Encrypt0_Init(), BSLX_CoseMsg_Encrypt_Init(), BSLX_CoseMsg_Mac0_Init(), BSLX_CoseMsg_Mac_Init(), and BSLX_CoseMsg_Recipient_Init().
| int BSLX_CoseMsg_Mac0_Decode | ( | QCBORDecodeContext * | dec, |
| BSLX_CoseMsg_Mac0_t * | obj | ||
| ) |
Match BSL_CBOR_Decode_f signature.
References BSL_Data_CopyFrom(), BSL_ERR_DECODING, BSL_LOG_ERR, BSL_SUCCESS, BSLX_CoseMsg_Headers_Decode(), BSLX_CoseMsg_Mac0_t::headers, BSL_Data_t::len, and BSLX_CoseMsg_Mac0_t::tag.
Referenced by BSLX_CoseSc_Mac0_VerifyAccept(), LLVMFuzzerTestOneInput(), and test_AppendixA_Example1_BIB_Source().
| void BSLX_CoseMsg_Mac0_Deinit | ( | BSLX_CoseMsg_Mac0_t * | obj | ) |
Deinitialize the struct.
References ASSERT_ARG_NONNULL, BSL_Data_Deinit(), BSLX_CoseMsg_Headers_Deinit(), BSLX_CoseMsg_Mac0_t::headers, and BSLX_CoseMsg_Mac0_t::tag.
Referenced by BSLX_CoseSc_Mac0_Source(), BSLX_CoseSc_Mac0_VerifyAccept(), LLVMFuzzerTestOneInput(), and test_AppendixA_Example1_BIB_Source().
| int BSLX_CoseMsg_Mac0_Encode | ( | QCBOREncodeContext * | enc, |
| const BSLX_CoseMsg_Mac0_t * | obj | ||
| ) |
Match BSL_CBOR_Encode_f signature.
References BSL_SUCCESS, BSLX_CoseMsg_Headers_Encode(), BSLX_CoseMsg_Mac0_t::headers, BSLX_CoseMsg_Mac0_t::tag, and UsefulBufC_FROM_BSL_Data.
Referenced by BSLX_CoseSc_Mac0_Source(), and LLVMFuzzerTestOneInput().
| void BSLX_CoseMsg_Mac0_Init | ( | BSLX_CoseMsg_Mac0_t * | obj | ) |
Initialize the struct.
References ASSERT_ARG_NONNULL, BSL_Data_Init(), BSLX_CoseMsg_Headers_Init(), BSLX_CoseMsg_Mac0_t::headers, and BSLX_CoseMsg_Mac0_t::tag.
Referenced by BSLX_CoseSc_Mac0_Source(), BSLX_CoseSc_Mac0_VerifyAccept(), LLVMFuzzerTestOneInput(), and test_AppendixA_Example1_BIB_Source().
| int BSLX_CoseMsg_Mac_Decode | ( | QCBORDecodeContext * | dec, |
| BSLX_CoseMsg_Mac_t * | obj | ||
| ) |
Match BSL_CBOR_Decode_f signature.
References ASSERT_ARG_NONNULL, BSL_Data_CopyFrom(), BSL_ERR_DECODING, BSL_LOG_ERR, BSL_SUCCESS, BSLX_CoseMsg_Headers_Decode(), BSLX_CoseMsg_RecipientList_Decode(), BSLX_CoseMsg_Mac_t::headers, BSL_Data_t::len, BSLX_CoseMsg_Mac_t::recipients, and BSLX_CoseMsg_Mac_t::tag.
Referenced by BSLX_CoseSc_Mac_VerifyAccept(), LLVMFuzzerTestOneInput(), and test_CCSDS_Example_Mac_Source().
| void BSLX_CoseMsg_Mac_Deinit | ( | BSLX_CoseMsg_Mac_t * | obj | ) |
Deinitialize the struct.
References ASSERT_ARG_NONNULL, BSL_Data_Deinit(), BSLX_CoseMsg_Headers_Deinit(), BSLX_CoseMsg_Mac_t::headers, BSLX_CoseMsg_Mac_t::recipients, and BSLX_CoseMsg_Mac_t::tag.
Referenced by BSLX_CoseSc_Mac_Source(), BSLX_CoseSc_Mac_VerifyAccept(), LLVMFuzzerTestOneInput(), and test_CCSDS_Example_Mac_Source().
| int BSLX_CoseMsg_Mac_Encode | ( | QCBOREncodeContext * | enc, |
| const BSLX_CoseMsg_Mac_t * | obj | ||
| ) |
Match BSL_CBOR_Encode_f signature.
References ASSERT_ARG_NONNULL, BSL_SUCCESS, BSLX_CoseMsg_Headers_Encode(), BSLX_CoseMsg_RecipientList_Encode(), BSLX_CoseMsg_Mac_t::headers, BSLX_CoseMsg_Mac_t::recipients, BSLX_CoseMsg_Mac_t::tag, and UsefulBufC_FROM_BSL_Data.
Referenced by BSLX_CoseSc_Mac_Source(), and LLVMFuzzerTestOneInput().
| void BSLX_CoseMsg_Mac_Init | ( | BSLX_CoseMsg_Mac_t * | obj | ) |
Initialize the struct.
References ASSERT_ARG_NONNULL, BSL_Data_Init(), BSLX_CoseMsg_Headers_Init(), BSLX_CoseMsg_Mac_t::headers, BSLX_CoseMsg_Mac_t::recipients, and BSLX_CoseMsg_Mac_t::tag.
Referenced by BSLX_CoseSc_Mac_Source(), BSLX_CoseSc_Mac_VerifyAccept(), LLVMFuzzerTestOneInput(), and test_CCSDS_Example_Mac_Source().
| int BSLX_CoseMsg_Recipient_Decode | ( | QCBORDecodeContext * | dec, |
| BSLX_CoseMsg_Recipient_t * | obj | ||
| ) |
Match BSL_CBOR_Decode_f signature.
References ASSERT_ARG_NONNULL, BSL_Data_CopyFrom(), BSL_ERR_DECODING, BSL_LOG_ERR, BSL_SUCCESS, BSLX_CoseMsg_Headers_Decode(), BSLX_CoseMsg_Recipient_t::ciphertext, BSLX_CoseMsg_Recipient_t::headers, and BSL_Data_t::len.
Referenced by BSLX_CoseMsg_RecipientList_Decode().
| void BSLX_CoseMsg_Recipient_Deinit | ( | BSLX_CoseMsg_Recipient_t * | obj | ) |
Deinitialize the struct.
References ASSERT_ARG_NONNULL, BSL_Data_Deinit(), BSLX_CoseMsg_Headers_Deinit(), BSLX_CoseMsg_Recipient_t::ciphertext, and BSLX_CoseMsg_Recipient_t::headers.
| int BSLX_CoseMsg_Recipient_Encode | ( | QCBOREncodeContext * | enc, |
| const BSLX_CoseMsg_Recipient_t * | obj | ||
| ) |
Match BSL_CBOR_Encode_f signature.
References ASSERT_ARG_NONNULL, BSL_SUCCESS, BSLX_CoseMsg_Headers_Encode(), BSLX_CoseMsg_Recipient_t::ciphertext, BSLX_CoseMsg_Recipient_t::headers, and UsefulBufC_FROM_BSL_Data.
Referenced by BSLX_CoseMsg_RecipientList_Encode().
| void BSLX_CoseMsg_Recipient_Init | ( | BSLX_CoseMsg_Recipient_t * | obj | ) |
Initialize the struct.
References ASSERT_ARG_NONNULL, BSL_Data_Init(), BSLX_CoseMsg_Headers_Init(), BSLX_CoseMsg_Recipient_t::ciphertext, and BSLX_CoseMsg_Recipient_t::headers.
|
static |
References BSL_ERR_DECODING, BSL_LOG_CRIT, BSL_SUCCESS, BSLX_CoseMsg_Recipient_Decode(), BSLX_CoseMsg_RecipientList_ResizeNew(), and BSLX_COSEMSG_RECIPIENTS_LIMIT.
Referenced by BSLX_CoseMsg_Encrypt_Decode(), and BSLX_CoseMsg_Mac_Decode().
|
static |
References BSLX_CoseMsg_Recipient_Encode().
Referenced by BSLX_CoseMsg_Encrypt_Encode(), and BSLX_CoseMsg_Mac_Encode().
| void BSLX_CoseMsg_RecipientList_ResizeNew | ( | BSLX_CoseMsg_RecipientList_t | obj, |
| size_t | size | ||
| ) |
Resize recipients array, preserving existing if possible.
References ASSERT_ARG_NONNULL.
Referenced by BSLX_CoseMsg_RecipientList_Decode(), BSLX_CoseSc_Encrypt_Source(), and BSLX_CoseSc_Mac_Source().