Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
671cdd5
Fix unresolved references in doxygen documentation.
werwurm Apr 30, 2025
d872f49
fix clang-format
werwurm Apr 30, 2025
98504c5
Add sha-2 (224, 256, 384, 512) implementaitons for convenience.
werwurm Apr 29, 2025
e427270
rename test vector files to make the them visible to the licence chec…
werwurm Apr 30, 2025
78c2433
fixup clang-format
werwurm Apr 30, 2025
2910f63
more lint fixes
werwurm Apr 30, 2025
34a1f23
Merge branch 'main' into werwurm/sha2
werwurm May 2, 2025
941035d
Change digest pointers to arrays.
werwurm May 2, 2025
758d1cb
Merge branch 'main' into werwurm/sha2
werwurm May 2, 2025
73f1fb9
add null pointer checks on state and data parameters.
werwurm May 2, 2025
103f807
fix lint
werwurm May 2, 2025
23a21e2
use slice as data argument.
werwurm May 2, 2025
428728e
fix linter
werwurm May 2, 2025
a3a99c9
removed extra blank line
werwurm May 2, 2025
ebe8ed8
Add digest context to crypto.h TODO fixup documentation
werwurm Jun 7, 2025
192aa89
Add crypto impl
werwurm Jun 10, 2025
bd835ad
Add test stuff.
werwurm Jun 10, 2025
00c71ba
Add hmac test vectors
werwurm Jun 9, 2025
7adde3a
Add hkdf test
werwurm Jun 10, 2025
a2914a5
Add hkdf test vectors
werwurm Jun 9, 2025
dedc1c1
add mising docs and tests
werwurm Jul 15, 2025
087d171
fix lint
werwurm Jul 15, 2025
14743b2
address comments
werwurm Jul 15, 2025
8f6b558
add missing error code check in DigestErrorTest
werwurm Jul 15, 2025
61e2a30
consistency fix
werwurm Jul 16, 2025
71a2d73
Merge branch 'werwurm/digest_context' into werwurm/sha2
werwurm Jul 16, 2025
7d85dd7
move sha implementation to crypto/nat20
werwurm Jun 11, 2025
5477a60
fixup CMakeLists.txt
werwurm Jul 16, 2025
9e66702
improve stack cleanup
werwurm Jul 16, 2025
44e0008
fixup docs
werwurm Jul 16, 2025
1f019c5
address comments
werwurm Jul 16, 2025
a84e9aa
Add software implementations of hmac and hkdf in crypto_digest_contex…
werwurm Jun 7, 2025
5e8ce8b
fix lint
werwurm Jul 16, 2025
a2cdf91
address comments
werwurm Jul 16, 2025
07deaf7
Remove the get_cdi function from the crypto interface
werwurm May 28, 2025
ffd4f59
fix lit
werwurm Jul 16, 2025
e326ebd
fix lint
werwurm Jul 16, 2025
d9f1d56
Merge branch 'werwurm/crypto_nat20' into werwurm/crypto_interface_rev…
werwurm Jul 16, 2025
179a4b3
fix typos add missing docs and unit tests.
werwurm Jul 21, 2025
9112022
formatting nit
werwurm Jul 21, 2025
744981a
RDN serial number is now expected to be given as big endian octet string
werwurm Jun 12, 2025
ae6d71a
fix lint
werwurm Jul 21, 2025
6f10887
address comments
werwurm Jul 21, 2025
b6198a9
polish docs
werwurm Jul 21, 2025
8b3ec76
fixup crypto test
werwurm Jul 22, 2025
fb2b528
Merge branch 'werwurm/digest_context' into werwurm/sha2
werwurm Jul 22, 2025
b71b5f7
Merge branch 'main' into werwurm/sha2
werwurm Jul 22, 2025
2dad0a5
Merge branch 'werwurm/sha2' into werwurm/crypto_nat20
werwurm Jul 22, 2025
616e07e
Merge branch 'main' into werwurm/crypto_nat20
werwurm Jul 22, 2025
357881d
address comments
werwurm Jul 22, 2025
26ae6a7
Merge branch 'werwurm/crypto_nat20' into werwurm/crypto_interface_rev…
werwurm Jul 22, 2025
f5bb094
Merge branch 'main' into werwurm/crypto_interface_revision
werwurm Jul 22, 2025
e7e3c54
address comments
werwurm Jul 22, 2025
726a910
Merge branch 'refs/heads/werwurm/crypto_interface_revision' into werw…
werwurm Jul 22, 2025
59c9572
address comments
werwurm Jul 22, 2025
b1a9a52
The serial number field in x509 tbs is now a slice
werwurm Jun 12, 2025
bab297a
fix incomplete doc comment.
werwurm Jul 23, 2025
6c8c207
X509 add unique ids (needs test coverage)
werwurm Jun 16, 2025
e675a8e
[CBOR] Add CBOR rendering primitives.
werwurm Mar 19, 2025
f22c960
Istream implementaiton (no test yet)
werwurm Mar 20, 2025
06ab3ec
CBOR parser WIP
werwurm Mar 20, 2025
6c9865c
CWT WIP
werwurm Jun 18, 2025
8deae54
functionality WIP
werwurm Mar 31, 2025
4358ed0
Add service implementation
werwurm May 28, 2025
bcc0752
Add gnostic node implementation
werwurm May 28, 2025
86be92c
proxy node stateless
werwurm Jun 16, 2025
808ce83
Messages CDDL
werwurm Jul 2, 2025
13e11c2
Service messages
werwurm Jul 2, 2025
87c79dd
avr patch
werwurm Jul 3, 2025
d6ee83f
incompatible compressed input size error code
werwurm Jul 8, 2025
b2f0671
POC client service impl
werwurm Jul 8, 2025
513877a
add eca-cert and eca-sign
ayoung19 Aug 1, 2025
d80597c
Format
ayoung19 Aug 15, 2025
2a23d9e
Format
ayoung19 Aug 15, 2025
1266c5b
Format
ayoung19 Aug 15, 2025
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
84 changes: 81 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(LIBNAT20_SOURCES
# Add the core library source files here.
src/core/asn1.c
src/core/cbor.c
src/core/functionality.c
src/core/oid.c
src/core/stream.c
src/core/x509_ext_open_dice_input.c
Expand All @@ -58,8 +60,10 @@ set(LIBNAT20_PUB_HEADERS
# Add the public headers here.
# These files will be included in the generation of the API documentation.
include/nat20/asn1.h
include/nat20/cbor.h
include/nat20/crypto.h
include/nat20/error.h
include/nat20/functionality.h
include/nat20/oid.h
include/nat20/stream.h
include/nat20/types.h
Expand Down Expand Up @@ -87,16 +91,36 @@ set(LIBNAT20_CRYPTO_NAT20_PUB_HEADERS

set(LIBNAT20_TEST_SOURCES
# Add test source files here.
src/core/test/test.cpp
src/core/test/asn1.cpp
src/core/test/cbor.cpp
src/core/test/functionality.cpp
src/core/test/oid.cpp
src/core/test/stream.cpp
src/core/test/test.cpp
src/core/test/test_vectors.cpp
src/core/test/x509.cpp
src/core/test/x509_ext_open_dice_input.cpp
src/core/test/x509_ext_tcg_dice_tcb_freshness.cpp
src/core/test/x509_ext_tcg_dice_tcb_info.cpp
src/core/test/x509_ext_tcg_dice_ueid.cpp
)

set(LIBNAT20_SERVICE_SOURCES
# Add service source files here.
src/service/gnostic.c
src/service/messages.c
src/service/proxy.c
src/service/service.c
)

set(LIBNAT20_SERVICE_PUB_HEADERS
# Add service public headers here.
include/nat20/service/gnostic.h
include/nat20/service/messages.h
include/nat20/service/proxy.h
include/nat20/service/service.h
)

set(LIBNAT20_DOC_PAGES
# Add additional input files for doxygen here.
README.md
Expand Down Expand Up @@ -153,6 +177,31 @@ target_include_directories(nat20

###################################################################################################

###################################################################################################
# The nat20_service library is also part of the product of this project.
# It will always be compiled.
add_library(nat20_service STATIC)

target_sources(nat20_service
PRIVATE ${LIBNAT20_SERVICE_SOURCES}
INTERFACE ${LIBNAT20_SERVICE_PUB_HEADERS}
)

target_compile_options(nat20_service
PRIVATE -pedantic
PRIVATE -Wall
PRIVATE -Wextra
PRIVATE -Werror
)

target_include_directories(nat20_service
PUBLIC include
)

target_link_libraries(nat20_service nat20)

###################################################################################################

###################################################################################################
# The nat20_crypto_nat20 library implements some crypto
# algorithms using the native C standard library.
Expand Down Expand Up @@ -216,6 +265,29 @@ endif()

###################################################################################################

###################################################################################################
# Service binary.

add_executable(nat20_service_bin)
target_sources(nat20_service_bin
PRIVATE src/service/gnostic_main.c
)
target_link_libraries(nat20_service_bin nat20_service nat20_crypto_nat20 nat20_crypto_boringssl)

###################################################################################################

###################################################################################################
# Client binary.

add_executable(n20_client_stateless_bin)
target_sources(n20_client_stateless_bin
PRIVATE src/service/client_stateless.c
)
target_link_libraries(n20_client_stateless_bin nat20_service nat20_crypto_nat20 nat20_crypto_boringssl)

###################################################################################################


###################################################################################################
# The libnat20 test suite. It, along with its additional dependencies is only compiled
# when selected by setting `-DNAT20_WITH_TESTS=ON` on the `cmake -B` command line.
Expand All @@ -227,8 +299,8 @@ if (NAT20_WITH_TESTS)
include(FetchContent)

FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/5376968f6948923e2411081fd9372e71a59d8e77.zip
googletest
URL https://github.com/google/googletest/archive/5376968f6948923e2411081fd9372e71a59d8e77.zip
)
# For Windows: Prevent overriding the parent project's compiler/linker settings
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
Expand All @@ -242,6 +314,12 @@ if (NAT20_WITH_TESTS)
FILES_MATCHING PATTERN "*"
)

file(INSTALL
"src/core/test/test_data/"
DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/test_data/core"
FILES_MATCHING PATTERN "*"
)

# Add the nat20 library test utils.
add_library(nat20_test_utils STATIC)
target_sources(nat20_test_utils
Expand Down
8 changes: 3 additions & 5 deletions include/nat20/asn1.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ extern void n20_asn1_object_identifier(n20_stream_t *s,
/**
* @brief Write an integer complete with ASN.1 header to the given stream.
*
* The function expects a buffer `n` of length `len` bytes which
* The function expects a buffer slice @p n which
* it will interpret as integer according to the parameters `little_endian`
* and `two_complement`. It will format an ASN1 INTEGER into the stream using
* DER, i.e., leading zero bytes (unsigned) or bytes that have all bits set
Expand All @@ -472,16 +472,14 @@ extern void n20_asn1_object_identifier(n20_stream_t *s,
* If `n` is NULL this function behaves like @ref n20_asn1_null.
*
* @param s The stream that is to be updated.
* @param n The buffer holding the integer.
* @param len The size of the buffer in bytes.
* @param n The buffer slice holding the integer.
* @param little_endian Indicates if the byteorder of the integer in the given buffer.
* @param two_complement If `true` the buffer is interpreted as signed 2-complement integer.
* @param tag_info Tag info override.
* @sa N20_ASN1_TAG_INTEGER
*/
extern void n20_asn1_integer(n20_stream_t *s,
uint8_t const *n,
size_t len,
n20_slice_t const n,
bool little_endian,
bool two_complement,
n20_asn1_tag_info_t tag_info);
Expand Down
Loading
Loading