Skip to content

Commit 7312f97

Browse files
authored
Use base64 decoder for JWT (#51)
* File and symbol name alignments * Add base64 codecs * Use base64 decoder for JWT * Add coverage summary script for CI
1 parent c036eeb commit 7312f97

46 files changed

Lines changed: 1366 additions & 177 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: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,7 @@ jobs:
106106
name: ${{github.job}}-${{matrix.os}}-${{matrix.compiler}}-coverage
107107
path: build/default/coverage*
108108
- name: Report coverage
109-
run: |
110-
SRC_COV_PERC=$(xmlstarlet sel -t -v 'floor(/coverage/packages/package[@name="src"]/@line-rate * 100)' -n build/default/coverage-xml.xml)
111-
echo "Source coverage: ${SRC_COV_PERC}%" >> $GITHUB_STEP_SUMMARY
109+
run: ./build.sh coverage-summary >> $GITHUB_STEP_SUMMARY
112110

113111
mock-bpa-test:
114112
strategy:
@@ -178,6 +176,4 @@ jobs:
178176
name: ${{github.job}}-${{matrix.os}}-gcc-coverage
179177
path: build/default/coverage*
180178
- name: Report coverage
181-
run: |
182-
SRC_COV_PERC=$(xmlstarlet sel -t -v 'floor(/coverage/packages/package[@name="src"]/@line-rate * 100)' -n build/default/coverage-xml.xml)
183-
echo "Source coverage: ${SRC_COV_PERC}%" >> $GITHUB_STEP_SUMMARY
179+
run: ./build.sh coverage-summary >> $GITHUB_STEP_SUMMARY

build.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ function cmd_coverage {
7575
cmake --build ${BUILDDIR} -j1 --target \
7676
coverage-html coverage-xml
7777
}
78+
function cmd_coverage_summary {
79+
for DIRNAME in backend crypto policy_provider security_context mock_bpa
80+
do
81+
COV_XPATH="format-number(/coverage/packages/package[@name='src.${DIRNAME}']/@line-rate * 100, '#.0')"
82+
COV_PERC=$(xmlstarlet sel -t -v "${COV_XPATH}" -n build/default/coverage-xml.xml 2>/dev/null)
83+
echo "Source ${DIRNAME} coverage: ${COV_PERC}%"
84+
done
85+
}
7886

7987
function cmd_deps {
8088
./resources/deps.sh
@@ -194,6 +202,9 @@ case "$1" in
194202
coverage)
195203
cmd_coverage
196204
;;
205+
coverage-summary)
206+
cmd_coverage_summary
207+
;;
197208
deps)
198209
cmd_deps
199210
;;

docs/api/10-bsl-developers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ DICT_DEF2(BSL_SecCtxDict, uint64_t, M_BASIC_OPLIST, BSL_SecCtxDesc_t, M_POD_OPLI
128128

129129
## Citations and References
130130

131-
For definitions from rfc's and other sources, `@cite [source]` in the Doxygen header.
131+
For definitions from IETF RFCs and other sources, `@cite [source]` in the Doxygen header.
132132
If possible (e.g. for RFCs) include the document number in the text for convenience, as in ```RFC XXXX @cite rfcXXXX```.
133133

134134
# File Naming

docs/api/dictionary.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@ backends
2222
Backends
2323
BCB
2424
BCBs
25+
Berners
2526
BIB's
27+
Birkholz
2628
Birrane
2729
Bitwise
30+
Bormann
2831
bpa
2932
BPA's
3033
BPSec
@@ -33,6 +36,7 @@ BPv
3336
BSL
3437
BSLs
3538
BSLX
39+
bstr
3640
BTSD
3741
BundleCtx
3842
Burleigh
@@ -42,10 +46,12 @@ bytestream
4246
bytestring
4347
bytestrings
4448
callee's
49+
Carsten
4550
CBOR
4651
cek
4752
centric
4853
CFE
54+
Christoph
4955
ciphertext
5056
CLA
5157
clin
@@ -90,6 +96,7 @@ frontend
9096
Frontend
9197
GCM
9298
Heiner
99+
Henk
93100
hmac
94101
html
95102
IANA
@@ -102,6 +109,7 @@ ipn
102109
IPN
103110
IPPT
104111
IsInt
112+
isspace
105113
JHU
106114
Josefsson
107115
JPL
@@ -113,6 +121,7 @@ lifecycle
113121
Lifecycles
114122
malloc
115123
MALLOC
124+
Masinter
116125
McKeever
117126
md
118127
mem
@@ -173,17 +182,24 @@ SWaP
173182
syslog
174183
Todo
175184
TODO
185+
tstr
176186
typedef
177187
UDPCL
178188
uint
179189
un
180190
Uncategorized
181191
underlayer
192+
Unescape
193+
unicode
182194
unix
195+
uri
196+
URI
197+
url
183198
validator
184199
verifier
185200
Verifier
186201
VERIFIER
202+
Vigano
187203
VxWorks
188204
whitespace
189205
Whitespace

docs/api/refs.bib

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,34 @@ @misc{iana:bundle
2222
title = {{Bundle Protocol registry}},
2323
url = {https://www.iana.org/assignments/bundle/bundle.xhtml},
2424
}
25+
@misc{rfc3339,
26+
series = {Request for Comments},
27+
number = 3339,
28+
howpublished = {RFC 3339},
29+
publisher = {RFC Editor},
30+
doi = {10.17487/RFC3339},
31+
url = {https://www.rfc-editor.org/info/rfc3339},
32+
author = {Chris Newman and Graham Klyne},
33+
title = {{Date and Time on the Internet: Timestamps}},
34+
pagetotal = 18,
35+
year = 2002,
36+
month = jul,
37+
abstract = {This document defines a date and time format for use in Internet protocols that is a profile of the ISO 8601 standard for representation of dates and times using the Gregorian calendar.},
38+
}
39+
@misc{rfc3986,
40+
series = {Request for Comments},
41+
number = 3986,
42+
howpublished = {RFC 3986},
43+
publisher = {RFC Editor},
44+
doi = {10.17487/RFC3986},
45+
url = {https://www.rfc-editor.org/info/rfc3986},
46+
author = {Tim Berners-Lee and Roy T. Fielding and Larry M Masinter},
47+
title = {{Uniform Resource Identifier (URI): Generic Syntax}},
48+
pagetotal = 61,
49+
year = 2005,
50+
month = jan,
51+
abstract = {A Uniform Resource Identifier (URI) is a compact sequence of characters that identifies an abstract or physical resource. This specification defines the generic URI syntax and a process for resolving URI references that might be in relative form, along with guidelines and security considerations for the use of URIs on the Internet. The URI syntax defines a grammar that is a superset of all valid URIs, allowing an implementation to parse the common components of a URI reference without knowing the scheme-specific requirements of every possible identifier. This specification does not define a generative grammar for URIs; that task is performed by the individual specifications of each URI scheme. {[}STANDARDS-TRACK{]}},
52+
}
2553
@misc{rfc4648,
2654
series = {Request for Comments},
2755
number = 4648,
@@ -50,6 +78,34 @@ @misc{rfc7517
5078
month = may,
5179
abstract = {A JSON Web Key (JWK) is a JavaScript Object Notation (JSON) data structure that represents a cryptographic key. This specification also defines a JWK Set JSON data structure that represents a set of JWKs. Cryptographic algorithms and identifiers for use with this specification are described in the separate JSON Web Algorithms (JWA) specification and IANA registries established by that specification.},
5280
}
81+
@misc{rfc8259,
82+
series = {Request for Comments},
83+
number = 8259,
84+
howpublished = {RFC 8259},
85+
publisher = {RFC Editor},
86+
doi = {10.17487/RFC8259},
87+
url = {https://www.rfc-editor.org/info/rfc8259},
88+
author = {Tim Bray},
89+
title = {{The JavaScript Object Notation (JSON) Data Interchange Format}},
90+
pagetotal = 16,
91+
year = 2017,
92+
month = dec,
93+
abstract = {JavaScript Object Notation (JSON) is a lightweight, text-based, language-independent data interchange format. It was derived from the ECMAScript Programming Language Standard. JSON defines a small set of formatting rules for the portable representation of structured data. This document removes inconsistencies with other specifications of JSON, repairs specification errors, and offers experience-based interoperability guidance.},
94+
}
95+
@misc{rfc8610,
96+
series = {Request for Comments},
97+
number = 8610,
98+
howpublished = {RFC 8610},
99+
publisher = {RFC Editor},
100+
doi = {10.17487/RFC8610},
101+
url = {https://www.rfc-editor.org/info/rfc8610},
102+
author = {Henk Birkholz and Christoph Vigano and Carsten Bormann},
103+
title = {{Concise Data Definition Language (CDDL): A Notational Convention to Express Concise Binary Object Representation (CBOR) and JSON Data Structures}},
104+
pagetotal = 64,
105+
year = 2019,
106+
month = jun,
107+
abstract = {This document proposes a notational convention to express Concise Binary Object Representation (CBOR) data structures (RFC 7049). Its main goal is to provide an easy and unambiguous way to express structures for protocol messages and data formats that use CBOR or JSON.},
108+
}
53109
@misc{rfc9171,
54110
series = {Request for Comments},
55111
number = 9171,

docs/api/spellcheck.xsl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
<xsl:template match="verbatim"/>
2828
<xsl:template match="programlisting"/>
2929
<xsl:template match="dot"/>
30+
<xsl:template match="ulink"/>
3031
<!-- remove characters that aspell cannot handle -->
3132
<xsl:template match="para/text()">
3233
<xsl:value-of select="translate(., '&#8217;', '')"/>

src/backend/SecParam.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*
2727
* @details
2828
*
29-
* The details from the RFC are as follows:
29+
* The details from the RFC Section 3.6 @cite rfc9172 are as follows:
3030
*
3131
* <blockquote>
3232
* This field captures one or more security context parameters that should be used
@@ -47,8 +47,6 @@
4747
*
4848
* </blockquote>
4949
*
50-
* @cite https://www.rfc-editor.org/rfc/rfc9172.html#section-3.6-3.10.1
51-
*
5250
* @author Bill.Van.Besien@jhuapl.edu
5351
*/
5452
/** @file

src/mock_bpa/CMakeLists.txt

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,35 +25,32 @@ target_compile_options(bsl_mock_bpa PRIVATE -Wshadow -Wpointer-arith -Wstrict-pr
2525

2626
target_sources(
2727
bsl_mock_bpa PUBLIC
28-
${CMAKE_CURRENT_SOURCE_DIR}/bsl_mock_bpa.h
29-
${CMAKE_CURRENT_SOURCE_DIR}/bsl_mock_bpa_crc.h
30-
${CMAKE_CURRENT_SOURCE_DIR}/bsl_mock_bpa_eid.h
31-
${CMAKE_CURRENT_SOURCE_DIR}/bsl_mock_bpa_eidpat.h
32-
${CMAKE_CURRENT_SOURCE_DIR}/bsl_mock_bpa_encode.h
33-
${CMAKE_CURRENT_SOURCE_DIR}/bsl_mock_bpa_decode.h
34-
${CMAKE_CURRENT_SOURCE_DIR}/bsl_mock_bpa_policy_config.h
35-
${CMAKE_CURRENT_SOURCE_DIR}/mock_bpa_policy_params.h
36-
${CMAKE_CURRENT_SOURCE_DIR}/mock_bpa_policy_registry.h
37-
${CMAKE_CURRENT_SOURCE_DIR}/mock_bpa_ctr.h
38-
${CMAKE_CURRENT_SOURCE_DIR}/BPSecLib_MockBPA.h
28+
${CMAKE_CURRENT_SOURCE_DIR}/agent.h
29+
${CMAKE_CURRENT_SOURCE_DIR}/crc.h
30+
${CMAKE_CURRENT_SOURCE_DIR}/eid.h
31+
${CMAKE_CURRENT_SOURCE_DIR}/eidpat.h
32+
${CMAKE_CURRENT_SOURCE_DIR}/encode.h
33+
${CMAKE_CURRENT_SOURCE_DIR}/decode.h
34+
${CMAKE_CURRENT_SOURCE_DIR}/text_util.h
35+
${CMAKE_CURRENT_SOURCE_DIR}/policy_config.h
36+
${CMAKE_CURRENT_SOURCE_DIR}/policy_params.h
37+
${CMAKE_CURRENT_SOURCE_DIR}/policy_registry.h
38+
${CMAKE_CURRENT_SOURCE_DIR}/ctr.h
39+
${CMAKE_CURRENT_SOURCE_DIR}/MockBPA.h
3940
)
4041
target_sources(
4142
bsl_mock_bpa PRIVATE
42-
${CMAKE_CURRENT_SOURCE_DIR}/bsl_mock_bpa.c
43-
${CMAKE_CURRENT_SOURCE_DIR}/bsl_mock_bpa_crc.c
44-
${CMAKE_CURRENT_SOURCE_DIR}/bsl_mock_bpa_eid.c
45-
${CMAKE_CURRENT_SOURCE_DIR}/bsl_mock_bpa_eidpat.c
46-
${CMAKE_CURRENT_SOURCE_DIR}/bsl_mock_bpa_encode.c
47-
${CMAKE_CURRENT_SOURCE_DIR}/bsl_mock_bpa_decode.c
48-
${CMAKE_CURRENT_SOURCE_DIR}/bsl_mock_bpa_policy_config.c
49-
${CMAKE_CURRENT_SOURCE_DIR}/mock_bpa_policy_params.c
50-
${CMAKE_CURRENT_SOURCE_DIR}/mock_bpa_policy_registry.c
51-
${CMAKE_CURRENT_SOURCE_DIR}/mock_bpa_ctr.c
52-
)
53-
target_include_directories(
54-
bsl_mock_bpa PUBLIC
55-
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
56-
$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include/bsl>
43+
${CMAKE_CURRENT_SOURCE_DIR}/agent.c
44+
${CMAKE_CURRENT_SOURCE_DIR}/crc.c
45+
${CMAKE_CURRENT_SOURCE_DIR}/eid.c
46+
${CMAKE_CURRENT_SOURCE_DIR}/eidpat.c
47+
${CMAKE_CURRENT_SOURCE_DIR}/encode.c
48+
${CMAKE_CURRENT_SOURCE_DIR}/decode.c
49+
${CMAKE_CURRENT_SOURCE_DIR}/text_util.c
50+
${CMAKE_CURRENT_SOURCE_DIR}/policy_config.c
51+
${CMAKE_CURRENT_SOURCE_DIR}/policy_params.c
52+
${CMAKE_CURRENT_SOURCE_DIR}/policy_registry.c
53+
${CMAKE_CURRENT_SOURCE_DIR}/ctr.c
5754
)
5855
set_target_properties(bsl_mock_bpa
5956
PROPERTIES
@@ -63,11 +60,11 @@ set_target_properties(bsl_mock_bpa
6360
target_link_libraries(bsl_mock_bpa PUBLIC MLIB::mlib)
6461
target_link_libraries(bsl_mock_bpa PUBLIC QCBOR::qcbor)
6562
target_link_libraries(bsl_mock_bpa PUBLIC Jansson::Jansson)
66-
target_link_libraries(bsl_mock_bpa PUBLIC bsl_front bsl_default_sc bsl_sample_pp)
63+
target_link_libraries(bsl_mock_bpa PUBLIC bsl_front bsl_dynamic bsl_default_sc bsl_sample_pp)
6764

6865
add_executable(bsl-mock-bpa)
6966
target_sources(bsl-mock-bpa PRIVATE mock_bpa.c)
70-
target_link_libraries(bsl-mock-bpa PUBLIC bsl_mock_bpa bsl_dynamic bsl_default_sc bsl_sample_pp bsl_crypto)
67+
target_link_libraries(bsl-mock-bpa PUBLIC bsl_mock_bpa bsl_crypto)
7168
target_link_libraries(bsl-mock-bpa PUBLIC Threads::Threads)
7269

7370
# Installation config
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
* the prime contract 80NM0018D0004 between the Caltech and NASA under
2020
* subcontract 1700763.
2121
*/
22-
#ifndef _BSL_MockBPA_BPSECLIB_MockBPA_H_
23-
#define _BSL_MockBPA_BPSECLIB_MockBPA_H_
22+
#ifndef _BSL_MockBPA_MockBPA_H_
23+
#define _BSL_MockBPA_MockBPA_H_
2424

25-
#include "bsl_mock_bpa_crc.h"
26-
#include "bsl_mock_bpa_encode.h"
27-
#include "bsl_mock_bpa_decode.h"
28-
#include "bsl_mock_bpa_eidpat.h"
29-
#include "bsl_mock_bpa.h"
25+
#include "crc.h"
26+
#include "encode.h"
27+
#include "decode.h"
28+
#include "agent.h"
29+
#include "eidpat.h"
3030

31-
#endif //_BSL_MockBPA_BPSECLIB_MockBPA_H_
31+
#endif //_BSL_MockBPA_MockBPA_H_
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@
2727
#include <BPSecLib_Public.h>
2828
#include <BPSecLib_Private.h>
2929
#include <assert.h>
30-
#include "bsl_mock_bpa.h"
31-
#include "bsl_mock_bpa_eid.h"
32-
#include "bsl_mock_bpa_eidpat.h"
33-
#include "bsl_mock_bpa_encode.h"
34-
#include "bsl_mock_bpa_decode.h"
30+
#include "agent.h"
31+
#include "eid.h"
32+
#include "eidpat.h"
33+
#include "encode.h"
34+
#include "decode.h"
3535

3636
int MockBPA_Bundle_Deinit(MockBPA_Bundle_t *bundle)
3737
{
@@ -261,7 +261,7 @@ int MockBPA_DeleteBundle(BSL_BundleRef_t *bundle_ref)
261261
return 0;
262262
}
263263

264-
int bsl_mock_bpa_init(void)
264+
int bsl_mock_bpa_agent_init(void)
265265
{
266266
uint8_t *state = BSL_MALLOC(999);
267267

@@ -292,7 +292,7 @@ int bsl_mock_bpa_init(void)
292292
return BSL_HostDescriptors_Set(bpa);
293293
}
294294

295-
void bsl_mock_bpa_deinit(void)
295+
void bsl_mock_bpa_agent_deinit(void)
296296
{
297297
BSL_HostDescriptors_t bpa;
298298
BSL_HostDescriptors_Get(&bpa);

0 commit comments

Comments
 (0)