aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / scripts / sign_efi_binary.sh
| 1 | #!/usr/bin/env bash |
| 2 | # SPDX-License-Identifier: Apache-2.0 |
| 3 | # Copyright 2026 Drake Stapleton (AIEN / aien-dev) |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | |
| 17 | # sign_efi_binary.sh: Signs an EFI executable with the disposable development signing key |
| 18 | # DISPOSABLE DEVELOPMENT/TEST MATERIAL ONLY. |
| 19 | # Invariant: This is NOT the TRUST-1 Q13 Owner Root or production Boot Signer. |
| 20 | # Invariant: NO PLAINTEXT SECRETS IN REPOSITORY OR BUILD ARTIFACTS. Unslop compliant. |
| 21 | |
| 22 | set -euo pipefail |
| 23 | |
| 24 | INPUT_EFI="${1:-target/aarch64-unknown-uefi/release/aienos-handoff.efi}" |
| 25 | OUTPUT_EFI="${2:-${INPUT_EFI}.signed}" |
| 26 | KEY_DIR="${HOME}/.config/atlas/boot-keys/dev-only" |
| 27 | KEY_FILE="${KEY_DIR}/dev_boot.key" |
| 28 | CERT_FILE="${KEY_DIR}/dev_boot.crt" |
| 29 | |
| 30 | if [[ ! -f "${INPUT_EFI}" ]]; then |
| 31 | echo "Error: Input EFI binary not found at ${INPUT_EFI}" >&2 |
| 32 | exit 1 |
| 33 | fi |
| 34 | |
| 35 | if [[ ! -f "${KEY_FILE}" || ! -f "${CERT_FILE}" ]]; then |
| 36 | echo "Error: Development keys not found in ${KEY_DIR}. Run generate_owner_boot_keys.sh first." >&2 |
| 37 | exit 1 |
| 38 | fi |
| 39 | |
| 40 | echo "Signing ${INPUT_EFI} with development certificate..." |
| 41 | sbsign --key "${KEY_FILE}" --cert "${CERT_FILE}" --output "${OUTPUT_EFI}" "${INPUT_EFI}" |
| 42 | |
| 43 | echo "Verifying signature on ${OUTPUT_EFI}..." |
| 44 | sbverify --cert "${CERT_FILE}" "${OUTPUT_EFI}" |
| 45 | echo "PASS: Binary successfully signed and verified with Disposable Dev Boot Key." |