|
BSL v1.1.1 - 39.g9f43410
AMMOS Bundle Protocol Security Library (BSL)
|
#include "TestUtils.h"#include <bsl/crypto/CryptoInterface.h>#include <bsl/dynamic/IdValPair.h>#include <bsl/dynamic/PublicInterfaceImpl.h>#include <bsl/dynamic/SecOperation.h>#include <bsl/dynamic/SecurityActionSet.h>#include <bsl/mock_bpa/ctr.h>#include <m-string.h>
Include dependency graph for DefaultScUtils.h:
This graph shows which files directly or indirectly include this file:Data Structures | |
| struct | BIBTestContext |
| struct | BCBTestContext |
| struct | RFC9173_TestVectors_AppendixA1 |
| Hard-coded single struct with fields populated from test vector in Appendix A1 for BIB. More... | |
| struct | RFC9173_TestVectorsA2 |
| struct | RFC9173_TestVectors_A4_Modified |
| struct | RFC9173_A1_Params |
| struct | RFC9173_AppendixA2_BCB |
Macros | |
| #define | RFC9173_EXAMPLE_A1_KEY "9100" |
| Key ID for the Appendix A1 key in OpenSSL. | |
| #define | RFC9173_EXAMPLE_A2_KEY "9102" |
| Key ID for the Appendix A2 key in OpenSSL. | |
| #define | RFC9173_EXAMPLE_A3_KEY "9103" |
| Key ID for the Appendix A3 key in OpenSSL. | |
| #define | RFC9173_EXAMPLE_A4_BCB_KEY "9104" |
| Key ID for the Appendix A4 key in OpenSSL. | |
| #define | BSL_SAMPLE_PP_ID 1 |
| Sample policy provider ID. | |
| #define | BSL_SAMPLE_PP_ID_2 2 |
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 BSL_SAMPLE_PP_ID 1 |
Sample policy provider ID.
| #define BSL_SAMPLE_PP_ID_2 2 |
| #define RFC9173_EXAMPLE_A1_KEY "9100" |
Key ID for the Appendix A1 key in OpenSSL.
| #define RFC9173_EXAMPLE_A2_KEY "9102" |
Key ID for the Appendix A2 key in OpenSSL.
| #define RFC9173_EXAMPLE_A3_KEY "9103" |
Key ID for the Appendix A3 key in OpenSSL.
| #define RFC9173_EXAMPLE_A4_BCB_KEY "9104" |
Key ID for the Appendix A4 key in OpenSSL.
| 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().
|
inlinestatic |
Test helper function.
References BSL_Crypto_AddRegistryKey(), BSL_Crypto_LoadKey(), BSL_Crypto_ReleaseKeyHandle(), BSL_DATA_INIT_VIEW_CSTR, and keyhandle.
Referenced by add_key_to_reg_fn(), BSL_TestUtils_SetupDefaultSecurityContext(), setUp(), TEST_CASE(), TEST_CASE(), test_get_key_concurrency(), test_sec_accept_keyunwrap(), and test_sec_source_keywrap().
|
inlinestatic |
Test helper function.
References BSL_Crypto_GetRegistryKey(), and BSL_DATA_INIT_VIEW_CSTR.
Referenced by get_key_from_reg_fn(), test_add_key_concurrency(), TEST_CASE(), TEST_CASE(), test_decrypt(), and test_encrypt().
|
inlinestatic |
Test helper function.
References BSL_Crypto_RemoveRegistryKey(), and BSL_DATA_INIT_VIEW_CSTR.
Referenced by TEST_CASE().
| 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().
| RFC9173_A1_Params BSL_TestUtils_GetRFC9173_A2Params | ( | const char * | key_id | ) |
| 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().
| void BSL_TestUtils_SetupDefaultSecurityContext | ( | BSL_LibCtx_t * | bsl_lib | ) |
References BSL_API_RegisterSecurityContext(), BSL_Crypto_AddRegistryKeyName(), 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 | ||
| ) |
Referenced by test_RFC9173_AppendixA_Example1_BIB_Source().
| int rfc9173_byte_gen_fn_a2_cek | ( | unsigned char * | buf, |
| int | len | ||
| ) |
Referenced by test_RFC9173_AppendixA_Example2_BCB_Source().
| int rfc9173_byte_gen_fn_a2_kek | ( | unsigned char * | buf, |
| int | len | ||
| ) |
| int rfc9173_byte_gen_fn_a4 | ( | unsigned char * | buf, |
| int | len | ||
| ) |
| const struct RFC9173_TestVectorsA2 RFC9173_TestVectors_AppendixA2 |
| const struct RFC9173_TestVectors_A4_Modified RFC9173_TestVectors_AppendixA4 |