|
BSL v1.1.1 - 19.g31939de
AMMOS Bundle Protocol Security Library (BSL)
|
#include <assert.h>#include <m-string.h>#include <BPSecLib_Private.h>#include <CryptoInterface.h>#include <mock_bpa/MockBPA.h>#include <backend/IdValPair.h>#include <backend/SecurityActionSet.h>#include <backend/UtilDefs_SeqReadWrite.h>#include <policy_provider/SamplePolicyProvider.h>#include <default_sc/DefaultSecContext.h>#include "DefaultScUtils.h"
Include dependency graph for DefaultScUtils.c:Macros | |
| #define | quick_data(field, tgt) BSL_Data_InitView(&(field), sizeof(tgt), (BSL_DataPtr_t)(tgt)) |
Functions | |
| void | BIBTestContext_Init (BIBTestContext *obj) |
| void | BIBTestContext_Deinit (BIBTestContext *obj) |
| void | BCBTestContext_Init (BCBTestContext *obj) |
| void | BCBTestContext_Deinit (BCBTestContext *obj) |
| void | BSL_TestUtils_InitBIB_AppendixA1 (BIBTestContext *context, BSL_SecRole_e role, const char *key_id) |
| void | BSL_TestUtils_InitBCB_Appendix2 (BCBTestContext *context, BSL_SecRole_e role) |
| RFC9173_A1_Params | BSL_TestUtils_GetRFC9173_A1Params (const char *key_id) |
| BSL_SecurityActionSet_t * | BSL_TestUtils_InitMallocBIBActionSet (BIBTestContext *bib_context) |
| BSL_SecurityResponseSet_t * | BSL_TestUtils_MallocEmptyPolicyResponse (void) |
| int | rfc9173_byte_gen_fn_a1 (unsigned char *buf, int len) |
| int | rfc9173_byte_gen_fn_a2_kek (unsigned char *buf, int len) |
| int | rfc9173_byte_gen_fn_a2_cek (unsigned char *buf, int len) |
| int | rfc9173_byte_gen_fn_a4 (unsigned char *buf, int len) |
| void | BSL_TestUtils_SetupDefaultSecurityContext (BSL_LibCtx_t *bsl_lib) |
Variables | |
| const struct RFC9173_TestVectors_AppendixA1 | RFC9173_TestVectors_AppendixA1 |
| const struct RFC9173_TestVectorsA2 | RFC9173_TestVectors_AppendixA2 |
| const struct RFC9173_TestVectors_A4_Modified | RFC9173_TestVectors_AppendixA4 |
| #define quick_data | ( | field, | |
| tgt | |||
| ) | BSL_Data_InitView(&(field), sizeof(tgt), (BSL_DataPtr_t)(tgt)) |
| void BCBTestContext_Deinit | ( | BCBTestContext * | obj | ) |
References BSL_IdValPair_Deinit(), BSL_SecOper_Deinit(), BCBTestContext::opt_aes_variant, BCBTestContext::opt_scope_flags, BCBTestContext::opt_test_key_id, BCBTestContext::opt_use_key_wrap, and BCBTestContext::sec_oper.
Referenced by test_RFC9173_AppendixA_Example2_BCB_Acceptor(), test_RFC9173_AppendixA_Example2_BCB_Source(), test_RFC9173_AppendixA_Example3_Acceptor(), test_RFC9173_AppendixA_Example3_Source(), test_RFC9173_AppendixA_Example4_Acceptor(), test_RFC9173_AppendixA_Example4_Source(), test_sec_accept_keyunwrap(), and test_sec_source_keywrap().
| void BCBTestContext_Init | ( | BCBTestContext * | obj | ) |
References BSL_IdValPair_Init(), BSL_SecOper_Init(), BCBTestContext::opt_aes_variant, BCBTestContext::opt_scope_flags, BCBTestContext::opt_test_key_id, BCBTestContext::opt_use_key_wrap, and BCBTestContext::sec_oper.
Referenced by test_RFC9173_AppendixA_Example2_BCB_Acceptor(), test_RFC9173_AppendixA_Example2_BCB_Source(), test_RFC9173_AppendixA_Example3_Acceptor(), test_RFC9173_AppendixA_Example3_Source(), test_RFC9173_AppendixA_Example4_Acceptor(), test_RFC9173_AppendixA_Example4_Source(), test_sec_accept_keyunwrap(), and test_sec_source_keywrap().
| void BIBTestContext_Deinit | ( | BIBTestContext * | obj | ) |
References BSL_IdValPair_Deinit(), BSL_SecOper_Deinit(), BIBTestContext::opt_scope_flags, BIBTestContext::opt_sha_variant, BIBTestContext::opt_test_key, BIBTestContext::opt_use_key_wrap, and BIBTestContext::sec_oper.
Referenced by test_RFC9173_AppendixA_Example1_BIB_Source(), test_RFC9173_AppendixA_Example3_Acceptor(), test_RFC9173_AppendixA_Example3_Source(), test_RFC9173_AppendixA_Example4_Acceptor(), test_RFC9173_AppendixA_Example4_Source(), test_sec_accept_keyunwrap(), test_sec_source_keywrap(), test_SecurityContext_BIB_Acceptor(), test_SecurityContext_BIB_Source(), test_SecurityContext_BIB_Verifier(), and test_SecurityContext_BIB_Verifier_Failure().
| void BIBTestContext_Init | ( | BIBTestContext * | obj | ) |
References BSL_IdValPair_Init(), BSL_SecOper_Init(), BIBTestContext::opt_scope_flags, BIBTestContext::opt_sha_variant, BIBTestContext::opt_test_key, BIBTestContext::opt_use_key_wrap, and BIBTestContext::sec_oper.
Referenced by test_RFC9173_AppendixA_Example1_BIB_Source(), test_RFC9173_AppendixA_Example3_Acceptor(), test_RFC9173_AppendixA_Example3_Source(), test_RFC9173_AppendixA_Example4_Acceptor(), test_RFC9173_AppendixA_Example4_Source(), test_sec_accept_keyunwrap(), test_sec_source_keywrap(), test_SecurityContext_BIB_Acceptor(), test_SecurityContext_BIB_Source(), test_SecurityContext_BIB_Verifier(), and test_SecurityContext_BIB_Verifier_Failure().
| RFC9173_A1_Params BSL_TestUtils_GetRFC9173_A1Params | ( | const char * | key_id | ) |
References RFC9173_TestVectors_AppendixA1::bib_asb_scope_flags_key, RFC9173_TestVectors_AppendixA1::bib_asb_scope_flags_value, RFC9173_TestVectors_AppendixA1::bib_asb_sha_variant_key, RFC9173_TestVectors_AppendixA1::bib_asb_sha_variant_value, BSL_IdValPair_Init(), BSL_IdValPair_SetInt64(), BSL_IdValPair_SetTextstr(), BSLX_BIB_OPT_KEY_ID, BSLX_BIB_OPT_USE_KEY_WRAP, RFC9173_A1_Params::scope_flags, RFC9173_A1_Params::sha_variant, RFC9173_A1_Params::test_key_id, and RFC9173_A1_Params::use_key_wrap.
Referenced by test_MultiplePolicyProviders(), and test_PolicyProvider_Inspect_RFC9173_BIB().
| void BSL_TestUtils_InitBCB_Appendix2 | ( | BCBTestContext * | context, |
| BSL_SecRole_e | role | ||
| ) |
References BSL_IdValPair_SetInt64(), BSL_IdValPair_SetTextstr(), BSL_POLICYACTION_NOTHING, BSL_SECBLOCKTYPE_BCB, BSL_SecOper_AppendOption(), BSL_SecOper_Populate(), BSLX_BCB_OPT_AES_VARIANT, BSLX_BCB_OPT_KEY_ID, BSLX_BCB_OPT_SCOPE, BSLX_BCB_OPT_USE_KEY_WRAP, BCBTestContext::opt_aes_variant, BCBTestContext::opt_scope_flags, BCBTestContext::opt_test_key_id, BCBTestContext::opt_use_key_wrap, RFC9173_BCB_AES_VARIANT_A128GCM, RFC9173_CONTEXTID_BCB_AES_GCM, RFC9173_EXAMPLE_A2_KEY, and BCBTestContext::sec_oper.
Referenced by test_RFC9173_AppendixA_Example2_BCB_Acceptor(), and test_RFC9173_AppendixA_Example2_BCB_Source().
| void BSL_TestUtils_InitBIB_AppendixA1 | ( | BIBTestContext * | context, |
| BSL_SecRole_e | role, | ||
| const char * | key_id | ||
| ) |
References BSL_IdValPair_SetInt64(), BSL_IdValPair_SetTextstr(), BSL_POLICYACTION_DROP_BLOCK, BSL_SECBLOCKTYPE_BIB, BSL_SecOper_AppendOption(), BSL_SecOper_Populate(), BSLX_BIB_OPT_KEY_ID, BSLX_BIB_OPT_SCOPE, BSLX_BIB_OPT_SHA_VARIANT, BSLX_BIB_OPT_USE_KEY_WRAP, BIBTestContext::opt_scope_flags, BIBTestContext::opt_sha_variant, BIBTestContext::opt_test_key, BIBTestContext::opt_use_key_wrap, RFC9173_BIB_SHA_HMAC512, RFC9173_CONTEXTID_BIB_HMAC_SHA2, and BIBTestContext::sec_oper.
Referenced by test_RFC9173_AppendixA_Example1_BIB_Source(), test_SecurityContext_BIB_Acceptor(), test_SecurityContext_BIB_Source(), test_SecurityContext_BIB_Verifier(), and test_SecurityContext_BIB_Verifier_Failure().
| BSL_SecurityActionSet_t * BSL_TestUtils_InitMallocBIBActionSet | ( | BIBTestContext * | bib_context | ) |
References action_set, BSL_calloc(), BSL_free(), BSL_SecOper_Init(), BSL_SecurityAction_AppendSecOper(), BSL_SecurityAction_Deinit(), BSL_SecurityAction_Init(), BSL_SecurityActionSet_AppendAction(), BSL_SecurityActionSet_Init(), and BIBTestContext::sec_oper.
Referenced by test_SecurityContext_BIB_Acceptor(), test_SecurityContext_BIB_Source(), test_SecurityContext_BIB_Verifier(), and test_SecurityContext_BIB_Verifier_Failure().
| BSL_SecurityResponseSet_t * BSL_TestUtils_MallocEmptyPolicyResponse | ( | void | ) |
References BSL_calloc(), and BSL_SecurityResponseSet_Sizeof().
Referenced by test_MultiplePolicyProviders(), test_RFC9173_AppendixA_Example3_Acceptor(), test_RFC9173_AppendixA_Example3_Source(), test_RFC9173_AppendixA_Example4_Acceptor(), test_RFC9173_AppendixA_Example4_Source(), test_SecurityContext_BIB_Acceptor(), test_SecurityContext_BIB_Source(), test_SecurityContext_BIB_Verifier(), and test_SecurityContext_BIB_Verifier_Failure().
| void BSL_TestUtils_SetupDefaultSecurityContext | ( | BSL_LibCtx_t * | bsl_lib | ) |
References BSL_API_RegisterSecurityContext(), BSL_Crypto_AddRegistryKey(), BSLX_BCB_Execute(), BSLX_BCB_Validate(), BSLX_BIB_Execute(), BSLX_BIB_Validate(), RFC9173_CONTEXTID_BCB_AES_GCM, RFC9173_CONTEXTID_BIB_HMAC_SHA2, RFC9173_EXAMPLE_A1_KEY, RFC9173_EXAMPLE_A2_KEY, RFC9173_EXAMPLE_A3_KEY, and RFC9173_EXAMPLE_A4_BCB_KEY.
| int rfc9173_byte_gen_fn_a1 | ( | unsigned char * | buf, |
| int | len | ||
| ) |
References buf.
Referenced by test_RFC9173_AppendixA_Example1_BIB_Source().
| int rfc9173_byte_gen_fn_a2_cek | ( | unsigned char * | buf, |
| int | len | ||
| ) |
References buf.
Referenced by test_RFC9173_AppendixA_Example2_BCB_Source().
| int rfc9173_byte_gen_fn_a2_kek | ( | unsigned char * | buf, |
| int | len | ||
| ) |
References buf.
| int rfc9173_byte_gen_fn_a4 | ( | unsigned char * | buf, |
| int | len | ||
| ) |
References buf.
Referenced by test_RFC9173_AppendixA_Example3_Acceptor(), test_RFC9173_AppendixA_Example4_Acceptor(), and test_RFC9173_AppendixA_Example4_Source().
| const struct RFC9173_TestVectorsA2 RFC9173_TestVectors_AppendixA2 |
Referenced by TEST_CASE(), and test_RFC9173_AppendixA_Example2_BCB_Acceptor().
| const struct RFC9173_TestVectors_A4_Modified RFC9173_TestVectors_AppendixA4 |
Referenced by TEST_CASE().