32size_t BSL_SecOutcome_Sizeof(
void)
39 ASSERT_ARG_NONNULL(self);
40 ASSERT_ARG_NONNULL(sec_oper);
41 ASSERT_ARG_EXPR(allocation_size > 0);
45 memset(self, 0,
sizeof(*self));
52 ASSERT_POSTCONDITION(BSL_SecOutcome_IsConsistent(self));
57 ASSERT_PRECONDITION(BSL_SecOutcome_IsConsistent(self));
62 memset(self, 0,
sizeof(*self));
67 CHK_AS_BOOL(self != NULL);
73 const size_t result_len = BSLB_SecResultList_size(self->
result_list);
76 CHK_AS_BOOL(result_len > 0);
86 CHK_AS_BOOL(BSLB_SecParamList_size(self->
param_list) < 1000);
92 ASSERT_PRECONDITION(BSL_SecOutcome_IsConsistent(self));
95 size_t size0 = BSLB_SecResultList_size(self->
result_list);
96 BSLB_SecResultList_push_back(self->
result_list, *sec_result);
98 ASSERT_POSTCONDITION(size0 + 1 == BSLB_SecResultList_size(self->
result_list));
99 ASSERT_POSTCONDITION(BSL_SecOutcome_IsConsistent(self));
104 ASSERT_PRECONDITION(BSL_SecOutcome_IsConsistent(self));
110 ASSERT_PRECONDITION(BSL_SecOutcome_IsConsistent(self));
111 ASSERT_PRECONDITION(index < BSL_SecOutcome_CountResults(self));
113 return BSLB_SecResultList_cget(self->
result_list, index);
118 ASSERT_PRECONDITION(BSL_SecOutcome_IsConsistent(self));
120 return BSLB_SecParamList_size(self->
param_list);
125 ASSERT_PRECONDITION(BSL_SecOutcome_IsConsistent(self));
126 ASSERT_PRECONDITION(index < BSL_SecOutcome_CountParams(self));
128 return BSLB_SecParamList_cget(self->
param_list, index);
134 ASSERT_PRECONDITION(BSL_SecOutcome_IsConsistent(self));
136 size_t size0 = BSLB_SecParamList_size(self->
param_list);
137 BSLB_SecParamList_push_back(self->
param_list, *param);
139 ASSERT_POSTCONDITION(size0 + 1 == BSLB_SecParamList_size(self->
param_list));
140 ASSERT_POSTCONDITION(BSL_SecOutcome_IsConsistent(self));
149 for (
size_t index = 0; index < BSLB_SecResultList_size(abs_sec_block->results); index++)
151 BSL_SecResult_t *expected = BSLB_SecResultList_get(abs_sec_block->results, index);
152 ASSERT_PROPERTY(expected != NULL);
167 ASSERT_PRECONDITION(BSL_SecOutcome_IsConsistent(self));
170 size_t found_matches = 0;
171 size_t expected_matches = BSLB_SecResultList_size(self->
result_list);
172 if (expected_matches == 0)
177 for (
size_t result_index = 0; result_index < expected_matches; result_index++)
180 ASSERT_PROPERTY(actual_res != NULL);
181 if (BSL_AbsSecBlock_ContainsResult(abs_sec_block, actual_res))
190 BSL_LOG_DEBUG(
"Checking results: %lu expected, %lu found", expected_matches, found_matches);
191 return (expected_matches == found_matches) && (found_matches > 0);
Concrete implementation of ASB and its functionality.
Single entry-point include file for all of the BPSec Lib (BSL) frontend API.
#define BSL_LOG_DEBUG(...)
This is an overloaded member function, provided for convenience. It differs from the above function o...
struct BSL_SecOutcome_s BSL_SecOutcome_t
Represents the output following execution of a security operation.
struct BSL_AbsSecBlock_s BSL_AbsSecBlock_t
Forward declaration of BSL_AbsSecBlock_t.
#define BSL_LOG_ERR(...)
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool BSL_AbsSecBlock_IsConsistent(const BSL_AbsSecBlock_t *self)
Checks internal consistency and sanity of this structure.
void BSL_AbsSecBlock_Print(const BSL_AbsSecBlock_t *self)
Prints to LOG INFO.
bool BSL_SecOper_IsConsistent(const BSL_SecOper_t *self)
Returns true if internal consistency and sanity checks pass.
Defines the result of a security operation.
bool BSL_SecParam_IsConsistent(const BSL_SecParam_t *self)
Return true if invariant conditions pass.
bool BSL_SecResult_IsConsistent(const BSL_SecResult_t *self)
Return true when internal invariant checks pass.
int BSL_Data_Deinit(BSL_Data_t *data)
De-initialize a data struct, freeing if necessary.
int BSL_Data_InitBuffer(BSL_Data_t *data, size_t bytelen)
Initialize with an owned buffer of size bytelen.
size_t len
Size of the data buffer.
BSL_DataPtr_t ptr
Pointer to the front of the buffer.
const BSL_SecOper_t * sec_oper
Non-NULL pointer to Security Operation that provided the input.
bool is_success
Boolean indicating true when successful.
BSLB_SecResultList_t result_list
List of security results with metadata for receiver. Must be encoded into BTSD.
BSLB_SecParamList_t param_list
List of security parameters with metadata for receiver. Must be encoded into the BTSD.
BSL_Data_t allocation
Pre-allocated memory pool, lifetimes of all results and parameters are tied to this.
uint8_t _bytes[BSL_DEFAULT_BYTESTR_LEN+1]
Result as byte array, up to a given maximum.
uint64_t target_block_num
Target block id, put in here for convenience.
uint64_t result_id
Result ID, which is context depdendent, based on security context.
size_t _bytelen
Length of data (in bytes) of the contained bytestring. Always less than BSL_DEFAULT_BYTESTR_LEN.
uint64_t context_id
Context ID, put in here for convenience.