BSL v0.0.0 - 0.geda3e66
AMMOS Bundle Protocol Security Library (BSL)
Loading...
Searching...
No Matches
test_SamplePolicyProvider.c File Reference

Specific low-level tests of the Sample Policy Provider. More...

#include <unity.h>
#include <BPSecLib_Private.h>
#include <mock_bpa/MockBPA.h>
#include "bsl_test_utils.h"
#include <policy_provider/SamplePolicyProvider.h>
+ Include dependency graph for test_SamplePolicyProvider.c:

Functions

void setUp (void)
 
void tearDown (void)
 
void test_SamplePolicyProvider_WildcardPolicyRuleVerifiesBIB (void)
 Creates a rule: At location "APPIN", Bundles FROM anywhere, Bundles TO anywhere, must contain a BIB block covering the payload.
 

Variables

static BSL_TestContext_t LocalTestCtx
 

Detailed Description

Specific low-level tests of the Sample Policy Provider.

Notes:

Function Documentation

◆ test_SamplePolicyProvider_WildcardPolicyRuleVerifiesBIB()

void test_SamplePolicyProvider_WildcardPolicyRuleVerifiesBIB ( void  )

Creates a rule: At location "APPIN", Bundles FROM anywhere, Bundles TO anywhere, must contain a BIB block covering the payload.

Purpose: Exercise the Rule and Predicate primitives to for BIB in a given bundle

Steps:

  • Use an example Bundle with primary, payload, and BIB block over the payload (From RFC9173)
  • Create a predicate to match any bundle using wildcards (at location APPIN)
  • Create a rule to verify a BIB covers the payload block for any Bundle matching the predicate.
  • Use this to create a Security Operation for verifying the BIB
  • Check that the Security Operation has an ID=2 and targets the payload block (1)

Notes:

  • Common repeated patterns are in the process of being factored out
  • All values are drawn from RFC9173 Appendix A.

References BSL_BLOCK_TYPE_PAYLOAD, BSL_POLICYACTION_DROP_BUNDLE, BSL_POLICYLOCATION_APPIN, BSL_SECBLOCKTYPE_BIB, BSL_SecOper_Init(), BSL_SecOper_IsBIB(), BSL_SECROLE_VERIFIER, BSLP_PolicyPredicate_Init(), BSLP_PolicyRule_Deinit(), BSLP_PolicyRule_EvaluateAsSecOper(), BSLP_PolicyRule_Init(), and mock_bpa_ctr_t::bundle_ref.