Skip to content

Commit 837d9cd

Browse files
authored
Align product guide (#32)
* Separating RPM build steps cleanly * Fixing BSL-SIS page name * More improvements to API docs to align with actual architecture and user needs * Cleaning up prep CMake options to avoid duplication * Aligning diagram with user guide * Address comment about example PPs
1 parent 65a60c3 commit 837d9cd

20 files changed

Lines changed: 367 additions & 164 deletions

.github/workflows/docs.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ jobs:
5353
- name: Dependency build
5454
run: ./build.sh deps
5555
- name: Prep
56-
run: ./build.sh prep -DBUILD_TESTING=OFF -DTEST_MEMCHECK=OFF -DTEST_COVERAGE=OFF -DBUILD_DOCS_API=ON
56+
run: >
57+
./build.sh prep
58+
-DBUILD_TESTING=OFF -DTEST_MEMCHECK=OFF -DTEST_COVERAGE=OFF
59+
-DBUILD_DOCS_API=ON
5760
- name: Build
5861
run: |
5962
./build.sh --target docs-api-html docs-api-pdf docs-api-misspelling

.github/workflows/packages.yaml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,12 @@ jobs:
5252
fetch-depth: 0
5353
submodules: recursive
5454
- name: Prep
55-
run: ./build.sh prep -DBUILD_LIB=OFF -DBUILD_TESTING=OFF -DBUILD_DOCS_API=OFF -DBUILD_DOCS_MAN=OFF -DBUILD_PACKAGE=ON
55+
run: ./build.sh rpm-prep
5656
- name: Build
57-
run: |
58-
./build.sh rpm-build
59-
- name: rpmlint Results
57+
run: ./build.sh rpm-build
58+
- name: Check
59+
run: ./build.sh rpm-check
60+
- name: Summarize Results
6061
if: always()
6162
run: |
6263
echo "## rpmlint results:" >> $GITHUB_STEP_SUMMARY

CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ cmake_minimum_required(VERSION 3.10)
2323

2424
option(BUILD_LIB "Build the library itself" ON)
2525
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
26-
option(BUILD_DOCS_API "Enable API documentation building" OFF)
26+
option(BUILD_DOCS_API "Enable API documentation building" ON)
2727
option(BUILD_DOCS_MAN "Enable manpage building" OFF)
28-
option(BUILD_TESTING "Enable building unit tests" OFF)
29-
option(TEST_MEMCHECK "Enable test runtime memory checking" OFF)
30-
option(TEST_COVERAGE "Enable test runtime coverage logging" OFF)
28+
option(BUILD_TESTING "Enable building unit tests" ON)
29+
option(TEST_MEMCHECK "Enable test runtime memory checking" ON)
30+
option(TEST_COVERAGE "Enable test runtime coverage logging" ON)
3131
option(BUILD_PACKAGE "Enable building package outputs" OFF)
3232

3333
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

build.sh

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ function usage {
4444
echo " install - Install"
4545
echo " lint - Run clang-tidy code linter"
4646
echo " prep [args...] - Generate makefiles with config options"
47-
echo " rpm-build - Build RPM package"
48-
echo " rpm-container - Build as RPM package inside container"
47+
echo " rpm-prep - Prepare for RPM package building"
48+
echo " rpm-build - Build RPM package after rpm-prep"
49+
echo " rpm-check - Check RPM packages after rpm-build"
50+
echo " rpm-container - Build and check RPM packages inside container"
4951
echo " run [args...] - Run a command with the environment vars"
5052
}
5153

@@ -96,12 +98,20 @@ function cmd_prep {
9698
./resources/prep.sh "$@"
9799
}
98100

101+
function cmd_rpm_prep {
102+
if ! git describe 2>/dev/null >/dev/null
103+
then
104+
git config --global --add safe.directory ${PWD}
105+
fi
106+
./resources/prep.sh -DBUILD_LIB=OFF -DBUILD_TESTING=OFF -DBUILD_DOCS_API=OFF -DBUILD_DOCS_MAN=OFF -DBUILD_PACKAGE=ON
107+
}
108+
99109
function cmd_rpm_build {
100-
git config --global --add safe.directory ${PWD}
101-
./resources/prep.sh -DBUILD_LIB=NO -DBUILD_TESTING=NO -DBUILD_PACKAGE=YES
102110
cmake --build build/default --target package_srpm
103111
cmake --build build/default --target package_rpm
112+
}
104113

114+
function cmd_rpm_check {
105115
# Package scanning
106116
cd build/default/pkg/rpmbuild
107117
for PKG in RPMS/x86_64/*.rpm
@@ -202,9 +212,15 @@ case "$1" in
202212
prep)
203213
cmd_prep "$@"
204214
;;
215+
rpm-prep)
216+
cmd_rpm_prep
217+
;;
205218
rpm-build)
206219
cmd_rpm_build
207220
;;
221+
rpm-check)
222+
cmd_rpm_check
223+
;;
208224
rpm-container)
209225
cmd_rpm_container
210226
;;
Lines changed: 43 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@page userguide User Guide (BPA Developer)
1+
@mainpage Introduction
22
<!--
33
Copyright (c) 2025 The Johns Hopkins University Applied Physics
44
Laboratory LLC.
@@ -21,22 +21,20 @@ the prime contract 80NM0018D0004 between the Caltech and NASA under
2121
subcontract 1700763.
2222
-->
2323

24-
This page covers the using BPSecLib from the perspective of the **Application Programmer**, or more specifically, the BPA developer.
24+
This documentation is for the detailed BPSec Library (BSL) application programming interface (API) in the C language.
25+
This is an implementation of RFC 9172 @cite rfc9172 functionality and RFC 9173 @cite rfc9173 default security contexts.
2526

26-
# BPA Interaction
27+
For details about installation, maintenance, and compile-time use of the BSL, see the _BSL Product Guide_ @cite bsl_prod_guide.
28+
For details about higher-level run-time use patterns, see the _BSL User Guide_ @cite bsl_user_guide.
2729

28-
- Notes.
29-
30-
---
31-
32-
This page discusses information about the structure of the BSL but not its actual APIs.
33-
34-
# Library Architecture
30+
# Library Architecture {#bsl-arch}
3531

3632
The BSL as a whole is separated into two primary layers of implementation: an API-centric abstract _Frontend_ library and a host-binding concrete _Backend_ library.
3733

38-
The Frontend library provides the service API for the BSL to be called by its associated BPA as needed and for stable public APIs used by Policy Provider implementations and Security Context implementations.
39-
The Backend library implements forward-declared structs and functions from the Frontend using specific concrete data containers, algorithms, etc.
34+
The Frontend library provides the service API for the BSL to be called by its associated [BPA integration](@ref bpa-integrators) and for stable public APIs used by [Policy Provider implementations](@ref policy-providers) and [Security Context implementations](@ref security-contexts).
35+
The Backend library implements forward-declared structs and functions from the Frontend using specific concrete data containers, algorithms, _etc._
36+
37+
The BSL source repository also contains @ref example-pps and @ref example-default-scs to actually exercise the BSL during testing, and a @ref mock-bpa which allows as-built integration testing of the BSL using a pseudo-daemon process.
4038

4139
@dot
4240
digraph example {
@@ -71,4 +69,37 @@ The BSL is written for the C99 language @cite ISO:9899:1999 excluding any compil
7169

7270
The Dynamic Backend relies on the POSIX.1-2008 @cite IEEE:1003.1-2008 standard for operating system abstraction, and M*LIB @cite lib:mlib for heap-allocated data containers.
7371

72+
The example default security contexts use the OpenSSL library @cite lib:openssl for all cryptographic functions, including random number generation.
73+
This allows these security contexts to be FIPS-140 @cite NIST:FIPS-140-3 compliant.
74+
7475
BSL unit tests use the Unity library @cite lib:unity for test execution and assertions.
76+
77+
78+
@defgroup frontend Frontend
79+
@brief Files in the Frontend library of the BSL.
80+
81+
This provides the abstract APIs used for the BSL service interface and APIs used by Policy Provider implementations and Security Context implementations.
82+
83+
84+
@defgroup backend_dyn Dynamic Backend
85+
@brief Files in the Dynamic Backend library of the BSL.
86+
87+
This is the concrete implementation of a backend using dynamic heap-allocated containers and registries.
88+
It uses POSIX APIs to provide necessary Host functions for the BSL, and OpenSSL APIs to provide crypto functions for the BSL.
89+
90+
91+
@defgroup example_pp Example Policy Provider
92+
@brief Implementation of a simple rule-based policy provider.
93+
94+
This group contains files used by the Example Policy Provider library included with the BSL.
95+
96+
97+
@defgroup example_security_context Default Security Contexts
98+
@brief Implementation of the default security contexts using the BSL crypto API.
99+
100+
This group contains files used by the Default Security Contexts library included with the BSL.
101+
102+
@defgroup mock_bpa Example/Mock BP Agent
103+
@brief Files used in the Mock BPA used for testing.
104+
105+
The Mock BPA performs whole-bundle encoding and decoding (CODEC) functions, but no other stateful bundle processing.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@page BSL Interface Specification
1+
@page bsl-sis BSL Interface Specification (SIS)
22
<!--
33
Copyright (c) 2025 The Johns Hopkins University Applied Physics
44
Laboratory LLC.
@@ -22,7 +22,7 @@ subcontract 1700763.
2222
-->
2323
This document functions as the AMMOS MiMTAR required interface specification.
2424

25-
Bundle Protocol Security Library (BPSec Lib) Software Interface Specification
25+
Bundle Protocol Security Library (BPSec Lib) Software Interface Specification (SIS)
2626
=============================================================================
2727

2828
***Prepared By: The Johns Hopkins University Applied Physics Laboratory (JHU/APL)***
@@ -46,7 +46,7 @@ Bundle Protocol Security Library (BPSec Lib) Software Interface Specification
4646
| Configuration ID (CI) | 681.2 |
4747
| Element | Multi-Mission Control System (MMCS) |
4848
| Program Set | Bundle Protocol Security (BPSec) |
49-
| Version | 0.0 |
49+
| Version | 1.0 |
5050

5151
## 1.2: Purpose
5252

docs/api/02-bpa-integrators.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
@page bpa-integrators BPA Integrator Topics
2+
<!--
3+
Copyright (c) 2025 The Johns Hopkins University Applied Physics
4+
Laboratory LLC.
5+
6+
This file is part of the Bundle Protocol Security Library (BSL).
7+
8+
Licensed under the Apache License, Version 2.0 (the "License");
9+
you may not use this file except in compliance with the License.
10+
You may obtain a copy of the License at
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
18+
This work was performed for the Jet Propulsion Laboratory, California
19+
Institute of Technology, sponsored by the United States Government under
20+
the prime contract 80NM0018D0004 between the Caltech and NASA under
21+
subcontract 1700763.
22+
-->
23+
24+
This page covers the using BSL from the perspective of a BPA developer integrating the BSL through its _service interface_.
25+
26+
# BPA--BSL Interactions
27+
28+
A BPA interacts with the BSL through two distinct interfaces:
29+
30+
* A **[service interface](@ref bsl-service-api)** provided by the BSL, which is called by the BPA when security processing of a bundle is needed
31+
* A **[callback interface](@ref bpa-callback-api)** provided by the BPA
32+
33+
@dot "BPA--BSL Interfaces" width=500pt
34+
digraph bpa_interfaces {
35+
rankdir=TB;
36+
node [shape=record, fontname=Helvetica, fontsize=12];
37+
38+
bpa [ label="BPA" ];
39+
bsl [ label="BSL" ];
40+
41+
bpa -> bsl [ xlabel="BSL Service API" ];
42+
bsl -> bpa [ xlabel="BPA Callback API" ];
43+
}
44+
@enddot
45+
46+
# BSL Service API {#bsl-service-api}
47+
48+
Each runtime instance of the BSL is isolated for thread safety within a host-specific struct referenced by a [BSL_LibCtx_t](@ref BSL_LibCtx_s) pointer.
49+
50+
The runtime instance is used by the BPA via the BSL _service interface_ to process bundles at each of the following four security interaction points within the BPA's bundle workflow.
51+
When invoked from the BPA, all BSL activities will occur within the context of a single bundle which is referenced by a ::BSL_BundleRef_t pointer.
52+
53+
Details of how the BSL processing order relates to other BPA processing of bundles along the BPA's workflow are left to the BPA integration.
54+
55+
* After bundle **transmission** from an application source, indicated by ::BSL_POLICYLOCATION_APPIN
56+
* Before bundle **delivery** to an application destination, indicated by ::BSL_POLICYLOCATION_APPOUT
57+
* After bundle **reception** via a CLA, indicated by ::BSL_POLICYLOCATION_CLIN
58+
* Before bundle **forwarding** via a CLA, indicated by ::BSL_POLICYLOCATION_CLOUT
59+
60+
These are shown for a notional BPA in the diagram below, where each edge indicates one of the four interaction points listed above.
61+
62+
@dot "BPA Interaction Points" width=500pt
63+
digraph bpa_interaction {
64+
rankdir=LR;
65+
node [shape=record, fontname=Helvetica, fontsize=12];
66+
67+
process [ label="Bundle Dispatch\nand Forwarding" ];
68+
appin [ label="Application\nTransmission" ];
69+
appout [ label="Application\nDelivery" ];
70+
clin [ label="CLA\nReception" ];
71+
clout [ label="CLA\nForwarding" ];
72+
73+
appin -> process [ label="BSL Call\n(APPIN)" ];
74+
process -> appout [ label="BSL Call\n(APPOUT)" ];
75+
clin -> process [ label="BSL Call\n(CLIN)" ];
76+
process -> clout [ label="BSL Call\n(CLOUT)" ];
77+
}
78+
@enddot
79+
80+
# BPA Callback API {#bpa-callback-api}
81+
82+
Separate from the API used to call into the BSL to initiate security processing, the BSL relies on specific functions provided by the BPA to do its normal processing.
83+
Some of these functions are for introspecting and manipulating specific bundle or block contents, others are for encoding and decoding EID and EID Pattern values.
84+
85+
The BSL dynamic backend declares a set of functions which are delegated to the BPA, which are registered in the dynamic backend using the ::BSL_HostDescriptors_t struct and the BSL_HostDescriptors_Set() function.

docs/api/03-policy-providers.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@page policy-providers Policy Provider Topics
2+
<!--
3+
Copyright (c) 2025 The Johns Hopkins University Applied Physics
4+
Laboratory LLC.
5+
6+
This file is part of the Bundle Protocol Security Library (BSL).
7+
8+
Licensed under the Apache License, Version 2.0 (the "License");
9+
you may not use this file except in compliance with the License.
10+
You may obtain a copy of the License at
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
18+
This work was performed for the Jet Propulsion Laboratory, California
19+
Institute of Technology, sponsored by the United States Government under
20+
the prime contract 80NM0018D0004 between the Caltech and NASA under
21+
subcontract 1700763.
22+
-->
23+
24+
This page covers the using BSL from the perspective of a developer of a new Policy Provider (PP) for the BSL.
25+
26+
# Policy Provider Callback API {#pp-callback-api}
27+
28+
The BSL dynamic backend declares a set of functions which are delegated to each PP instance and are registered in the backend using the [BSL_PolicyDesc_t](@ref BSL_PolicyDesc_s).
29+
These functions include some bookkeeping of the PP instance itself (associated user data and deinit function).
30+
31+
The operational focus of the PP callbacks are functions used by the BSL to:
32+
* **Inspect** the contents of a bundle and determine if any security operations need to be performed (as BSL_PolicyDesc_s::query_fn).
33+
This will likely involve introspecting block-level and field-level data from the bundle via the @ref bpa-callback-api.
34+
* **Finalize** (handle the conclusion of) any requested security operations (as BSL_PolicyDesc_s::finalize_fn).
35+
This will likely involve bundle or block manipulation depending upon the success or failure of the operation to execute (by its associated [Security Context](@ref sc-callback-api).

docs/api/03-security-contexts.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
@page security-contexts Security Context Topics
2+
<!--
3+
Copyright (c) 2025 The Johns Hopkins University Applied Physics
4+
Laboratory LLC.
5+
6+
This file is part of the Bundle Protocol Security Library (BSL).
7+
8+
Licensed under the Apache License, Version 2.0 (the "License");
9+
you may not use this file except in compliance with the License.
10+
You may obtain a copy of the License at
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
18+
This work was performed for the Jet Propulsion Laboratory, California
19+
Institute of Technology, sponsored by the United States Government under
20+
the prime contract 80NM0018D0004 between the Caltech and NASA under
21+
subcontract 1700763.
22+
-->
23+
24+
This page covers the using BSL from the perspective of a developer of a new Security Context (SC) for the BSL.
25+
26+
# Security Context Callback API {#sc-callback-api}
27+
28+
The BSL dynamic backend declares a set of functions which are delegated to each SC instance and are registered in the backend using the [BSL_SecCtxDesc_t](@ref BSL_SecCtxDesc_s).
29+
These functions include some bookkeeping of the SC instance itself (associated user data and deinit function).
30+
31+
The operational focus of the SC callbacks are functions used by the BSL to:
32+
* **Validate** the options for a specific security operation associated with the SC (as BSL_SecCtxDesc_s::validate).
33+
* **Execute** a specific security operation associated with the SC (as BSL_SecCtxDesc_s::execute).

0 commit comments

Comments
 (0)