Skip to content

Add nat20sw kernel module to linux examples.#102

Draft
werwurm wants to merge 2 commits into
werwurm/fix_certificate_size_estimatesfrom
werwurm/linux_example_nat20sw
Draft

Add nat20sw kernel module to linux examples.#102
werwurm wants to merge 2 commits into
werwurm/fix_certificate_size_estimatesfrom
werwurm/linux_example_nat20sw

Conversation

@werwurm
Copy link
Copy Markdown
Contributor

@werwurm werwurm commented May 9, 2026

The nat20sw module is an implementation of a nat20device character
device class. It uses the functionality implemented in nat20lib and
nat20crypto to implement a fully fledged DICE service with embedded CA
(ECA).
The root secret is hard coded and thus not useful for production
applications. But it serves as inspirational reference implementation
and as a suitable environment to develop user space tools against.

The nat20sw module is an implementation of a nat20device character
device class. It uses the functionality implemented in nat20lib and
nat20crypto to implement a fully fledged DICE service with embedded CA
(ECA).
The root secret is hard coded and thus not useful for production
applications. But it serves as inspirational reference implementation
and as a suitable environment to develop user space tools against.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 9, 2026

LCOV of commit 8f306bb during lcov-test-coverage-report #200

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

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new Linux example kernel module (nat20sw) that implements a software-backed nat20device character-device service using nat20lib + nat20crypto, and wires it into the Buildroot external tree and CI so it gets built in the QEMU example configuration.

Changes:

  • Add nat20sw kernel module (module source + Kbuild/Makefile) implementing Gnostic service dispatch and a DICE chain reader.
  • Extend the nat20lib kernel module exports to support nat20sw’s CBOR/stream usage.
  • Integrate nat20sw into Buildroot configs/scripts and GitHub Actions kernel-module build workflow.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
examples/linux/nat20sw/nat20sw.c New software NAT20 service module: init/exit, message dispatch, cached DICE chain rendering.
examples/linux/nat20sw/Makefile Out-of-tree kernel build wrapper for nat20sw.
examples/linux/nat20sw/Kbuild Kernel build rules, include paths, and symbol dependencies for nat20sw.
examples/linux/nat20lib/mod.c Export additional nat20lib symbols required by nat20sw.
examples/linux/br_external/utils/envsetup.sh Add Buildroot rebuild support and override env var for nat20sw.
examples/linux/br_external/package/nat20sw/nat20sw.mk New Buildroot package definition for the nat20sw kernel module.
examples/linux/br_external/package/nat20sw/Config.in New Buildroot Kconfig entry for enabling nat20sw.
examples/linux/br_external/configs/qemu_br_defconfig Enable BR2_PACKAGE_NAT20SW in the QEMU Buildroot defconfig.
examples/linux/br_external/Config.in Source the new nat20sw package Config.in.
.github/workflows/linux-kmod-build.yml Build and verify nat20sw.ko in CI.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread examples/linux/nat20sw/nat20sw.c Outdated
Comment thread examples/linux/nat20sw/nat20sw.c Outdated
Comment thread examples/linux/nat20sw/nat20sw.c Outdated
Comment thread examples/linux/br_external/package/nat20sw/nat20sw.mk Outdated
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Comment on lines +315 to +320
kfree(response->data);
response->size = 0;
response->data = kzalloc(actual_response_size, GFP_KERNEL);
if (response->data == NULL) {
return -ENOMEM;
}
Comment on lines +36 to +37
KDIR ?= /lib/modules/`uname -r`/build
INSTALL_MOD_PATH ?= /lib/modules/`uname -r`/extra
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