BSL v1.0.0 - 16.g9d98179
AMMOS Bundle Protocol Security Library (BSL)
Loading...
Searching...
No Matches
SecOutcome.c File Reference
#include <BPSecLib_Private.h>
#include "AbsSecBlock.h"
#include "SecOutcome.h"
+ Include dependency graph for SecOutcome.c:

Functions

size_t BSL_SecOutcome_Sizeof (void)
 Returns the size of the BSL_SecOutcome_s structure.
 
void BSL_SecOutcome_Init (BSL_SecOutcome_t *self, const BSL_SecOper_t *sec_oper, size_t allocation_size)
 Populate a pre-allocated security outcome struct.
 
void BSL_SecOutcome_Deinit (BSL_SecOutcome_t *self)
 Release any resources owned by this security outcome.
 
bool BSL_SecOutcome_IsConsistent (const BSL_SecOutcome_t *self)
 Return true if internal invariants hold.
 
void BSL_SecOutcome_AppendResult (BSL_SecOutcome_t *self, const BSL_SecResult_t *sec_result)
 Append a Security Result to this outcome.
 
size_t BSL_SecOutcome_CountResults (const BSL_SecOutcome_t *self)
 Get the number of results.
 
const BSL_SecResult_t * BSL_SecOutcome_GetResultAtIndex (const BSL_SecOutcome_t *self, size_t index)
 Get the result at index i.
 
size_t BSL_SecOutcome_CountParams (const BSL_SecOutcome_t *self)
 Returns number of parameters in this outcome.
 
const BSL_SecParam_t * BSL_SecOutcome_GetParamAt (const BSL_SecOutcome_t *self, size_t index)
 Get the security parameter from the security outcome at the provided index.
 
void BSL_SecOutcome_AppendParam (BSL_SecOutcome_t *self, const BSL_SecParam_t *param)
 Append a Security Parameter to this outcome.
 
static bool BSL_AbsSecBlock_ContainsResult (const BSL_AbsSecBlock_t *abs_sec_block, const BSL_SecResult_t *actual)
 
bool BSL_SecOutcome_IsInAbsSecBlock (const BSL_SecOutcome_t *self, const BSL_AbsSecBlock_t *abs_sec_block)
 Returns true if this (the parameters and results) is contained within the given ASK.
 

Function Documentation

◆ BSL_AbsSecBlock_ContainsResult()

static bool BSL_AbsSecBlock_ContainsResult ( const BSL_AbsSecBlock_t *  abs_sec_block,
const BSL_SecResult_t *  actual 
)
static

◆ BSL_SecOutcome_AppendParam()

void BSL_SecOutcome_AppendParam ( BSL_SecOutcome_t *  self,
const BSL_SecParam_t *  param 
)

Append a Security Parameter to this outcome.

Todo:
Double-check copy semantics.
Parameters
[in,out]selfNon-NULL pointer to this security outcome.
[in]paramNon-NULL pointer to security parameter to copy and append.

References ASSERT_POSTCONDITION, ASSERT_PRECONDITION, BSL_SecOutcome_IsConsistent(), and BSL_SecParam_IsConsistent().

Referenced by BSLX_BCB_Execute(), and BSLX_BIB_Execute().

◆ BSL_SecOutcome_AppendResult()

void BSL_SecOutcome_AppendResult ( BSL_SecOutcome_t *  self,
const BSL_SecResult_t *  sec_result 
)

Append a Security Result to this outcome.

Todo:
Double-check copy semantics.
Parameters
[in,out]selfNon-NULL pointer to this security outcome.
[in]sec_resultNon-NULL pointer to security result to copy and append.

References ASSERT_POSTCONDITION, ASSERT_PRECONDITION, BSL_SecOutcome_IsConsistent(), and BSL_SecResult_IsConsistent().

Referenced by BSLX_BCB_Execute(), and BSLX_BIB_Execute().

◆ BSL_SecOutcome_CountParams()

size_t BSL_SecOutcome_CountParams ( const BSL_SecOutcome_t *  self)

Returns number of parameters in this outcome.

Parameters
[in]selfThis outcome
Returns
Number of parameters

References ASSERT_PRECONDITION, and BSL_SecOutcome_IsConsistent().

Referenced by BSL_ExecBCBSource(), BSL_ExecBIBSource(), BSL_SecOutcome_GetParamAt(), and test_sec_source_keywrap().

◆ BSL_SecOutcome_CountResults()

size_t BSL_SecOutcome_CountResults ( const BSL_SecOutcome_t *  self)

◆ BSL_SecOutcome_Deinit()

void BSL_SecOutcome_Deinit ( BSL_SecOutcome_t *  self)

◆ BSL_SecOutcome_GetParamAt()

const BSL_SecParam_t * BSL_SecOutcome_GetParamAt ( const BSL_SecOutcome_t *  self,
size_t  index 
)

Get the security parameter from the security outcome at the provided index.

Parameters
[in]selfsecurity outcome
[in]indexindex to retrieve security parameter from
Returns
Security parameter

References ASSERT_PRECONDITION, BSL_SecOutcome_CountParams(), and BSL_SecOutcome_IsConsistent().

Referenced by BSL_ExecBCBSource(), BSL_ExecBIBSource(), and test_sec_source_keywrap().

◆ BSL_SecOutcome_GetResultAtIndex()

const BSL_SecResult_t * BSL_SecOutcome_GetResultAtIndex ( const BSL_SecOutcome_t *  self,
size_t  index 
)

Get the result at index i.

Panics if i is out of range.

Parameters
[in]selfThis outcome
[in]indexIndex in the list to retrieve
Returns
Sec Result at index

References ASSERT_PRECONDITION, BSL_SecOutcome_CountResults(), and BSL_SecOutcome_IsConsistent().

Referenced by BSL_ExecBCBSource(), BSL_ExecBIBSource(), test_RFC9173_AppendixA_Example1_BIB_Source(), test_RFC9173_AppendixA_Example2_BCB_Source(), and test_sec_source_keywrap().

◆ BSL_SecOutcome_Init()

void BSL_SecOutcome_Init ( BSL_SecOutcome_t *  self,
const BSL_SecOper_t *  sec_oper,
size_t  allocation_size 
)

Populate a pre-allocated security outcome struct.

Parameters
[in,out]selfNon-Null pointer to this security outcome.
[in]sec_operSecurity operation containing the necessary info.
[in]allocation_sizeSize of working space to allocate.

References ASSERT_ARG_EXPR, ASSERT_ARG_NONNULL, ASSERT_POSTCONDITION, ASSERT_PRECONDITION, BSL_Data_InitBuffer(), BSL_SecOper_IsConsistent(), and BSL_SecOutcome_IsConsistent().

Referenced by BSL_SecCtx_ExecutePolicyActionSet(), test_RFC9173_AppendixA_Example1_BIB_Source(), test_RFC9173_AppendixA_Example2_BCB_Acceptor(), test_RFC9173_AppendixA_Example2_BCB_Source(), test_sec_accept_keyunwrap(), and test_sec_source_keywrap().

◆ BSL_SecOutcome_IsConsistent()

bool BSL_SecOutcome_IsConsistent ( const BSL_SecOutcome_t *  self)

◆ BSL_SecOutcome_IsInAbsSecBlock()

bool BSL_SecOutcome_IsInAbsSecBlock ( const BSL_SecOutcome_t *  self,
const BSL_AbsSecBlock_t *  abs_sec_block 
)

Returns true if this (the parameters and results) is contained within the given ASK.

Todo:
Can move to backend
Parameters
[in]self
[in]outcome
Returns

References ASSERT_PRECONDITION, ASSERT_PROPERTY, BSL_AbsSecBlock_ContainsResult(), BSL_AbsSecBlock_IsConsistent(), BSL_LOG_DEBUG, BSL_LOG_ERR, and BSL_SecOutcome_IsConsistent().

Referenced by BSL_ExecBIBAccept().

◆ BSL_SecOutcome_Sizeof()