/* * 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 #include /* 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 */