|
BSL v1.1.1 - 39.g9f43410
AMMOS Bundle Protocol Security Library (BSL)
|
Concrete implementation of ASB and its functionality. More...
#include "IdValPair.h"#include "bsl/BPSecLib_Public.h"#include <m-array.h>#include <m-shared-ptr.h>#include <qcbor/qcbor_decode.h>#include <qcbor/qcbor_encode.h>#include <stddef.h>#include <stdint.h>
Include dependency graph for AbsSecBlock.h:
This graph shows which files directly or indirectly include this file:Data Structures | |
| struct | BSL_AbsSecBlock_Target_t |
| struct | BSL_AbsSecBlock_t |
| Represents the Abstract Security Block as defined in RFC9172. More... | |
Macros | |
| #define | M_OPL_BSL_AbsSecBlock_Target_t() (INIT(API_2(BSL_AbsSecBlock_Target_Init)), INIT_SET(0), SET(0), CLEAR(API_2(BSL_AbsSecBlock_Target_Deinit))) |
| M*LIB OPLIST for BSL_AbsSecBlock_Target_t. | |
Enumerations | |
| enum | BSL_AbsSecBlock_Flags_e { BSL_ABSSECBLOCK_FLAG_HAS_PARAM = 0x1 } |
Functions | |
| void | BSL_AbsSecBlock_Target_Init (BSL_AbsSecBlock_Target_t *self) |
| Initialize a new target structure. | |
| void | BSL_AbsSecBlock_Target_Deinit (BSL_AbsSecBlock_Target_t *self) |
| Deinitialize a target structure. | |
| BSL_AbsSecBlock_Target_t * | BSL_AbsSecBlock_AddTarget (BSL_AbsSecBlock_t *self, uint64_t target_block_num) |
| Adds a given block ID as a security target covered by this ASB. | |
| int | BSL_AbsSecBlock_StripResults (BSL_AbsSecBlock_t *self, uint64_t target_block_num) |
| Remove the target and its security results from this ASB. | |
| int | BSL_AbsSecBlock_Encode (QCBOREncodeContext *enc, const BSL_AbsSecBlock_t *obj) |
| Encodes this ASB into a CBOR string into the space pre-allocated indicated by the argument. | |
| int | BSL_AbsSecBlock_Decode (QCBORDecodeContext *dec, BSL_AbsSecBlock_t *self) |
| Decodes and populates this ASB from a CBOR string. | |
Concrete implementation of ASB and its functionality.
Forthcoming
See https://www.rfc-editor.org/rfc/rfc9172.html#name-abstract-security-block
| #define M_OPL_BSL_AbsSecBlock_Target_t | ( | ) | (INIT(API_2(BSL_AbsSecBlock_Target_Init)), INIT_SET(0), SET(0), CLEAR(API_2(BSL_AbsSecBlock_Target_Deinit))) |
M*LIB OPLIST for BSL_AbsSecBlock_Target_t.
| BSL_AbsSecBlock_Target_t * BSL_AbsSecBlock_AddTarget | ( | BSL_AbsSecBlock_t * | self, |
| uint64_t | target_block_num | ||
| ) |
Adds a given block ID as a security target covered by this ASB.
| [in,out] | self | This ASB. |
| [in] | target_block_num | ID of a block, 0 indicates primary block as usual. |
References ASSERT_PRECONDITION, BSL_AbsSecBlock_IsConsistent(), and BSL_AbsSecBlock_Target_t::target_block_num.
Referenced by BSL_AbsSecBlock_Decode(), and BSL_ExecAnySource_Post().
| int BSL_AbsSecBlock_Decode | ( | QCBORDecodeContext * | dec, |
| BSL_AbsSecBlock_t * | self | ||
| ) |
Decodes and populates this ASB from a CBOR string.
Matches the BSL_CBOR_Decode_f signature.
| [in,out] | self | This allocated, but uninitialized ASB to populate. |
| [in] | buf | A buffer containing a CBOR string representing the ASB |
References ASSERT_ARG_NONNULL, ASSERT_POSTCONDITION, BSL_AbsSecBlock_AddTarget(), BSL_ABSSECBLOCK_FLAG_HAS_PARAM, BSL_AbsSecBlock_IsConsistent(), BSL_Data_Deinit(), BSL_Data_InitView(), BSL_ERR_DECODING, BSL_HostEID_DecodeFromCBOR(), BSL_IdValPair_Decode(), BSL_LOG_DEBUG, BSL_LOG_ERR, BSL_SUCCESS, BSL_Data_t::len, BSL_AbsSecBlock_Target_t::results, and BSL_AbsSecBlock_Target_t::target_block_num.
Referenced by BSL_API_QuerySecurity(), BSL_ExecAnyVerifierAcceptor_Pre(), LLVMFuzzerTestOneInput(), TEST_CASE(), and TestASBDecodeEncodeClosure().
| int BSL_AbsSecBlock_Encode | ( | QCBOREncodeContext * | enc, |
| const BSL_AbsSecBlock_t * | obj | ||
| ) |
Encodes this ASB into a CBOR string into the space pre-allocated indicated by the argument.
Matches the BSL_CBOR_Encode_f signature.
| enc | The encoder to write to. | |
| [in,out] | self | The initialized ASB to populate. |
References BSL_ABSSECBLOCK_FLAG_HAS_PARAM, BSL_AbsSecBlock_IsConsistent(), BSL_CBOR_EncodeEID(), BSL_IdValPair_Encode(), BSL_SUCCESS, CHK_PRECONDITION, BSL_AbsSecBlock_Target_t::results, and BSL_AbsSecBlock_Target_t::target_block_num.
Referenced by Encode_ASB(), LLVMFuzzerTestOneInput(), and TestASBDecodeEncodeClosure().
| int BSL_AbsSecBlock_StripResults | ( | BSL_AbsSecBlock_t * | self, |
| uint64_t | target_block_num | ||
| ) |
Remove the target and its security results from this ASB.
| [in,out] | self | This ASB |
| [in] | target_block_num | Block number of the target to remove |
References BSL_AbsSecBlock_IsConsistent(), CHK_POSTCONDITION, CHK_PRECONDITION, BSL_AbsSecBlock_Target_t::results, and BSL_AbsSecBlock_Target_t::target_block_num.
Referenced by BSL_ExecBCBVerifierAcceptor(), and BSL_ExecBIBVerifierAcceptor().
| void BSL_AbsSecBlock_Target_Deinit | ( | BSL_AbsSecBlock_Target_t * | self | ) |
Deinitialize a target structure.
References BSL_AbsSecBlock_Target_t::results, and BSL_AbsSecBlock_Target_t::target_block_num.
| void BSL_AbsSecBlock_Target_Init | ( | BSL_AbsSecBlock_Target_t * | self | ) |
Initialize a new target structure.
References BSL_AbsSecBlock_Target_t::results, and BSL_AbsSecBlock_Target_t::target_block_num.