|
BSL v1.1.1 - 39.g9f43410
AMMOS Bundle Protocol Security Library (BSL)
|
Implementation of functions to interact with the security context. More...
#include "AbsSecBlock.h"#include "CBOR.h"#include "PublicInterfaceImpl.h"#include "SecOperation.h"#include "SecurityActionSet.h"#include "bsl/BPSecLib_Private.h"
Include dependency graph for SecurityContext.c:Functions | |
| static int | Encode_ASB (BSL_LibCtx_t *lib, BSL_BundleRef_t *bundle, uint64_t blk_num, const BSL_AbsSecBlock_t *asb) |
| static int | BSL_ExecAnySource_Pre (BSL_LibCtx_t *lib, BSL_BundleRef_t *bundle, BSL_SecOper_t *sec_oper, BSL_AbsSecBlock_t *asb) |
| Common handling of needed ASB content before an operation. | |
| static int | BSL_ExecAnySource_Post (BSL_LibCtx_t *lib, BSL_BundleRef_t *bundle, BSL_SecOper_t *sec_oper, BSL_AbsSecBlock_t *asb) |
| Common handling of informing new ASB content after an operation. | |
| int | BSL_ExecBIBSource (BSL_SecCtx_Execute_f sec_context_fn, BSL_LibCtx_t *lib, BSL_BundleRef_t *bundle, BSL_SecOper_t *sec_oper) |
| Internal function to execute an operation as source. | |
| static int | BSL_ExecAnyVerifierAcceptor_Pre (BSL_LibCtx_t *lib, BSL_BundleRef_t *bundle, BSL_SecOper_t *sec_oper, BSL_AbsSecBlock_t *asb) |
| Common handling of binding to existing ASB content from an operation. | |
| int | BSL_ExecBIBVerifierAcceptor (BSL_SecCtx_Execute_f sec_context_fn, BSL_LibCtx_t *lib, BSL_BundleRef_t *bundle, BSL_SecOper_t *sec_oper) |
| Internal function to execute an operation as verifier or acceptor. | |
| int | BSL_ExecBCBVerifierAcceptor (BSL_SecCtx_Execute_f sec_context_fn, BSL_LibCtx_t *lib, BSL_BundleRef_t *bundle, BSL_SecOper_t *sec_oper) |
| Internal function to execute an operation as verifier or acceptor. | |
| int | BSL_ExecBCBSource (BSL_SecCtx_Execute_f sec_context_fn, BSL_LibCtx_t *lib, BSL_BundleRef_t *bundle, BSL_SecOper_t *sec_oper) |
| Internal function to execute an operation as source. | |
| int | BSL_SecCtx_ExecutePolicyActionSet (BSL_LibCtx_t *lib, BSL_BundleRef_t *bundle, const BSL_SecurityActionSet_t *action_set) |
| Call the underlying security context to perform the given action set. | |
| int | BSL_SecCtx_ValidatePolicyActionSet (BSL_LibCtx_t *lib, BSL_BundleRef_t *bundle, const BSL_SecurityActionSet_t *action_set) |
| Call the underlying security context to validate the given action set. | |
Implementation of functions to interact with the security context.
|
static |
Common handling of informing new ASB content after an operation.
References BSL_CanonicalBlock_t::block_num, BSL_AbsSecBlock_AddTarget(), BSL_BundleCtx_GetBlockMetadata(), BSL_ERR_HOST_CALLBACK_FAILED, BSL_LOG_ERR, BSL_SUCCESS, BSL_TLM_SECOP_FAIL_COUNT, BSL_TlmCounters_IncrementCounter(), Encode_ASB(), and BSL_AbsSecBlock_Target_t::results.
Referenced by BSL_ExecBCBSource(), and BSL_ExecBIBSource().
|
static |
Common handling of needed ASB content before an operation.
References BSL_ERR_HOST_CALLBACK_FAILED, BSL_Host_GetSecSrcEID(), BSL_LOG_ERR, and BSL_SUCCESS.
Referenced by BSL_ExecBCBSource(), and BSL_ExecBIBSource().
|
static |
Common handling of binding to existing ASB content from an operation.
References BSL_CanonicalBlock_t::block_num, BSL_AbsSecBlock_Decode(), BSL_AbsSecBlock_IsConsistent(), BSL_BundleCtx_GetBlockMetadata(), BSL_BundleCtx_ReadBTSD(), BSL_CBOR_Decode(), BSL_Data_Deinit(), BSL_Data_InitBuffer(), BSL_ERR_DECODING, BSL_ERR_HOST_CALLBACK_FAILED, BSL_LOG_ERR, BSL_SeqReader_Destroy(), BSL_SeqReader_Get(), BSL_SUCCESS, BSL_TLM_ASB_DECODE_BYTES, BSL_TLM_ASB_DECODE_COUNT, BSL_TLM_SECOP_FAIL_COUNT, BSL_TlmCounters_IncrementCounter(), BSL_CanonicalBlock_t::btsd_len, CHK_PROPERTY, BSL_Data_t::len, BSL_Data_t::ptr, BSL_AbsSecBlock_Target_t::results, and BSL_AbsSecBlock_Target_t::target_block_num.
Referenced by BSL_ExecBCBVerifierAcceptor(), and BSL_ExecBIBVerifierAcceptor().
| int BSL_ExecBCBSource | ( | BSL_SecCtx_Execute_f | sec_context_fn, |
| BSL_LibCtx_t * | lib, | ||
| BSL_BundleRef_t * | bundle, | ||
| BSL_SecOper_t * | sec_oper | ||
| ) |
Internal function to execute an operation as source.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
References BSL_AbsSecBlock_Deinit(), BSL_AbsSecBlock_Init(), BSL_BundleCtx_CreateBlock(), BSL_ERR_BUNDLE_OPERATION_FAILED, BSL_ERR_SECURITY_OPERATION_FAILED, BSL_ExecAnySource_Post(), BSL_ExecAnySource_Pre(), BSL_LOG_DEBUG, BSL_LOG_ERR, BSL_SECBLOCKTYPE_BCB, BSL_SUCCESS, BSL_TLM_SECOP_FAIL_COUNT, BSL_TLM_SECOP_SOURCE_COUNT, BSL_TlmCounters_IncrementCounter(), CHK_ARG_NONNULL, and CHK_PROPERTY.
Referenced by BSL_SecCtx_ExecutePolicyActionSet(), test_AppendixA_Example4_BCB_Source(), test_AppendixA_Example5_BCB_Source(), and test_AppendixA_Example6_BCB_Source().
| int BSL_ExecBCBVerifierAcceptor | ( | BSL_SecCtx_Execute_f | sec_context_fn, |
| BSL_LibCtx_t * | lib, | ||
| BSL_BundleRef_t * | bundle, | ||
| BSL_SecOper_t * | sec_oper | ||
| ) |
Internal function to execute an operation as verifier or acceptor.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
References BSL_AbsSecBlock_Deinit(), BSL_AbsSecBlock_Init(), BSL_AbsSecBlock_IsEmpty(), BSL_AbsSecBlock_StripResults(), BSL_BundleCtx_RemoveBlock(), BSL_ERR_FAILURE, BSL_ERR_HOST_CALLBACK_FAILED, BSL_ERR_SECURITY_OPERATION_FAILED, BSL_ExecAnyVerifierAcceptor_Pre(), BSL_LOG_ERR, BSL_SecOper_GetTargetBlockNum(), BSL_SecOper_IsRoleVerifier(), BSL_SUCCESS, BSL_TLM_SECOP_ACCEPTOR_COUNT, BSL_TLM_SECOP_FAIL_COUNT, BSL_TLM_SECOP_VERIFIER_COUNT, BSL_TlmCounters_IncrementCounter(), CHK_ARG_NONNULL, and Encode_ASB().
Referenced by BSL_SecCtx_ExecutePolicyActionSet(), test_AppendixA_Example4_BCB_VerifyAccept(), test_AppendixA_Example5_BCB_VerifyAccept(), test_CCSDS_Example_Mac_VerifyAccept(), test_RFC9173_AppendixA_Example2_BCB_Acceptor(), and test_sec_accept_keyunwrap().
| int BSL_ExecBIBSource | ( | BSL_SecCtx_Execute_f | sec_context_fn, |
| BSL_LibCtx_t * | lib, | ||
| BSL_BundleRef_t * | bundle, | ||
| BSL_SecOper_t * | sec_oper | ||
| ) |
Internal function to execute an operation as source.
References BSL_AbsSecBlock_Deinit(), BSL_AbsSecBlock_Init(), BSL_BundleCtx_CreateBlock(), BSL_ERR_BUNDLE_OPERATION_FAILED, BSL_ERR_SECURITY_OPERATION_FAILED, BSL_ExecAnySource_Post(), BSL_ExecAnySource_Pre(), BSL_LOG_DEBUG, BSL_LOG_ERR, BSL_SECBLOCKTYPE_BIB, BSL_SUCCESS, BSL_TLM_SECOP_FAIL_COUNT, BSL_TLM_SECOP_SOURCE_COUNT, BSL_TlmCounters_IncrementCounter(), CHK_ARG_NONNULL, and CHK_PROPERTY.
Referenced by BSL_SecCtx_ExecutePolicyActionSet(), test_AppendixA_Example1_BIB_Source(), and test_CCSDS_Example_Mac_Source().
| int BSL_ExecBIBVerifierAcceptor | ( | BSL_SecCtx_Execute_f | sec_context_fn, |
| BSL_LibCtx_t * | lib, | ||
| BSL_BundleRef_t * | bundle, | ||
| BSL_SecOper_t * | sec_oper | ||
| ) |
Internal function to execute an operation as verifier or acceptor.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
References BSL_AbsSecBlock_Deinit(), BSL_AbsSecBlock_Init(), BSL_AbsSecBlock_IsEmpty(), BSL_AbsSecBlock_StripResults(), BSL_BundleCtx_RemoveBlock(), BSL_ERR_FAILURE, BSL_ERR_HOST_CALLBACK_FAILED, BSL_ERR_SECURITY_OPERATION_FAILED, BSL_ExecAnyVerifierAcceptor_Pre(), BSL_LOG_ERR, BSL_SecOper_GetTargetBlockNum(), BSL_SecOper_IsConsistent(), BSL_SecOper_IsRoleVerifier(), BSL_SUCCESS, BSL_TLM_SECOP_ACCEPTOR_COUNT, BSL_TLM_SECOP_FAIL_COUNT, BSL_TLM_SECOP_VERIFIER_COUNT, BSL_TlmCounters_IncrementCounter(), CHK_ARG_NONNULL, CHK_PRECONDITION, and Encode_ASB().
Referenced by BSL_SecCtx_ExecutePolicyActionSet(), test_AppendixA_Example1_BIB_VerifyAccept(), and test_sec_accept_keyunwrap().
| int BSL_SecCtx_ExecutePolicyActionSet | ( | BSL_LibCtx_t * | lib, |
| BSL_BundleRef_t * | bundle, | ||
| const BSL_SecurityActionSet_t * | action_set | ||
| ) |
Call the underlying security context to perform the given action set.
| [in] | lib | This BSL context |
| [in,out] | bundle | Pointer to bundle, which may be modified. |
| [in] | action_set | Action containing all params and operations. |
Notes:
References action_set, BSL_ExecBCBSource(), BSL_ExecBCBVerifierAcceptor(), BSL_ExecBIBSource(), BSL_ExecBIBVerifierAcceptor(), BSL_LOG_CRIT, BSL_LOG_ERR, BSL_LOG_INFO, BSL_REASONCODE_FAILED_SECOP, BSL_REASONCODE_NO_ADDITIONAL_INFO, BSL_SECOP_CONCLUSION_FAILURE, BSL_SECOP_CONCLUSION_SUCCESS, BSL_SecOper_ClearParamsAndResults(), BSL_SecOper_GetReasonCode(), BSL_SecOper_IsBIB(), BSL_SecOper_IsRoleSource(), BSL_SecOper_SetConclusion(), BSL_SecOper_SetReasonCode(), BSL_SecurityAction_CountSecOpers(), BSL_SecurityAction_GetSecOperAtIndex(), BSL_SecurityActionSet_IsConsistent(), BSL_SUCCESS, CHK_ARG_NONNULL, and CHK_PRECONDITION.
Referenced by BSL_API_ApplySecurity(), 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().
| int BSL_SecCtx_ValidatePolicyActionSet | ( | BSL_LibCtx_t * | lib, |
| BSL_BundleRef_t * | bundle, | ||
| const BSL_SecurityActionSet_t * | action_set | ||
| ) |
Call the underlying security context to validate the given action set.
| [in] | lib | This BSL context |
| [in] | bundle | Pointer to bundle |
| [in] | action_set | Action containing all params and operations. |
References action_set, BSL_LOG_ERR, BSL_LOG_WARNING, BSL_SUCCESS, and CHK_ARG_NONNULL.
Referenced by BSL_API_QuerySecurity(), and test_SecurityContext_ValidatePolicyActionSet_UsesRegisteredValidator().
|
static |
References BSL_AbsSecBlock_Encode(), BSL_BundleCtx_WriteBTSD(), BSL_CBOR_Encode_Twopass(), BSL_Data_Deinit(), BSL_Data_Init(), BSL_ERR_ENCODING, BSL_LOG_ERR, BSL_SeqWriter_Destroy(), BSL_SeqWriter_Put(), BSL_SUCCESS, BSL_TLM_ASB_ENCODE_BYTES, BSL_TLM_ASB_ENCODE_COUNT, BSL_TlmCounters_IncrementCounter(), BSL_Data_t::len, and BSL_Data_t::ptr.
Referenced by BSL_ExecAnySource_Post(), BSL_ExecBCBVerifierAcceptor(), and BSL_ExecBIBVerifierAcceptor().