interplane.Get Omega
Read in your language

aienux

Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.

Brought by drakestapleton

branch main Branches Tags History

aienux / native / kernel / tools / ck_pi5_store_locate.c

51 lines · 2028 bytes Raw Blame History
1/* SPDX-License-Identifier: Apache-2.0
2 * Copyright 2026 Drake Stapleton (AIEN / aien-dev)
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/* ck_pi5_store_locate.c -- host tool: print where the KeySlotManifest sits in a copy of the Pi card's
18 * AIENOS partition (see pi5_store_locate.h). Read only, prints no secret and no key bytes.
19 * ck_pi5_store_locate <partition image> */
20#include <stdio.h>
21#include "pi5_store_locate.h"
22#include "store_boot.h"
23
24/* store_boot.c (compiled -DCK_PI5_UNLOCK, as in the image) references the board secret source; the locator
25 * never unlocks anything, so it has none. */
26int ck_pi5_unlock_secret(uint8_t out[CK_SB_SECRET_LEN], const char **source)
27{
28 (void)out;
29 (void)source;
30 return -1;
31}
32
33int main(int argc, char **argv)
34{
35 ck_pi5_ksm_loc l;
36 char err[160];
37 if (argc != 2) {
38 fprintf(stderr, "usage: %s <partition image>\n", argv[0]);
39 return 2;
40 }
41 if (ck_pi5_locate_keyslot(argv[1], &l, err, sizeof err)) {
42 fprintf(stderr, "locate: FAIL: %s\n", err);
43 return 1;
44 }
45 printf("keyslot_manifest first_unit=%llu bytes=%llu part_sector=%llu part_byte_offset=%llu\n",
46 (unsigned long long)l.first_unit, (unsigned long long)l.byte_length, (unsigned long long)l.part_sector,
47 (unsigned long long)l.part_byte_offset);
48 printf("wrapped_k_vol_byte_offset=%llu wrap_tag_byte_offset=%llu\n", (unsigned long long)l.wrapped_kvol_offset,
49 (unsigned long long)l.wrap_tag_offset);
50 return 0;
51}