BSL v2.0.1 - 13.gad0cb52
AMMOS Bundle Protocol Security Library (BSL)
Loading...
Searching...
No Matches
SecurityContext.c File Reference

Implementation of functions to interact with the security context. More...

#include "AbsSecBlock.h"
#include "BundleRefState.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 bool Validate_RFC9172_Constraints_SecOper (const BSL_BundleRef_t *bundle, const BSL_SecOper_t *sec_oper)
 Validate RFC 9172 constraints, common to all security contexts.
 
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_TargetIndependent (const BSL_SecOper_t *sec_oper, BSL_AbsSecBlock_t *asb)
 
static void BSL_ExecAnySource_Post_TargetSpecific (const BSL_SecOper_t *sec_oper, BSL_AbsSecBlock_t *asb)
 
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, const BSL_BundleRef_t *bundle, BSL_SecOper_t *sec_oper, const 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.
 

Detailed Description

Implementation of functions to interact with the security context.

Function Documentation

◆ BSL_ExecAnySource_Post()

static int BSL_ExecAnySource_Post ( BSL_LibCtx_t *  lib,
BSL_BundleRef_t *  bundle,
BSL_SecOper_t *  sec_oper,
BSL_AbsSecBlock_t *  asb 
)
static

◆ BSL_ExecAnySource_Post_TargetIndependent()

static int BSL_ExecAnySource_Post_TargetIndependent ( const BSL_SecOper_t *  sec_oper,
BSL_AbsSecBlock_t *  asb 
)
static

◆ BSL_ExecAnySource_Post_TargetSpecific()

static void BSL_ExecAnySource_Post_TargetSpecific ( const BSL_SecOper_t *  sec_oper,
BSL_AbsSecBlock_t *  asb 
)
static

◆ BSL_ExecAnySource_Pre()

static int BSL_ExecAnySource_Pre ( BSL_LibCtx_t *  lib,
BSL_BundleRef_t *  bundle,
BSL_SecOper_t *  sec_oper,
BSL_AbsSecBlock_t *  asb 
)
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().

◆ BSL_ExecAnyVerifierAcceptor_Pre()

static int BSL_ExecAnyVerifierAcceptor_Pre ( BSL_LibCtx_t *  lib,
const BSL_BundleRef_t *  bundle,
BSL_SecOper_t *  sec_oper,
const BSL_AbsSecBlock_t *  asb 
)
static

◆ BSL_ExecBCBSource()

int BSL_ExecBCBSource ( BSL_SecCtx_Execute_f  sec_context_fn,
BSL_LibCtx_t *  lib,
BSL_BundleRef_t *  bundle,
BSL_SecOper_t *  sec_oper 
)

◆ BSL_ExecBCBVerifierAcceptor()

◆ BSL_ExecBIBSource()

◆ BSL_ExecBIBVerifierAcceptor()

◆ BSL_SecCtx_ExecutePolicyActionSet()

int BSL_SecCtx_ExecutePolicyActionSet ( BSL_LibCtx_t *  lib,
BSL_BundleRef_t *  bundle,
const BSL_SecurityActionSet_t *  action_set 
)

◆ BSL_SecCtx_ValidatePolicyActionSet()

int BSL_SecCtx_ValidatePolicyActionSet ( BSL_LibCtx_t *  lib,
BSL_BundleRef_t *  bundle,
const BSL_SecurityActionSet_t *  action_set 
)

◆ Encode_ASB()

◆ Validate_RFC9172_Constraints_SecOper()

static bool Validate_RFC9172_Constraints_SecOper ( const BSL_BundleRef_t *  bundle,
const BSL_SecOper_t *  sec_oper 
)
static

Validate RFC 9172 constraints, common to all security contexts.

Specific checks include:

  • BCB cannot target primary block
  • BIB cannot target another BIB or BCB
  • BCB Cannot target another BCB

References BSL_BLOCK_TYPE_BCB, BSL_BLOCK_TYPE_BIB, BSL_BLOCK_TYPE_PRIMARY, BSL_BundleCtx_GetBlockMetadata(), BSL_LOG_ERR, BSL_SecOper_GetTargetBlockNum(), BSL_SecOper_IsBCB(), BSL_SecOper_IsBIB(), BSL_SecOper_IsRoleSource(), BSL_SUCCESS, and BSL_CanonicalBlock_t::type_code.

Referenced by BSL_SecCtx_ValidatePolicyActionSet().