Add documentation for linux example#106
Draft
werwurm wants to merge 75 commits into
Draft
Conversation
Add a kernel module that provides libnat20 functionality to linux kernel modules. Also add a configuration to build a minimal linux image with buildroot and run in on qemu and a workflow to test build nat20lib.ko
This module creates a new character device class intended to implement the nat20 service protocol implementing DICE based device state attestation and an embedded CA.
The nat20crypto module implements the libnat20 crypto interface in terms of linux kernel crypto primitives. The module implements - deterministic ECDSA with curves P256 and P384. - Bytewise SHA-2 224/256/384/512 - HMAC - HKDF ED25519 is currently not supported.
…/linux_example_nat20device
…urm/linux_example_nat20crypto
…linux_example_libnat20
This commandline tool provides a primitive interface to communicate with a nat20 device.
Adds a C integration test binary (nat20_integration_test) that exercises
the full DICE service stack via /dev/nat200. The test generates certificate
chains across all supported key type (P-256, P-384) and format (X.509,
COSE) permutations, verifies cryptographic signatures at each link, and
confirms that parent_path-based issuance produces identical results to
direct issuance after promote.
Test structure:
- Phase 1 (level 1): Generate CDI1, CDI2, ECA, ECA_EE certs and
signatures using parent paths of varying depth from the UDS level.
Verify all X.509 and COSE chains cryptographically.
- Phase 2 (level 2): After one promote, regenerate CDI2/ECA/ECA_EE/sign
with reduced parent path depth and assert byte-for-byte equality.
- Phase 3 (level 3): After second promote, regenerate ECA/ECA_EE/sign
with no parent path and assert equality.
Also includes:
- test_helpers.c: OpenSSL-based X.509 signature verification, public key
extraction, COSE_Sign1 parsing and verification, CWT subject public
key extraction, and compressed input computation.
- nat20_qemu_init.sh: init wrapper for running tests in QEMU CI.
- GitHub Action steps to build the rootfs and run the test suite in QEMU.
- Buildroot package (nat20test) with OpenSSL dependency.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This reverts commit 0612f25.
This reverts commit b159fbb.
…ple_integration_test
…nux_example_nat20cli
…nux_example_nat20cli
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…nux_example_nat20cli
LCOV of commit
|
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Doxygen-visible documentation for the Linux example (kernel modules + userspace CLI) and improves several Doxygen comment blocks across public headers so the generated docs include richer content.
Changes:
- Introduces a new Linux example documentation page and links to it from the top-level README.
- Adds the Linux example docs (and nat20crypto security assessment) to the Doxygen input list in CMake.
- Refines multiple Doxygen comments/
@fileheaders and small documentation annotations in public headers.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Adds an “Examples” section linking to the Linux example documentation. |
| include/nat20/service/gnostic.h | Adjusts Doxygen references in comments (now plain paths). |
| include/nat20/limits.h | Converts single-line @file comment into a structured Doxygen block. |
| include/nat20/endian.h | Converts single-line @file comment into a structured Doxygen block. |
| include/nat20/crypto/nat20/rfc6979.h | Adds field-level documentation to the big-number struct. |
| include/nat20/crypto/nat20/crypto.h | Fixes Doxygen parameter markup (@p). |
| examples/linux/README_linux.md | Adds comprehensive Linux example documentation (architecture, interfaces, Buildroot workflow). |
| examples/linux/nat20crypto/SECURITY.md | Adds/updates nat20crypto timing/key-material security assessment documentation. |
| CMakeLists.txt | Adds new Markdown docs to Doxygen inputs and changes Doxygen extraction settings. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+188
to
+190
| examples/linux/README_linux.md | ||
| examples/linux/nat20crypto/SECURITY.md | ||
| src/service/DICE_SERVICE.md |
Comment on lines
+63
to
+64
| * for this implementation are defined in src/service/gnostic.c, and is based | ||
| * on the DICE functionality implemented in src/core/functionality.c. |
| ### nat20lib | ||
|
|
||
| A kernel module wrapper around the core libnat20 C library. It compiles all | ||
| core library sources, i.e, |
Comment on lines
+30
to
+31
| - AKDF key pare generation, | ||
| - issuing and signing of CDI attestaiton and ECA certificates, |
| - service messages (un)marshaling and dispatch, and | ||
| - gnostic node service implementation | ||
|
|
||
| into a kernel obejct (`.ko`) and re-exports their symbols via `EXPORT_SYMBOL()` |
Comment on lines
+44
to
+46
| \warning The eliptic curve crypto (ECC) implementaiton in this module is not ready | ||
| for production see [Security Assessment - nat20crypto](examples/linux/nat20crypto/SECURITY.md) | ||
| for details. |
| # Run the nat20cli test in qemu and shut down the emulator | ||
| run-nat20cli-test | ||
|
|
||
| # Run the nat20test integration test in qemu and sht down the emulator |
Comment on lines
+146
to
+149
| The bootstrap script is usefull for setting up the development environment | ||
| once, but it cannot keep the build root environment in sync with the upstream | ||
| repository. When pulling the upstream repository and changes where made to | ||
| `envsetup.sh`, `bootstrap.sh`, or the buildroot config, it may be necessary |
| repository. When pulling the upstream repository and changes where made to | ||
| `envsetup.sh`, `bootstrap.sh`, or the buildroot config, it may be necessary | ||
| to bootstrap a new environment. A savvy user may track the changes and manually | ||
| update the environment to save 30 minutes rebuilding the build root environment. No newline at end of file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.