|
BSL v1.0.0 - 16.g9d98179
AMMOS Bundle Protocol Security Library (BSL)
|
#include <unity.h>#include <BPSecLib_Public.h>#include <CryptoInterface.h>#include <backend/SecurityActionSet.h>#include <backend/SecurityResultSet.h>#include <policy_provider/SamplePolicyProvider.h>#include <security_context/rfc9173.h>#include <mock_bpa/agent.h>#include <mock_bpa/log.h>#include "bsl_test_utils.h"
Include dependency graph for test_PublicInterfaceImpl.c:Data Structures | |
| struct | BSL_TestPublInterfaceCtx_t |
Macros | |
| #define | TEST_BOTH_BIB_BCB 99 |
Functions | |
| void | suiteSetUp (void) |
| int | suiteTearDown (int failures) |
| void | PublicInterfaceTestCtx_init (BSL_TestPublInterfaceCtx_t *ctx) |
| void | PublicInterfaceTestCtx_deinit (BSL_TestPublInterfaceCtx_t *ctx) |
| void | setUp (void) |
| void | tearDown (void) |
| TEST_CASE (TEST_CASE(BSL_POLICYLOCATION_CLIN, TEST_CASE("ipn:1.1", TEST_CASE(NULL, TEST_CASE(NULL, TEST_CASE(BSL_SECROLE_ACCEPTOR, TEST_CASE(BSL_SECBLOCKTYPE_BIB, TEST_CASE(BSL_BLOCK_TYPE_PAYLOAD, TEST_CASE(BSL_POLICYACTION_DROP_BLOCK, TEST_CASE(true, TEST_CASE(1, TEST_CASE(1) | |
| void | n_test_BSL_6 (void) |
| void | test_BSL_32 (void) |
Variables | |
| static BSL_TestContext_t | LocalTestCtx = { 0 } |
| static BSL_SecurityActionSet_t | action_set = { 0 } |
| static BSL_TestPublInterfaceCtx_t | ctx = { 0 } |
| #define TEST_BOTH_BIB_BCB 99 |
| void n_test_BSL_6 | ( | void | ) |
References action_set, BSL_PrimaryBlock_t::block_count, BSL_TestContext_t::bsl, BSL_API_ApplySecurity(), BSL_API_QuerySecurity(), BSL_BundleCtx_GetBlockMetadata(), BSL_BundleCtx_GetBundleMetadata(), BSL_LOG_INFO, BSL_POLICYLOCATION_CLOUT, BSL_PrimaryBlock_deinit(), BSL_SECOP_CONCLUSION_FAILURE, BSL_SecurityAction_CountSecOpers(), BSL_SecurityAction_GetSecOperAtIndex(), BSL_SecurityActionSet_GetActionAtIndex(), BSL_TestUtils_LoadBundleFromCBOR(), BSL_TestUtils_ModifyEIDs(), mock_bpa_ctr_t::bundle_ref, RFC9173_TestVectors_AppendixA1::cbor_bundle_bib, LocalTestCtx, BSL_TestContext_t::mock_bpa_ctr, TEST_ASSERT_EQUAL(), and BSL_CanonicalBlock_t::type_code.
| void PublicInterfaceTestCtx_deinit | ( | BSL_TestPublInterfaceCtx_t * | ctx | ) |
References BSL_SecParam_Deinit(), ctx, BSL_TestPublInterfaceCtx_t::param_aad_scope_flag, BSL_TestPublInterfaceCtx_t::param_aes_variant_128, BSL_TestPublInterfaceCtx_t::param_aes_variant_256, BSL_TestPublInterfaceCtx_t::param_auth_tag, BSL_TestPublInterfaceCtx_t::param_dont_use_wrap_key, BSL_TestPublInterfaceCtx_t::param_iv, BSL_TestPublInterfaceCtx_t::param_scope_flag, BSL_TestPublInterfaceCtx_t::param_scope_flag_7, BSL_TestPublInterfaceCtx_t::param_sha_variant_384, BSL_TestPublInterfaceCtx_t::param_sha_variant_512, BSL_TestPublInterfaceCtx_t::param_test_bcb_2_key_bad, BSL_TestPublInterfaceCtx_t::param_test_bcb_2_key_correct, BSL_TestPublInterfaceCtx_t::param_test_bcb_key_bad, BSL_TestPublInterfaceCtx_t::param_test_bcb_key_correct, BSL_TestPublInterfaceCtx_t::param_test_bib_key_bad, BSL_TestPublInterfaceCtx_t::param_test_bib_key_correct, BSL_TestPublInterfaceCtx_t::param_use_wrap_key, and BSL_TestPublInterfaceCtx_t::param_wrapped_key.
Referenced by tearDown().
| void PublicInterfaceTestCtx_init | ( | BSL_TestPublInterfaceCtx_t * | ctx | ) |
References BSL_SecParam_Init(), ctx, BSL_TestPublInterfaceCtx_t::param_aad_scope_flag, BSL_TestPublInterfaceCtx_t::param_aes_variant_128, BSL_TestPublInterfaceCtx_t::param_aes_variant_256, BSL_TestPublInterfaceCtx_t::param_auth_tag, BSL_TestPublInterfaceCtx_t::param_dont_use_wrap_key, BSL_TestPublInterfaceCtx_t::param_iv, BSL_TestPublInterfaceCtx_t::param_scope_flag, BSL_TestPublInterfaceCtx_t::param_scope_flag_7, BSL_TestPublInterfaceCtx_t::param_sha_variant_384, BSL_TestPublInterfaceCtx_t::param_sha_variant_512, BSL_TestPublInterfaceCtx_t::param_test_bcb_2_key_bad, BSL_TestPublInterfaceCtx_t::param_test_bcb_2_key_correct, BSL_TestPublInterfaceCtx_t::param_test_bcb_key_bad, BSL_TestPublInterfaceCtx_t::param_test_bcb_key_correct, BSL_TestPublInterfaceCtx_t::param_test_bib_key_bad, BSL_TestPublInterfaceCtx_t::param_test_bib_key_correct, BSL_TestPublInterfaceCtx_t::param_use_wrap_key, and BSL_TestPublInterfaceCtx_t::param_wrapped_key.
Referenced by setUp().
| void setUp | ( | void | ) |
Register the policy provider with some rules
Register the Security Context
References action_set, ApxA2_AuthTag, ApxA2_InitVec, ApxA2_WrappedKey, BSL_TestContext_t::bsl, BSL_API_InitLib(), BSL_API_RegisterPolicyProvider(), BSL_BLOCK_TYPE_BIB, BSL_BLOCK_TYPE_PAYLOAD, BSL_calloc(), BSL_CryptoInit(), BSL_Data_Init(), BSL_POLICYACTION_DROP_BLOCK, BSL_POLICYACTION_DROP_BUNDLE, BSL_POLICYACTION_NOTHING, BSL_POLICYLOCATION_APPIN, BSL_POLICYLOCATION_CLIN, BSL_POLICYLOCATION_CLOUT, BSL_SAMPLE_PP_ID, BSL_SECBLOCKTYPE_BCB, BSL_SECBLOCKTYPE_BIB, BSL_SecParam_InitBytestr(), BSL_SecParam_InitInt64(), BSL_SecParam_InitTextstr(), BSL_SECPARAM_TYPE_AUTH_TAG, BSL_SECPARAM_TYPE_KEY_ID, BSL_SECPARAM_USE_KEY_WRAP, BSL_SECROLE_ACCEPTOR, BSL_SECROLE_SOURCE, BSL_SECROLE_VERIFIER, BSL_TestUtils_GetEidPatternFromText(), BSL_TestUtils_SetupDefaultSecurityContext(), BSLP_Deinit(), BSLP_FinalizePolicy(), BSLP_PolicyPredicate_Init(), BSLP_PolicyRule_CopyParam(), BSLP_PolicyRule_Init(), BSLP_QueryPolicy(), ctx, BSL_Data_t::len, LocalTestCtx, BSL_TestContext_t::mock_bpa_ctr, mock_bpa_ctr_init(), BSL_TestPublInterfaceCtx_t::param_aad_scope_flag, BSL_TestPublInterfaceCtx_t::param_aes_variant_128, BSL_TestPublInterfaceCtx_t::param_aes_variant_256, BSL_TestPublInterfaceCtx_t::param_auth_tag, BSL_TestPublInterfaceCtx_t::param_dont_use_wrap_key, BSL_TestPublInterfaceCtx_t::param_iv, BSL_TestPublInterfaceCtx_t::param_scope_flag, BSL_TestPublInterfaceCtx_t::param_scope_flag_7, BSL_TestPublInterfaceCtx_t::param_sha_variant_384, BSL_TestPublInterfaceCtx_t::param_sha_variant_512, BSL_TestPublInterfaceCtx_t::param_test_bcb_2_key_bad, BSL_TestPublInterfaceCtx_t::param_test_bcb_2_key_correct, BSL_TestPublInterfaceCtx_t::param_test_bcb_key_bad, BSL_TestPublInterfaceCtx_t::param_test_bcb_key_correct, BSL_TestPublInterfaceCtx_t::param_test_bib_key_bad, BSL_TestPublInterfaceCtx_t::param_test_bib_key_correct, BSL_TestPublInterfaceCtx_t::param_use_wrap_key, BSL_TestPublInterfaceCtx_t::param_wrapped_key, BSLP_PolicyProvider_t::pp_id, BSLP_PolicyProvider_t::predicate_count, BSLP_PolicyProvider_t::predicates, BSL_Data_t::ptr, PublicInterfaceTestCtx_init(), RFC9173_BCB_AES_VARIANT_A128GCM, RFC9173_BCB_AES_VARIANT_A256GCM, RFC9173_BCB_SECPARAM_AADSCOPE, RFC9173_BCB_SECPARAM_AESVARIANT, RFC9173_BCB_SECPARAM_IV, RFC9173_BCB_SECPARAM_WRAPPEDKEY, RFC9173_BIB_PARAMID_INTEG_SCOPE_FLAG, RFC9173_BIB_PARAMID_SHA_VARIANT, RFC9173_BIB_SHA_HMAC384, RFC9173_BIB_SHA_HMAC512, RFC9173_EXAMPLE_A1_KEY, RFC9173_EXAMPLE_A2_KEY, RFC9173_EXAMPLE_A4_BCB_KEY, BSLP_PolicyProvider_t::rule_count, BSLP_PolicyProvider_t::rules, and TEST_ASSERT_EQUAL().
| void suiteSetUp | ( | void | ) |
| int suiteTearDown | ( | int | failures | ) |
References BSL_HostDescriptors_Clear(), and mock_bpa_LogClose().
| void tearDown | ( | void | ) |
| void test_BSL_32 | ( | void | ) |
References action_set, BSL_PrimaryBlock_t::block_count, BSL_TestContext_t::bsl, BSL_API_ApplySecurity(), BSL_API_QuerySecurity(), BSL_BundleCtx_GetBlockMetadata(), BSL_BundleCtx_GetBundleMetadata(), BSL_LOG_INFO, BSL_POLICYLOCATION_CLOUT, BSL_PrimaryBlock_deinit(), BSL_SECOP_CONCLUSION_SUCCESS, BSL_SecOper_GetConclusion(), BSL_SecurityAction_CountSecOpers(), BSL_SecurityAction_GetSecOperAtIndex(), BSL_SecurityActionSet_CountActions(), BSL_SecurityActionSet_CountOperations(), BSL_SecurityActionSet_GetActionAtIndex(), BSL_TestUtils_LoadBundleFromCBOR(), BSL_TestUtils_ModifyEIDs(), mock_bpa_ctr_t::bundle_ref, RFC9173_TestVectors_AppendixA1::cbor_bundle_bib, LocalTestCtx, BSL_TestContext_t::mock_bpa_ctr, TEST_ASSERT_EQUAL(), and BSL_CanonicalBlock_t::type_code.
| TEST_CASE | ( | TEST_CASE( | BSL_POLICYLOCATION_CLIN, |
| TEST_CASE( | "ipn:1.1", | ||
| TEST_CASE( | NULL, | ||
| TEST_CASE( | NULL, | ||
| TEST_CASE( | BSL_SECROLE_ACCEPTOR, | ||
| TEST_CASE( | BSL_SECBLOCKTYPE_BIB, | ||
| TEST_CASE( | BSL_BLOCK_TYPE_PAYLOAD, | ||
| TEST_CASE( | BSL_POLICYACTION_DROP_BLOCK, | ||
| TEST_CASE( | true, | ||
| TEST_CASE( | 1, | ||
| TEST_CASE( | 1 | ||
| ) |
References action_set, BSL_PrimaryBlock_t::block_count, BSL_TestContext_t::bsl, BSL_API_ApplySecurity(), BSL_API_QuerySecurity(), BSL_BundleCtx_GetBlockMetadata(), BSL_BundleCtx_GetBundleMetadata(), BSL_LOG_INFO, BSL_POLICYACTION_DROP_BLOCK, BSL_POLICYACTION_DROP_BUNDLE, BSL_POLICYACTION_NOTHING, BSL_PrimaryBlock_deinit(), BSL_SAMPLE_PP_ID, BSL_SECBLOCKTYPE_BCB, BSL_SECBLOCKTYPE_BIB, BSL_SECOP_CONCLUSION_FAILURE, BSL_SECOP_CONCLUSION_SUCCESS, BSL_SecOper_GetConclusion(), BSL_SECROLE_ACCEPTOR, BSL_SECROLE_SOURCE, BSL_SECROLE_VERIFIER, BSL_SecurityAction_CountSecOpers(), BSL_SecurityAction_GetSecOperAtIndex(), BSL_SecurityActionSet_CountActions(), BSL_SecurityActionSet_CountOperations(), BSL_SecurityActionSet_GetActionAtIndex(), BSL_TestUtils_LoadBundleFromCBOR(), BSL_TestUtils_ModifyEIDs(), mock_bpa_ctr_t::bundle_ref, RFC9173_TestVectorsA2::cbor_bundle_bcb, RFC9173_TestVectors_AppendixA1::cbor_bundle_bib, RFC9173_TestVectors_A4_Modified::cbor_bundle_final, RFC9173_TestVectors_AppendixA1::cbor_bundle_original, RFC9173_TestVectorsA2::cbor_bundle_original, RFC9173_TestVectors_A4_Modified::cbor_bundle_original, BSL_BundleRef_t::data, LocalTestCtx, BSL_TestContext_t::mock_bpa_ctr, RFC9173_TestVectors_AppendixA2, RFC9173_TestVectors_AppendixA4, TEST_ASSERT_EQUAL(), TEST_BOTH_BIB_BCB, and BSL_CanonicalBlock_t::type_code.
|
static |
Referenced by n_test_BSL_6(), setUp(), tearDown(), test_BSL_32(), and TEST_CASE().
|
static |
Referenced by BSL_Crypto_AddRegistryKey(), BSL_Crypto_GenKey(), BSL_Crypto_UnwrapKey(), BSL_Crypto_WrapKey(), gcm_decrypt(), gcm_encrypt(), MockBPA_Agent_Deinit(), MockBPA_Agent_DumpTelemetry(), MockBPA_Agent_Init(), MockBPA_Agent_process(), PublicInterfaceTestCtx_deinit(), PublicInterfaceTestCtx_init(), setUp(), tearDown(), test_decrypt(), and test_encrypt().
|
static |
Referenced by n_test_BSL_6(), setUp(), tearDown(), test_BSL_32(), and TEST_CASE().