Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/BPSecLib_Private.h
Original file line number Diff line number Diff line change
Expand Up @@ -1314,7 +1314,7 @@ int BSL_PolicyRegistry_InspectActions(const BSL_LibCtx_t *bsl, BSL_SecurityActio
* @return 0 if success
*/
int BSL_PolicyRegistry_FinalizeActions(const BSL_LibCtx_t *bsl, const BSL_SecurityActionSet_t *policy_actions,
const BSL_BundleRef_t *bundle, const BSL_SecurityResponseSet_t *response_output);
BSL_BundleRef_t *bundle, const BSL_SecurityResponseSet_t *response_output);

/// @brief Callback interface to query policy provider to populate the action set
typedef int (*BSL_PolicyInspect_f)(void *user_data, BSL_SecurityActionSet_t *output_action_set,
Expand All @@ -1323,7 +1323,7 @@ typedef int (*BSL_PolicyInspect_f)(void *user_data, BSL_SecurityActionSet_t *out
/// @brief Callback interface to finalize policy provider over the action set. Finalize should ignore actions from
/// different policy providers
typedef int (*BSL_PolicyFinalize_f)(void *user_data, const BSL_SecurityActionSet_t *output_action_set,
const BSL_BundleRef_t *bundle, const BSL_SecurityResponseSet_t *response_output);
BSL_BundleRef_t *bundle, const BSL_SecurityResponseSet_t *response_output);

/// @brief Callback interface for policy provider to shut down and release any resources
typedef void (*BSL_PolicyDeinit_f)(void *user_data);
Expand Down
6 changes: 3 additions & 3 deletions src/BPSecLib_Public.h
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,8 @@ int BSL_API_RegisterPolicyProvider(BSL_LibCtx_t *lib, uint64_t pp_id, BSL_Policy
* @returns 0 on success, negative on error. On zero, `output_action_set` will be populated.
*/
BSL_REQUIRE_CHECK
int BSL_API_QuerySecurity(const BSL_LibCtx_t *bsl, BSL_SecurityActionSet_t *output_action_set,
const BSL_BundleRef_t *bundle, BSL_PolicyLocation_e location);
int BSL_API_QuerySecurity(BSL_LibCtx_t *bsl, BSL_SecurityActionSet_t *output_action_set, const BSL_BundleRef_t *bundle,
BSL_PolicyLocation_e location);

/** @brief Performs the given security operations on a Bundle, modifying or even dropping it entirely.
*
Expand All @@ -523,7 +523,7 @@ int BSL_API_QuerySecurity(const BSL_LibCtx_t *bsl, BSL_SecurityActionSet_t *outp
* @param[in] policy_actions Pointer to policy actions, which was populated using the `QuerySecurity` function.
*/
BSL_REQUIRE_CHECK
int BSL_API_ApplySecurity(const BSL_LibCtx_t *bsl, BSL_SecurityResponseSet_t *response_output, BSL_BundleRef_t *bundle,
int BSL_API_ApplySecurity(BSL_LibCtx_t *bsl, BSL_SecurityResponseSet_t *response_output, BSL_BundleRef_t *bundle,
const BSL_SecurityActionSet_t *policy_actions);

#ifdef __cplusplus
Expand Down
2 changes: 1 addition & 1 deletion src/backend/PolicyProvider.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ int BSL_PolicyRegistry_InspectActions(const BSL_LibCtx_t *bsl, BSL_SecurityActio
}

int BSL_PolicyRegistry_FinalizeActions(const BSL_LibCtx_t *bsl, const BSL_SecurityActionSet_t *policy_actions,
const BSL_BundleRef_t *bundle, const BSL_SecurityResponseSet_t *response_output)
BSL_BundleRef_t *bundle, const BSL_SecurityResponseSet_t *response_output)
{
CHK_ARG_NONNULL(bsl);
CHK_ARG_NONNULL(bsl->policy_reg);
Expand Down
12 changes: 6 additions & 6 deletions src/backend/PublicInterfaceImpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ int BSL_API_RegisterPolicyProvider(BSL_LibCtx_t *lib, uint64_t pp_id, BSL_Policy
return BSL_SUCCESS;
}

int BSL_API_QuerySecurity(const BSL_LibCtx_t *bsl, BSL_SecurityActionSet_t *output_action_set,
const BSL_BundleRef_t *bundle, BSL_PolicyLocation_e location)
int BSL_API_QuerySecurity(BSL_LibCtx_t *bsl, BSL_SecurityActionSet_t *output_action_set, const BSL_BundleRef_t *bundle,
BSL_PolicyLocation_e location)
{
CHK_ARG_NONNULL(bsl);
CHK_ARG_NONNULL(output_action_set);
Expand All @@ -146,7 +146,7 @@ int BSL_API_QuerySecurity(const BSL_LibCtx_t *bsl, BSL_SecurityActionSet_t *outp
int query_status = BSL_PolicyRegistry_InspectActions(bsl, output_action_set, bundle, location);
BSL_LOG_INFO("Completed query: status=%d", query_status);

BSL_TlmCounters_IncrementCounter((BSL_LibCtx_t *)bsl, BSL_TLM_BUNDLE_INSPECTED_COUNT, 1);
BSL_TlmCounters_IncrementCounter(bsl, BSL_TLM_BUNDLE_INSPECTED_COUNT, 1);

// Here - find the sec block numbers for all ASBs

Expand Down Expand Up @@ -214,7 +214,7 @@ int BSL_API_QuerySecurity(const BSL_LibCtx_t *bsl, BSL_SecurityActionSet_t *outp
}
BSL_PrimaryBlock_deinit(&primary_block);

if (BSL_SecCtx_ValidatePolicyActionSet((BSL_LibCtx_t *)bsl, bundle, output_action_set) == false)
if (BSL_SecCtx_ValidatePolicyActionSet(bsl, bundle, output_action_set) == false)
{
query_status = BSL_ERR_SECURITY_CONTEXT_VALIDATION_FAILED;
BSL_LOG_WARNING("Security Context validation failed");
Expand All @@ -223,7 +223,7 @@ int BSL_API_QuerySecurity(const BSL_LibCtx_t *bsl, BSL_SecurityActionSet_t *outp
return query_status;
}

int BSL_API_ApplySecurity(const BSL_LibCtx_t *bsl, BSL_SecurityResponseSet_t *response_output, BSL_BundleRef_t *bundle,
int BSL_API_ApplySecurity(BSL_LibCtx_t *bsl, BSL_SecurityResponseSet_t *response_output, BSL_BundleRef_t *bundle,
const BSL_SecurityActionSet_t *policy_actions)
{
CHK_ARG_NONNULL(bsl);
Expand All @@ -233,7 +233,7 @@ int BSL_API_ApplySecurity(const BSL_LibCtx_t *bsl, BSL_SecurityResponseSet_t *re

BSL_SecurityResponseSet_Init(response_output);

int exec_code = BSL_SecCtx_ExecutePolicyActionSet((BSL_LibCtx_t *)bsl, response_output, bundle, policy_actions);
int exec_code = BSL_SecCtx_ExecutePolicyActionSet(bsl, response_output, bundle, policy_actions);
if (exec_code < BSL_SUCCESS)
{
BSL_LOG_ERR("Failed to execute policy action set");
Expand Down
4 changes: 2 additions & 2 deletions src/policy_provider/SamplePolicyProvider.c
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ int BSLP_QueryPolicy(void *user_data, BSL_SecurityActionSet_t *output_action_set
}

int BSLP_FinalizePolicy(void *user_data _U_, const BSL_SecurityActionSet_t *output_action_set _U_,
const BSL_BundleRef_t *bundle, const BSL_SecurityResponseSet_t *response_output _U_)
BSL_BundleRef_t *bundle, const BSL_SecurityResponseSet_t *response_output _U_)
{
int error_ret = BSL_SUCCESS;
BSLP_PolicyProvider_t *self = user_data;
Expand Down Expand Up @@ -355,7 +355,7 @@ int BSLP_FinalizePolicy(void *user_data _U_, const BSL_SecurityActionSet_t *outp

if (conclusion != BSL_SECOP_CONCLUSION_SUCCESS)
{
error_ret = BSLP_PolicyProvider_HandleFailures((BSL_BundleRef_t *)bundle, secop);
error_ret = BSLP_PolicyProvider_HandleFailures(bundle, secop);
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/policy_provider/SamplePolicyProvider.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,12 @@ int BSLP_PolicyRule_EvaluateAsSecOper(const BSLP_PolicyRule_t *self, const BSLP_
BSL_SecOper_t *sec_oper, const BSL_BundleRef_t *bundle,
BSL_PolicyLocation_e location);

/// Provides ::BSL_PolicyInspect_f
int BSLP_QueryPolicy(void *user_data, BSL_SecurityActionSet_t *output_action_set, const BSL_BundleRef_t *bundle,
BSL_PolicyLocation_e location);

int BSLP_FinalizePolicy(void *user_data, const BSL_SecurityActionSet_t *output_action_set,
const BSL_BundleRef_t *bundle, const BSL_SecurityResponseSet_t *response_output);
/// Provides ::BSL_PolicyFinalize_f
int BSLP_FinalizePolicy(void *user_data, const BSL_SecurityActionSet_t *output_action_set, BSL_BundleRef_t *bundle,
const BSL_SecurityResponseSet_t *response_output);

#endif // BSLP_SAMPLE_POLICY_PROVIDER_H
2 changes: 1 addition & 1 deletion src/security_context/BCB_AES_GCM.c
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ int BSLX_BCB_Execute(BSL_LibCtx_t *lib _U_, BSL_BundleRef_t *bundle, const BSL_S
bcb_context.overwrite_btsd = BSL_SecOper_IsRoleAcceptor(sec_oper);

// Select whether to call the encrypt or decrypt function
int (*crypto_fn)(BSLX_BCB_t *) = BSL_SecOper_IsRoleSource(sec_oper) ? BSLX_BCB_Encrypt : BSLX_BCB_Decrypt;
int (*crypto_fn)(BSLX_BCB_t *) = BSL_SecOper_IsRoleSource(sec_oper) ? &BSLX_BCB_Encrypt : &BSLX_BCB_Decrypt;

// Perform the encryption/decryption
if (BSL_SUCCESS != crypto_fn(&bcb_context))
Expand Down
Loading