Skip to content

Commit 7527bd5

Browse files
perryta1jeronstoneBrianSipos
authored
Checkpoint Development for Mock BPA Requirements Testing (#11)
* squash test * Added initial implementation of abstract mock bpa policy, still need better memory management * Adding more fields for policy granularity * Finished new draft of multiple mock bpa policy registrations with memory handling * tests + init json * pp conf json * ion pp * submodule updates * correct mlib ver * formatting * file as param * cleaning up json parsing, err checking * comments * more requirements tests * requirements tests progress * Adding comments for each test for clarity * keyset json * base64url -> base16 * cli option for keyset * update key json reading * keys from json * small changes to merge in * Updated policies in the requirements tests * json pp * json work? * Update for error handling of key initialization * Fix for possible memory corruption from free() * idk * Some cleanup for merging * cleaning up * PR patches * remove temp file * import star removals * Adding jansson to CI and RPM deps * Fix jansson link config, try pkg-config first * Added new front-end interface to use memory pool-type thing for policy registry * Update to fix key interface based on main * Fix to memory pool deinit and missing key ids * Bug fixes for policy location and BCB policy initialization * cleanup & fixes * param fix * fix up test fixtures * fix mock bpa issues * fix 14 test fixture * bsl_02 working; KEK decrypt fixes * pass 47, needs work on encrypt KEK * policy bits fix * init epxected no output * quickfix * Forcing bundle drop with extraneous bits * forgot to target primary block * appeasing the symbol checker * revert keywrap modification * keywrap bit * use wrapped key bit * in progress: BSL_17 * BSL17 * implement more tests * bsl33 * Fixing some formatting and clang-error spacing * Fixed mock bpa poll checking and bundle decoder error checking. Added simple start-stop test. * Fix CI prep options * Update packages.yaml * ipn change * Fixing memory issues for simple start-stop test * Fixing struct leak * Using timeout exception with assertRaises in tests, no change to logic * Fixed naming convention * move secp deinit, cleanup comments * Getting mock bpa runner to pass for merge * A more graceful way of getting mock bpa test runner to pass * retrigger checks * Temporary shim to get runner checks passing * Format checker changes * Trying again to make format checker happy * Fixing doxygen tree structure (broken by license markings) * remove assert --------- Co-authored-by: Joshua Stone <joshua.stone@jhuapl.edu> Co-authored-by: Brian Sipos <brian.sipos@jhuapl.edu>
1 parent c9cc9d4 commit 7527bd5

43 files changed

Lines changed: 2565 additions & 100 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build-test.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555
cmake ninja-build \
5656
ruby pkg-config ccache patch \
5757
${{matrix.compiler=='clang' && 'clang llvm' || 'gcc g++'}} \
58-
libssl-dev \
58+
libssl-dev libjansson-dev \
5959
valgrind gcovr xmlstarlet
6060
- name: Set up OS
6161
if: startsWith(matrix.os, 'centos')
@@ -67,7 +67,7 @@ jobs:
6767
cmake ninja-build \
6868
ruby pkg-config ccache patch \
6969
${{matrix.compiler=='clang' && 'clang llvm' || 'gcc gcc-c++'}} \
70-
openssl-devel \
70+
openssl-devel jansson-devel \
7171
valgrind xmlstarlet python3-pip
7272
pip3 install gcovr
7373
- name: Checkout repository
@@ -129,7 +129,7 @@ jobs:
129129
sudo apt-get update
130130
sudo apt-get install -y \
131131
cmake ninja-build ruby gcc g++ ccache patch \
132-
libssl-dev \
132+
libssl-dev libjansson-dev \
133133
valgrind gcovr xmlstarlet
134134
- name: Set up OS
135135
if: startsWith(matrix.os, 'centos')
@@ -140,7 +140,7 @@ jobs:
140140
git rsync \
141141
cmake ninja-build \
142142
ruby pkg-config gcc gcc-c++ ccache patch \
143-
openssl-devel \
143+
openssl-devel jansson-devel \
144144
valgrind xmlstarlet python3-pip
145145
pip3 install gcovr
146146
- name: Checkout repository

.github/workflows/codeql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
run: |
8787
sudo apt-get update && sudo apt-get install -y \
8888
cmake ninja-build ruby build-essential \
89-
libssl-dev
89+
libssl-dev libjansson-dev
9090
./build.sh deps
9191
./build.sh prep -DTEST_MEMCHECK=OFF -DTEST_COVERAGE=OFF -DBUILD_DOCS_API=OFF -DBUILD_DOCS_MAN=OFF
9292

.github/workflows/docs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
run: |
4545
sudo apt-get update && sudo apt-get install -y \
4646
cmake ninja-build ruby build-essential \
47-
libssl-dev \
47+
libssl-dev libjansson-dev \
4848
doxygen graphviz plantuml texlive texlive-latex-extra dblatex
4949
- name: Dependency build
5050
run: ./build.sh deps

.github/workflows/packages.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
dnf install -y epel-release
4343
dnf install -y \
4444
rsync cmake git ninja-build gcc ruby \
45-
openssl-devel \
45+
openssl-devel jansson-devel \
4646
doxygen graphviz plantuml texlive-bibtex \
4747
asciidoctor \
4848
rpm-build rpmlint
@@ -52,7 +52,7 @@ jobs:
5252
fetch-depth: 0
5353
submodules: recursive
5454
- name: Prep
55-
run: ./build.sh prep -DBUILD_LIB=OFF -DBUILD_TESTING=OFF -DBUILD_DOCS=OFF -DBUILD_PACKAGE=ON
55+
run: ./build.sh prep -DBUILD_LIB=OFF -DBUILD_TESTING=OFF -DBUILD_DOCS_API=OFF -DBUILD_DOCS_MAN=OFF -DBUILD_PACKAGE=ON
5656
- name: Build
5757
run: |
5858
./build.sh rpm-build

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ build
1111
testroot
1212
__pycache__
1313
/.pytest_cache/
14+
venv/
15+
mock-bpa-test/ccsds_bpsec_redbook_draft_734.5-R-2_requirements_implementation_guide.yaml

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ if(BUILD_LIB)
115115
find_package(QCBOR REQUIRED)
116116
find_package(OpenSSL REQUIRED)
117117
find_package(Threads REQUIRED)
118+
find_package(jansson REQUIRED)
118119
endif(BUILD_LIB)
119120

120121
include(CheckSymbolExists)

cmake/Findjansson.cmake

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
# Try pkg-config first
3+
pkg_search_module(JANSSON jansson IMPORTED_TARGET)
4+
if(JANSSON_FOUND)
5+
add_library(Jansson::Jansson ALIAS PkgConfig::JANSSON)
6+
endif(JANSSON_FOUND)
7+
8+
# Fall-back to manual
9+
if(NOT JANSSON_FOUND)
10+
find_path(JANSSON_HEADER NAMES jansson.h REQUIRED)
11+
find_library(JANSSON_LIB NAMES jansson REQUIRED)
12+
13+
add_library(Jansson::Jansson SHARED IMPORTED)
14+
set_target_properties(Jansson::Jansson PROPERTIES
15+
INTERFACE_INCLUDE_DIRECTORIES "${JANSSON_HEADER}"
16+
IMPORTED_LOCATION "${JANSSON_LIB}"
17+
)
18+
endif(NOT JANSSON_FOUND)

docs/CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ Institute of Technology, sponsored by the United States Government under
1919
the prime contract 80NM0018D0004 between the Caltech and NASA under
2020
subcontract 1700763.
2121
]]
22-
#message(${BUILD_DOCS_API})
23-
#add_subdirectory(api)
22+
2423
if(BUILD_DOCS_API)
2524
add_subdirectory(api)
2625
endif(BUILD_DOCS_API)

docs/api/CMakeLists.txt

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,27 @@ the prime contract 80NM0018D0004 between the Caltech and NASA under
2020
subcontract 1700763.
2121
]]
2222
find_package(Doxygen REQUIRED)
23-
find_program(MAKE_EXECUTABLE make REQUIRED)
23+
24+
find_program(MAKE_EXECUTABLE make)
2425
message(STATUS "Found make at ${MAKE_EXECUTABLE}")
2526
find_program(DBLATEX_EXECUTABLE dblatex)
27+
message(STATUS "Found dblatex at ${DBLATEX_EXECUTABLE}")
28+
find_file(
29+
PLANTUML_JAR
30+
NAMES plantuml.jar
31+
PATH_SUFFIXES "share/java" "share/plantuml"
32+
)
33+
if(PLANTUML_JAR)
34+
message(STATUS "Found plantuml at ${PLANTUML_JAR}")
35+
endif(PLANTUML_JAR)
2636

2737
configure_file(Doxyfile.in Doxyfile @ONLY)
2838

29-
add_custom_command(
30-
OUTPUT
39+
add_custom_target(
40+
docs-api-html
41+
BYPRODUCTS
3142
${CMAKE_CURRENT_BINARY_DIR}/html/index.html
3243
${CMAKE_CURRENT_BINARY_DIR}/latex/refman.tex
33-
BYPRODUCTS
3444
${CMAKE_CURRENT_BINARY_DIR}/latex/Makefile
3545
DEPENDS
3646
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
@@ -41,26 +51,6 @@ add_custom_command(
4151
COMMENT "Generating API documentation with Doxygen"
4252
USES_TERMINAL
4353
)
44-
45-
add_custom_command(
46-
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.pdf
47-
DEPENDS
48-
${CMAKE_CURRENT_BINARY_DIR}/latex/Makefile
49-
${CMAKE_CURRENT_BINARY_DIR}/latex/refman.tex
50-
COMMAND ${MAKE_EXECUTABLE}
51-
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/latex
52-
COMMENT "Generating API documentation PDF"
53-
)
54-
55-
add_custom_target(
56-
docs-api-html
57-
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/html/index.html
58-
)
59-
add_custom_target(
60-
docs-api-pdf
61-
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/latex/refman.pdf
62-
)
63-
6454
include(GNUInstallDirs)
6555
install(
6656
FILES
@@ -73,12 +63,24 @@ install(
7363
TYPE DOC
7464
COMPONENT docs-api
7565
)
76-
if(DBLATEX_EXECUTABLE)
77-
install(
78-
FILES
79-
${CMAKE_CURRENT_BINARY_DIR}/latex/refman.pdf
80-
TYPE DOC
81-
RENAME "BSL-API.pdf"
82-
COMPONENT docs-api
83-
)
84-
endif(DBLATEX_EXECUTABLE)
66+
67+
if(MAKE_EXECUTABLE AND DBLATEX_EXECUTABLE)
68+
add_custom_target(
69+
docs-api-pdf
70+
BYPRODUCTS
71+
${CMAKE_CURRENT_BINARY_DIR}/latex/refman.pdf
72+
DEPENDS
73+
${CMAKE_CURRENT_BINARY_DIR}/latex/Makefile
74+
${CMAKE_CURRENT_BINARY_DIR}/latex/refman.tex
75+
COMMAND ${MAKE_EXECUTABLE}
76+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/latex
77+
COMMENT "Generating API documentation PDF"
78+
)
79+
install(
80+
FILES
81+
${CMAKE_CURRENT_BINARY_DIR}/latex/refman.pdf
82+
TYPE DOC
83+
RENAME "${PROJECT_NAME}-api.pdf"
84+
COMPONENT docs-api
85+
)
86+
endif(MAKE_EXECUTABLE AND DBLATEX_EXECUTABLE)

docs/api/Developer_Guide.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
@page Developer_Guide Developer Guide
12
<!--
23
Copyright (c) 2025 The Johns Hopkins University Applied Physics
34
Laboratory LLC.
@@ -20,8 +21,6 @@ the prime contract 80NM0018D0004 between the Caltech and NASA under
2021
subcontract 1700763.
2122
-->
2223

23-
# Developer Guide
24-
2524
This page covers information for **Backend Developers**, or more specifically those who may be implementing a BPSec backend, or a new Security Context or Policy Provider.
2625

2726
This page contains conventions necessary for BSL developers and helpful for BSL users to understand.

0 commit comments

Comments
 (0)