BSL v1.0.0 - 16.g9d98179
AMMOS Bundle Protocol Security Library (BSL)
Loading...
Searching...
No Matches
encode.c File Reference

Definitions for bundle and block encoding. More...

#include <BPSecLib_Private.h>
#include "encode.h"
#include "agent.h"
#include "crc.h"
+ Include dependency graph for encode.c:

Functions

int bsl_mock_encode_eid (const BSL_HostEID_t *eid, BSL_Data_t *encoded_bytes)
 Encode a single EID.
 
int bsl_mock_encode_eid_from_ctx (QCBOREncodeContext *enc, const BSL_HostEID_t *eid)
 Encode a single EID from a QCBOR Encode Context.
 
int bsl_mock_encode_primary (QCBOREncodeContext *enc, const MockBPA_PrimaryBlock_t *blk)
 Encode primary block to a CBOR data.
 
int bsl_mock_encode_canonical (QCBOREncodeContext *enc, const MockBPA_CanonicalBlock_t *blk)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
int bsl_mock_encode_bundle (QCBOREncodeContext *enc, const MockBPA_Bundle_t *bundle)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 

Variables

static const uint8_t zero_crc [] = { 0, 0, 0, 0 }
 

Detailed Description

Definitions for bundle and block encoding.

Function Documentation

◆ bsl_mock_encode_bundle()

int bsl_mock_encode_bundle ( QCBOREncodeContext *  enc,
const MockBPA_Bundle_t bundle 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References MockBPA_Bundle_t::blocks, bsl_mock_encode_canonical(), bsl_mock_encode_primary(), and MockBPA_Bundle_t::primary_block.

Referenced by LLVMFuzzerTestOneInput(), M_ALGO_DEF(), test_bsl_loopback_bundle(), and test_bsl_mock_encode_bundle().

◆ bsl_mock_encode_canonical()

int bsl_mock_encode_canonical ( QCBOREncodeContext *  enc,
const MockBPA_CanonicalBlock_t blk 
)

◆ bsl_mock_encode_eid()

int bsl_mock_encode_eid ( const BSL_HostEID_t eid,
BSL_Data_t encoded_bytes 
)

Encode a single EID.

Matches the signature for the BSL_HostDescriptors_t::eid_to_cbor function.

Parameters
[in]eidThe EID value.
[in,out]encoded_bytesResulting encoded bytes. NULL if checking for required CBOR length.

References bsl_mock_eid_t::as_ipn, bsl_mock_eid_t::as_raw, bsl_eid_ipn_ssp_t::auth_num, BSL_CHKERR1, BSL_ERR_ENCODING, BSL_LOG_DEBUG, BSL_LOG_ERR, BSL_MOCK_EID_IPN, BSL_HostEID_t::handle, BSL_Data_t::len, bsl_eid_ipn_ssp_t::ncomp, bsl_eid_ipn_ssp_t::node_num, BSL_Data_t::ptr, bsl_mock_eid_t::scheme, bsl_mock_eid_t::ssp, and bsl_eid_ipn_ssp_t::svc_num.

Referenced by MockBPA_Agent_Descriptors().

◆ bsl_mock_encode_eid_from_ctx()

int bsl_mock_encode_eid_from_ctx ( QCBOREncodeContext *  enc,
const BSL_HostEID_t eid 
)

Encode a single EID from a QCBOR Encode Context.

Parameters
[in,out]encQCBOR Encode Context.
[in]eidThe EID Value.

References BSL_Data_Deinit(), BSL_Data_InitBuffer(), BSL_ERR_ENCODING, BSL_HostEID_EncodeToCBOR(), BSL_LOG_ERR, BSL_SUCCESS, BSL_Data_t::len, and BSL_Data_t::ptr.

Referenced by bsl_mock_encode_primary(), and test_bsl_loopback_eid().

◆ bsl_mock_encode_primary()

Variable Documentation

◆ zero_crc

const uint8_t zero_crc[] = { 0, 0, 0, 0 }
static