Files
LithosAnanke/tools/pkcs8_ed25519.h
T
Claude 3bd81097e1 chore(license): an SPDX header on every source file that had none (LicenseRef-Starship-1.0) [skip ci]
The header scan (Captain Bob, 2026-11-10): 788 source files -- 351 with the
SL-1.0 header, 12 with the old name (docs/working/experiments, kept by
ruling), 31 under someone else's licence (tools/kconfig, Linux's, GPL-2.0:
kept), and 394 with none. Ruled: the SPDX form; capsules (.4th, .f18) and
proofs (.thy) left for a ruling of their own (mkcapsule's 64x16 block format,
content-addressed capsules).

253 files now begin
    SPDX-License-Identifier: LicenseRef-Starship-1.0
    Copyright (c) 2023-2026 Robert A. James
as a /* */ block (C, headers, assembly, linker scripts) or # lines (scripts,
Makefiles, Kconfig; below a shebang or a coding line); tools/mkcapsule.c,
which had the copyright line, gets the SPDX line only.

Not touched: docs/working/ (archive and old campaign material, as the
ruling kept the experiments); v4/system/post_cases.c (generated by
v4/tools/mkpost.py, "do not edit" -- the generator has the header).

Comments only: the kernel builds on amd64, aarch64, riscv64; make -C v4
test-32: 39 programs, 0 failures; every changed script parses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GE3SDvQn5EoxdGufk84zz2
2026-11-10 04:12:49 +00:00

30 lines
1.2 KiB
C

/* SPDX-License-Identifier: LicenseRef-Starship-1.0
* Copyright (c) 2023-2026 Robert A. James
*/
/*
* pkcs8_ed25519.h -- extract the raw 32-byte Ed25519 seed from a
* PKCS#8 DER-encoded private key (RFC 8410 OneAsymmetricKey), for
* mkcapsule's host-side capsule signing step (Milestone 6, Phase 8).
*
* Host-only: this never runs in the kernel (the kernel never signs, see
* ed25519.h). Deliberately its own narrow, from-scratch DER walker, not
* shared with src/starkernel/crypto/x509_ed25519.c -- that file walks a
* full Certificate structure to a *public* key; this one walks the much
* smaller PKCS#8 OneAsymmetricKey structure to a *private* key seed.
* Small enough that duplicating the handful of TLV-walking lines is
* simpler and easier to audit independently than threading a shared
* header between the kernel crypto tree and host build tooling.
*/
#ifndef TOOLS_PKCS8_ED25519_H
#define TOOLS_PKCS8_ED25519_H
#include <stdint.h>
#include <stddef.h>
/* Returns 0 on success (seed_out[32] filled), -1 on any malformed
* encoding or non-Ed25519 algorithm. Never faults on malformed input. */
int pkcs8_extract_ed25519_seed(const uint8_t *der, size_t der_len,
uint8_t seed_out[32]);
#endif /* TOOLS_PKCS8_ED25519_H */