BSL v1.1.1 - 39.g9f43410
AMMOS Bundle Protocol Security Library (BSL)
Loading...
Searching...
No Matches
AbsSecBlock.h File Reference

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_tBSL_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.
 

Detailed Description

Concrete implementation of ASB and its functionality.

Forthcoming

See https://www.rfc-editor.org/rfc/rfc9172.html#name-abstract-security-block

Macro Definition Documentation

◆ M_OPL_BSL_AbsSecBlock_Target_t

#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.

Enumeration Type Documentation

◆ BSL_AbsSecBlock_Flags_e

Enumerator
BSL_ABSSECBLOCK_FLAG_HAS_PARAM 

Function Documentation

◆ BSL_AbsSecBlock_AddTarget()

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.

Parameters
[in,out]selfThis ASB.
[in]target_block_numID of a block, 0 indicates primary block as usual.
Returns
The new target and its results.

References ASSERT_PRECONDITION, BSL_AbsSecBlock_IsConsistent(), and BSL_AbsSecBlock_Target_t::target_block_num.

Referenced by BSL_AbsSecBlock_Decode(), and BSL_ExecAnySource_Post().

◆ BSL_AbsSecBlock_Decode()

int BSL_AbsSecBlock_Decode ( QCBORDecodeContext *  dec,
BSL_AbsSecBlock_t *  self 
)

◆ BSL_AbsSecBlock_Encode()

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.

Parameters
encThe encoder to write to.
[in,out]selfThe 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().

◆ BSL_AbsSecBlock_StripResults()

int BSL_AbsSecBlock_StripResults ( BSL_AbsSecBlock_t *  self,
uint64_t  target_block_num 
)

Remove the target and its security results from this ASB.

Parameters
[in,out]selfThis ASB
[in]target_block_numBlock number of the target to remove
Returns
Negative on error, otherwise count of things removed.

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().

◆ BSL_AbsSecBlock_Target_Deinit()

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.

◆ BSL_AbsSecBlock_Target_Init()

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.