Skip to content

Add documentation for linux example#106

Draft
werwurm wants to merge 75 commits into
mainfrom
werwurm/linux_example_doc
Draft

Add documentation for linux example#106
werwurm wants to merge 75 commits into
mainfrom
werwurm/linux_example_doc

Conversation

@werwurm

@werwurm werwurm commented May 21, 2026

Copy link
Copy Markdown
Contributor

No description provided.

werwurm added 30 commits April 29, 2026 09:34
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.
werwurm and others added 22 commits May 12, 2026 09:54
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>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented May 21, 2026

Copy link
Copy Markdown

LCOV of commit d186786 during lcov-test-coverage-report #249

Summary coverage rate:
  lines......: 95.6% (3048 of 3188 lines)
  functions..: 99.1% (232 of 234 functions)
  branches...: 87.1% (1658 of 1904 branches)

Files changed coverage rate: n/a

@werwurm werwurm changed the base branch from werwurm/linux_example_nat20cli to main June 9, 2026 21:50
@werwurm werwurm requested a review from jmelby-contractor June 9, 2026 21:52
@werwurm werwurm requested a review from Copilot June 17, 2026 16:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/@file headers 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 thread CMakeLists.txt
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants