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

Definition of CBOR CODEC wrapper functions. More...

#include "CBOR.h"
#include "bsl/BPSecLib_Private.h"
#include "bsl/front/TextUtil.h"
#include <m-core.h>
+ Include dependency graph for CBOR.c:

Functions

int BSL_CBOR_Encode_GetSize (size_t *needlen, BSL_CBOR_Encode_f func, const void *obj)
 Perform one-pass encoded size inspection.
 
int BSL_CBOR_Encode_Twopass (BSL_Data_t *buf, BSL_CBOR_Encode_f func, const void *obj)
 Perform two-pass size-fitted encoding.
 
int BSL_CBOR_Decode (const BSL_Data_t *buf, BSL_CBOR_Decode_f func, const void *obj)
 Perform size- and error-checked encoding.
 
int BSL_CBOR_Compare_Int64 (const int64_t *ltv, const int64_t *rtv)
 Sort integer values in CBOR canonical order per Section 4.2.1 of RFC 8949 [3].
 
int BSL_CBOR_EncodeEID (QCBOREncodeContext *enc, const BSL_HostEID_t *eid)
 Helper to encode EID values in a way that is optimized for two-pass encoder.
 

Detailed Description

Definition of CBOR CODEC wrapper functions.

Function Documentation

◆ BSL_CBOR_Compare_Int64()

int BSL_CBOR_Compare_Int64 ( const int64_t *  ltv,
const int64_t *  rtv 
)

Sort integer values in CBOR canonical order per Section 4.2.1 of RFC 8949 [3].

Matches the libc sort and M*LIB CMP signature.

References ASSERT_ARG_NONNULL.

◆ BSL_CBOR_Decode()

◆ BSL_CBOR_Encode_GetSize()

int BSL_CBOR_Encode_GetSize ( size_t *  needlen,
BSL_CBOR_Encode_f  func,
const void *  obj 
)

Perform one-pass encoded size inspection.

Parameters
[out]needlenPointer to the size output.
funcThe encoding function which takes the user data.
objPointer to the user data to encode.
Returns
BSL_SUCCESS if successful.

References ASSERT_ARG_NONNULL, BSL_ERR_ENCODING, BSL_LOG_DEBUG, BSL_LOG_ERR, and BSL_SUCCESS.

Referenced by bsl_mock_encode_eid().

◆ BSL_CBOR_Encode_Twopass()

◆ BSL_CBOR_EncodeEID()

int BSL_CBOR_EncodeEID ( QCBOREncodeContext *  enc,
const BSL_HostEID_t eid 
)