|
BSL v1.0.0 - 16.g9d98179
AMMOS Bundle Protocol Security Library (BSL)
|
#include <inttypes.h>#include <unity.h>#include <BPSecLib_Private.h>#include <mock_bpa/log.h>#include <mock_bpa/agent.h>#include <mock_bpa/decode.h>#include <mock_bpa/encode.h>#include "bsl_test_utils.h"
Include dependency graph for test_MockBPA_Codecs.c:Functions | |
| static void | printencoded (const uint8_t *pEncoded, size_t nLen) |
| void | suiteSetUp (void) |
| int | suiteTearDown (int failures) |
| void | setUp (void) |
| void | tearDown (void) |
| void | test_BSL_TestUtils_DecodeBase16_valid (const char *text, const char *expect, size_t expect_len) |
| void | test_DecodeBase16 (const char *text) |
| TEST_CASE (BSL_BUNDLECRCTYPE_16, "89070001820282030482028201028202820000821903e81903e9004204D2") | |
| void | test_bsl_mock_encode_canonical (uint64_t crc_type, const char *expecthex) |
| void | test_bsl_mock_encode_bundle (void) |
| void | test_qcbor_decode_without_head (void) |
| void | test_qcbor_decode_only_head (void) |
| void | test_qcbor_decode_with_head (void) |
| void | test_bsl_loopback_eid (const char *hexdata) |
| void | test_bsl_loopback_bundle (const char *hexdata) |
Variables | |
| static BSL_LibCtx_t | bsl |
| static UsefulBuf | buf |
| Output storage safely cleaned up. | |
| static QCBOREncodeContext | encoder |
| Encoder shared among tests. | |
|
static |
References BSL_Data_Deinit(), BSL_Data_InitView(), BSL_TestUtils_EncodeBase16(), and string_clear().
Referenced by test_bsl_mock_encode_bundle(), test_bsl_mock_encode_canonical(), and TEST_CASE().
| void setUp | ( | void | ) |
References bsl, BSL_API_InitLib(), BSL_malloc(), buf, encoder, and TEST_ASSERT_EQUAL().
| void suiteSetUp | ( | void | ) |
| int suiteTearDown | ( | int | failures | ) |
References BSL_HostDescriptors_Clear(), and mock_bpa_LogClose().
| void tearDown | ( | void | ) |
References bsl, BSL_API_DeinitLib(), BSL_free(), buf, and TEST_ASSERT_EQUAL().
| void test_bsl_loopback_bundle | ( | const char * | hexdata | ) |
References BSL_Data_Deinit(), BSL_Data_Init(), BSL_Data_Resize(), bsl_mock_decode_bundle(), bsl_mock_encode_bundle(), BSL_TestUtils_DecodeBase16(), encoder, BSL_Data_t::len, MockBPA_Bundle_Deinit(), MockBPA_Bundle_Init(), BSL_Data_t::ptr, string_clear(), string_init_set_str(), TEST_ASSERT_EQUAL_INT(), TEST_ASSERT_EQUAL_INT_MESSAGE(), and TEST_ASSERT_EQUAL_MEMORY().
| void test_bsl_loopback_eid | ( | const char * | hexdata | ) |
References BSL_Data_Deinit(), BSL_Data_Init(), BSL_Data_Resize(), BSL_HostEID_Deinit(), BSL_HostEID_Init(), bsl_mock_decode_eid_from_ctx(), bsl_mock_encode_eid_from_ctx(), BSL_TestUtils_DecodeBase16(), encoder, BSL_HostEID_t::handle, BSL_Data_t::len, BSL_Data_t::ptr, string_clear(), string_init_set_str(), TEST_ASSERT_EQUAL_INT(), TEST_ASSERT_EQUAL_INT_MESSAGE(), and TEST_ASSERT_EQUAL_MEMORY().
| void test_bsl_mock_encode_bundle | ( | void | ) |
References MockBPA_CanonicalBlock_t::blk_num, MockBPA_CanonicalBlock_t::blk_type, MockBPA_Bundle_t::blocks, BSL_calloc(), BSL_HostEID_DecodeFromText(), BSL_HostEID_Init(), bsl_mock_encode_bundle(), MockBPA_CanonicalBlock_t::btsd, MockBPA_CanonicalBlock_t::btsd_len, MockBPA_CreationTimestamp_t::bundle_creation_time, MockBPA_CanonicalBlock_t::crc_type, MockBPA_PrimaryBlock_t::dest_eid, encoder, expected, MockBPA_CanonicalBlock_t::flags, MockBPA_Bundle_Deinit(), MockBPA_Bundle_Init(), MockBPA_Bundle_t::primary_block, printencoded(), MockBPA_PrimaryBlock_t::report_to_eid, MockBPA_CreationTimestamp_t::seq_num, MockBPA_PrimaryBlock_t::src_node_id, TEST_ASSERT_EQUAL(), TEST_ASSERT_EQUAL_INT(), TEST_ASSERT_EQUAL_MEMORY(), MockBPA_PrimaryBlock_t::timestamp, and MockBPA_PrimaryBlock_t::version.
| void test_bsl_mock_encode_canonical | ( | uint64_t | crc_type, |
| const char * | expecthex | ||
| ) |
References MockBPA_CanonicalBlock_t::blk_num, MockBPA_CanonicalBlock_t::blk_type, BSL_Data_Deinit(), BSL_Data_Init(), BSL_free(), BSL_malloc(), bsl_mock_encode_canonical(), BSL_TestUtils_DecodeBase16(), MockBPA_CanonicalBlock_t::btsd, MockBPA_CanonicalBlock_t::btsd_len, MockBPA_CanonicalBlock_t::crc_type, encoder, MockBPA_CanonicalBlock_t::flags, BSL_Data_t::len, printencoded(), BSL_Data_t::ptr, string_clear(), string_init_set_str(), TEST_ASSERT_EQUAL_INT(), TEST_ASSERT_EQUAL_INT_MESSAGE(), and TEST_ASSERT_EQUAL_MEMORY().
| void test_BSL_TestUtils_DecodeBase16_valid | ( | const char * | text, |
| const char * | expect, | ||
| size_t | expect_len | ||
| ) |
| TEST_CASE | ( | BSL_BUNDLECRCTYPE_16 | , |
| "89070001820282030482028201028202820000821903e81903e9004204D2" | |||
| ) |
References BSL_Data_Deinit(), BSL_Data_Init(), BSL_HostEID_DecodeFromText(), BSL_HostEID_Deinit(), BSL_HostEID_Init(), BSL_HOSTEID_INIT_INVALID, bsl_mock_encode_primary(), BSL_TestUtils_DecodeBase16(), MockBPA_PrimaryBlock_t::dest_eid, encoder, BSL_Data_t::len, printencoded(), BSL_Data_t::ptr, MockBPA_PrimaryBlock_t::report_to_eid, MockBPA_PrimaryBlock_t::src_node_id, string_clear(), string_init_set_str(), TEST_ASSERT_EQUAL_INT(), TEST_ASSERT_EQUAL_INT_MESSAGE(), TEST_ASSERT_EQUAL_MEMORY(), and MockBPA_PrimaryBlock_t::version.
| void test_DecodeBase16 | ( | const char * | text | ) |
References BSL_Data_Deinit(), BSL_Data_Init(), BSL_TestUtils_DecodeBase16(), string_clear(), and string_init_set_str().
| void test_qcbor_decode_only_head | ( | void | ) |
| void test_qcbor_decode_with_head | ( | void | ) |
| void test_qcbor_decode_without_head | ( | void | ) |
|
static |
Referenced by setUp(), and tearDown().
|
static |
Output storage safely cleaned up.
Referenced by BSL_AbsSecBlock_DecodeFromCBOR(), BSL_AbsSecBlock_EncodeToCBOR(), BSL_AuthCtx_DigestSeq(), BSL_Cipher_FinalizeData(), BSL_Cipher_FinalizeSeq(), BSL_Crypto_GenIV(), BSL_Crypto_UnwrapKey(), BSL_Crypto_WrapKey(), bsl_mock_decode_eid(), bsl_mock_decode_primary(), BSL_SeqReader_Get(), BSL_SeqWriter_Put(), BSL_TestUtils_FlatReader(), BSL_TestUtils_FlatWriter(), BSL_TestUtils_ReadBTSD_Read(), BSL_TestUtils_WriteBTSD_Write(), BSLX_BIB_GenIPPT(), LLVMFuzzerTestOneInput(), mock_bpa_crc_apply(), mock_bpa_crc_check(), mock_bpa_rfc9173_bcb_cek(), MockBPA_Agent_Exec(), MockBPA_Agent_Stop(), MockBPA_Agent_work_deliver(), MockBPA_Agent_work_forward(), MockBPA_ReadBTSD_Read(), MockBPA_WriteBTSD_Write(), rfc3394_cek(), rfc9173_byte_gen_fn_a1(), rfc9173_byte_gen_fn_a2_cek(), rfc9173_byte_gen_fn_a2_kek(), rfc9173_byte_gen_fn_a4(), setUp(), take_hex_1byte(), take_hex_2byte(), tearDown(), test_SeqReader_flat(), and test_SeqWriter_flat().
|
static |
Encoder shared among tests.
Referenced by BSL_AbsSecBlock_EncodeToCBOR(), BSLX_BIB_GenIPPT(), BSLX_EncodeHeader(), LLVMFuzzerTestOneInput(), M_ALGO_DEF(), setUp(), test_bsl_loopback_bundle(), test_bsl_loopback_eid(), test_bsl_mock_encode_bundle(), test_bsl_mock_encode_canonical(), and TEST_CASE().