-
Notifications
You must be signed in to change notification settings - Fork 3
Add module nat20device to linux examples. #99
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
werwurm
wants to merge
3
commits into
werwurm/linux_example_nat20lib
Choose a base branch
from
werwurm/linux_example_nat20device
base: werwurm/linux_example_nat20lib
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| # Copyright 2026 Aurora Operations, Inc. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 OR GPL-2.0 | ||
| # | ||
| # This work is dual licensed. | ||
| # You may use it under Apache-2.0 or GPL-2.0 at your option. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| # OR | ||
| # | ||
| # This program is free software; you can redistribute it and/or | ||
| # modify it under the terms of the GNU General Public License | ||
| # as published by the Free Software Foundation; either version 2 | ||
| # of the License, or (at your option) any later version. | ||
| # | ||
| # This program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with this program; if not, see | ||
| # <https://www.gnu.org/licenses/>. | ||
|
|
||
| config BR2_PACKAGE_NAT20DEVICE | ||
| bool "nat20device" | ||
| help | ||
| Say Y if you want to enable libnat20 based DICE support. | ||
|
|
||
| Congratulations, you rolled a natural 20. You just enabled | ||
| DICE (Device Identifier Composition Engine) support which | ||
| is one step in the direction of establishing the root of | ||
| trust for your ZTA infrastructure. | ||
|
|
||
| To compile this driver as a module, choose M here: the | ||
| module will be called nat20device. | ||
|
|
||
| If in doubt, read up on ZTA, device state attestation, OpenDICE, | ||
| DICE Attestation Architecture, and DICE Layering Architecture. | ||
| Then come back and, enthusiastically, say Y here. | ||
|
|
||
| Privacy notice: This is a trusted computing feature. It is | ||
| very useful for fleet management and establishing authenticity | ||
| and integrity to a remote relying party. It can also be | ||
| used for tracking, so protecting this feature from unauthorized | ||
| access is crucial for privacy on personal end user devices. |
49 changes: 49 additions & 0 deletions
49
examples/linux/br_external/package/nat20device/nat20device.mk
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # Copyright 2026 Aurora Operations, Inc. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 OR GPL-2.0 | ||
| # | ||
| # This work is dual licensed. | ||
| # You may use it under Apache-2.0 or GPL-2.0 at your option. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| # OR | ||
| # | ||
| # This program is free software; you can redistribute it and/or | ||
| # modify it under the terms of the GNU General Public License | ||
| # as published by the Free Software Foundation; either version 2 | ||
| # of the License, or (at your option) any later version. | ||
| # | ||
| # This program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with this program; if not, see | ||
| # <https://www.gnu.org/licenses/>. | ||
|
|
||
| # In CI NAT20DEVICE_OVERRIDE_SRCDIR is set to the root of the repository, | ||
| # so that the source under test is always the current branch. | ||
| # Integrators who use this configuration should pin the version | ||
| # to a specific commit or branch to avoid breakages when the main branch changes. | ||
| NAT20DEVICE_VERSION = origin/main | ||
| NAT20DEVICE_SITE = https://github.com/aurora-opensource/libnat20.git | ||
| NAT20DEVICE_SITE_METHOD = git | ||
|
|
||
| NAT20DEVICE_LICENSE = GPL-2.0 | ||
|
|
||
| NAT20DEVICE_MODULE_SUBDIRS = examples/linux/nat20device | ||
|
|
||
| $(eval $(kernel-module)) | ||
| $(eval $(generic-package)) |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # Copyright 2026 Aurora Operations, Inc. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 OR GPL-2.0 | ||
| # | ||
| # This work is dual licensed. | ||
| # You may use it under Apache-2.0 or GPL-2.0 at your option. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| # OR | ||
| # | ||
| # This program is free software; you can redistribute it and/or | ||
| # modify it under the terms of the GNU General Public License | ||
| # as published by the Free Software Foundation; either version 2 | ||
| # of the License, or (at your option) any later version. | ||
| # | ||
| # This program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with this program; if not, see | ||
| # <https://www.gnu.org/licenses/>. | ||
|
|
||
| obj-m := nat20device.o | ||
|
|
||
| ccflags-y := -I $(src)/include |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # Copyright 2026 Aurora Operations, Inc. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 OR GPL-2.0 | ||
| # | ||
| # This work is dual licensed. | ||
| # You may use it under Apache-2.0 or GPL-2.0 at your option. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| # OR | ||
| # | ||
| # This program is free software; you can redistribute it and/or | ||
| # modify it under the terms of the GNU General Public License | ||
| # as published by the Free Software Foundation; either version 2 | ||
| # of the License, or (at your option) any later version. | ||
| # | ||
| # This program is distributed in the hope that it will be useful, | ||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| # GNU General Public License for more details. | ||
| # | ||
| # You should have received a copy of the GNU General Public License | ||
| # along with this program; if not, see | ||
| # <https://www.gnu.org/licenses/>. | ||
|
|
||
| KDIR ?= /lib/modules/`uname -r`/build | ||
| INSTALL_MOD_PATH ?= /lib/modules/`uname -r`/extra | ||
|
|
||
| all: modules | ||
|
|
||
| modules: | ||
| $(MAKE) -C $(KDIR) M=$$PWD modules | ||
|
|
||
| modules_install: | ||
| $(MAKE) -C $(KDIR) M=$$PWD INSTALL_MOD_PATH="$(INSTALL_MOD_PATH)" modules_install | ||
|
|
||
| clean: | ||
| $(MAKE) -C $(KDIR) M=$$PWD clean | ||
|
|
||
| .PHONY: all modules modules_install clean |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| /* | ||
| * Copyright 2026 Aurora Operations, Inc. | ||
| * | ||
| * SPDX-License-Identifier: Apache-2.0 OR GPL-2.0 | ||
| * | ||
| * This work is dual licensed. | ||
| * You may use it under Apache-2.0 or GPL-2.0 at your option. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * | ||
| * OR | ||
| * | ||
| * This program is free software; you can redistribute it and/or | ||
| * modify it under the terms of the GNU General Public License | ||
| * as published by the Free Software Foundation; either version 2 | ||
| * of the License, or (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU General Public License | ||
| * along with this program; if not, see | ||
| * <https://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| #pragma once | ||
| #ifndef NAT20_DEVICE_H | ||
| #define NAT20_DEVICE_H | ||
|
|
||
| #include <linux/module.h> | ||
| #include <linux/types.h> | ||
|
|
||
| struct nat20device_driver {}; | ||
|
|
||
| /** | ||
| * struct nat20device_buffer - Buffer for dispatch function response | ||
| * @data: Pointer to buffer data | ||
| * @size: Size of the buffer in bytes | ||
| */ | ||
| struct nat20device_buffer { | ||
| void* data; | ||
| size_t size; | ||
| }; | ||
|
|
||
| /** | ||
| * typedef nat20device_dispatch_fn - Dispatch function callback | ||
| * @ctx: Driver-specific context | ||
| * @request: Request buffer from userspace | ||
| * @request_len: Length of request buffer | ||
| * @response: Pointer to response buffer (allocated by driver) | ||
| * | ||
| * The dispatch function processes a request and returns a response buffer. | ||
| * The driver must allocate the response buffer, which will be freed by | ||
| * the framework using kfree after the read operation completes. | ||
| * | ||
| * Return: 0 on success, negative error code on failure | ||
| */ | ||
| typedef int (*nat20device_dispatch_fn)(void* ctx, | ||
| void const* request, | ||
| size_t request_len, | ||
| struct nat20device_buffer* response); | ||
|
|
||
| /** | ||
| * typedef nat20device_dice_chain_read - DICE chain read function callback | ||
| * @ctx: Driver-specific context | ||
| * @buf: User-space buffer to read DICE chain data into | ||
| * @len: Length of the buffer | ||
| * @f_pos: File position offset | ||
| * | ||
| * Reads the DICE certificate chain into the provided user-space buffer. | ||
| * The data is encoded as a CBOR indefinite-length array. See | ||
| * examples/linux/README.md for the encoding specification. | ||
| * | ||
| * Return: Number of bytes read on success, negative error code on failure | ||
| */ | ||
| typedef ssize_t (*nat20device_dice_chain_read)(void* ctx, | ||
| char __user* buf, | ||
| size_t len, | ||
| loff_t* f_pos); | ||
|
|
||
| /** | ||
| * struct nat20device_driver_ops - Driver operations | ||
| * @dispatch: Dispatch function for handling requests | ||
| * @dice_chain_read: DICE chain read function for reading the boot certificate chain | ||
| */ | ||
| struct nat20device_driver_ops { | ||
| nat20device_dispatch_fn dispatch; | ||
| nat20device_dice_chain_read dice_chain_read; | ||
| }; | ||
|
|
||
| /** | ||
| * nat20device_register_driver - Register a new NAT20 driver instance | ||
| * @ops: Driver operations structure | ||
| * @ctx: Driver-specific context | ||
| * @owner: Module owner (usually THIS_MODULE). This is used to manage module | ||
| * reference counting for the driver instance. Blocks the removal | ||
| * of the module while a device node remains open. | ||
| * | ||
| * Registers a new driver instance and creates a character device node | ||
| * with the name "nat20X" where X is an automatically assigned number. | ||
| * | ||
| * Return: Pointer to registered driver on success, ERR_PTR on failure | ||
| */ | ||
| struct nat20device_driver* nat20device_register_driver(const struct nat20device_driver_ops* ops, | ||
| void* ctx, | ||
| struct module* owner); | ||
|
|
||
| /** | ||
| * nat20device_unregister_driver - Unregister a NAT20 driver instance | ||
| * @driver: Driver instance to unregister | ||
| * | ||
| * Unregisters a driver instance and removes its character device node. | ||
| */ | ||
| void nat20device_unregister_driver(struct nat20device_driver* driver); | ||
| #endif /* NAT20_DEVICE_H */ | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.