Skip to content

Commit 077126b

Browse files
committed
manufacturing database: devkey revocation, OTP signature present
1 parent 1c9be0e commit 077126b

File tree

4 files changed

+41
-6
lines changed

4 files changed

+41
-6
lines changed

debian/postinst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ MFG_DB_SCHEMA="id integer primary key,
113113
jtag_locked integer DEFAULT NULL,
114114
eeprom_write_protected integer DEFAULT NULL,
115115
pubkey_programmed integer DEFAULT NULL,
116+
devkey_revoked integer DEFAULT NULL,
116117
signed_boot_enabled integer DEFAULT NULL,
117118
os_image_filename varchar(255) DEFAULT NULL,
118119
os_image_sha256 char(64) DEFAULT NULL,
@@ -133,7 +134,7 @@ else
133134
CURRENT_COLUMNS=$(sqlite3 "$MFG_DB_PATH" "PRAGMA table_info(devices);" | awk -F'|' '{print $2}' | tr '\n' ',')
134135

135136
# Check if any expected columns are missing
136-
for COL in id boardname serial eth_mac wifi_mac bt_mac mmc_size mmc_cid rpi_duid board_revision processor memory manufacturer secure jtag_locked eeprom_write_protected pubkey_programmed signed_boot_enabled os_image_filename os_image_sha256 provision_ts; do
137+
for COL in id boardname serial eth_mac wifi_mac bt_mac mmc_size mmc_cid rpi_duid board_revision processor memory manufacturer secure jtag_locked eeprom_write_protected pubkey_programmed devkey_revoked signed_boot_enabled os_image_filename os_image_sha256 provision_ts; do
137138
if ! echo "$CURRENT_COLUMNS" | grep -q "$COL"; then
138139
echo "Migration needed: column $COL is missing from manufacturing.db devices table"
139140

docs/api_endpoints.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ The endpoint returns a JSON array where each element represents a provisioned de
5050
"jtag_locked": "1",
5151
"eeprom_write_protected": "1",
5252
"pubkey_programmed": "1",
53+
"devkey_revoked": "0",
5354
"signed_boot_enabled": "1",
5455
"os_image_filename": "raspios-2025-04-01.img",
5556
"os_image_sha256": "4f2d9c5b0e3b1d8a9c1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b7c8d9e0f1a2b3c",

host-support/manufacturing-data

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ metadata_gather() {
110110
jtag_locked integer DEFAULT NULL,
111111
eeprom_write_protected integer DEFAULT NULL,
112112
pubkey_programmed integer DEFAULT NULL,
113+
devkey_revoked integer DEFAULT NULL,
113114
signed_boot_enabled integer DEFAULT NULL,
114115
os_image_filename varchar(255) DEFAULT NULL,
115116
os_image_sha256 char(64) DEFAULT NULL,
@@ -142,14 +143,42 @@ metadata_gather() {
142143
EEPROM_WP_VALUE="0"
143144
fi
144145

145-
# Public key programming: 1 for secure provisioning, 0 for non-secure, NULL for unknown
146+
# Public key programming: read from fastboot metadata 'signed-otp'
147+
# Map 'present' -> 1, 'not present' -> 0, common boolean forms as fallback, else NULL
146148
PUBKEY_PROGRAMMED_VALUE="NULL"
147-
if [ "${SECURE}" = "1" ]; then
148-
PUBKEY_PROGRAMMED_VALUE="1"
149-
elif [ "${SECURE}" = "0" ]; then
150-
PUBKEY_PROGRAMMED_VALUE="0"
149+
SIGNED_OTP="$(metadata_get "signed-otp")"
150+
if [ -n "${SIGNED_OTP}" ]; then
151+
SIGNED_OTP_LC="$(printf "%s" "${SIGNED_OTP}" | tr '[:upper:]' '[:lower:]')"
152+
case "${SIGNED_OTP_LC}" in
153+
present|1|true|yes)
154+
PUBKEY_PROGRAMMED_VALUE="1"
155+
;;
156+
"not present"|notpresent|0|false|no)
157+
PUBKEY_PROGRAMMED_VALUE="0"
158+
;;
159+
*)
160+
: # leave as NULL
161+
;;
162+
esac
151163
fi
152164

165+
# Dev key revoked (signed-devkey): 'present' -> 1, 'not present' -> 0, else NULL
166+
DEVKEY_REVOKED_VALUE="NULL"
167+
SIGNED_DEVKEY="$(metadata_get "signed-devkey")"
168+
if [ -n "${SIGNED_DEVKEY}" ]; then
169+
SIGNED_DEVKEY_LC="$(printf "%s" "${SIGNED_DEVKEY}" | tr '[:upper:]' '[:lower:]')"
170+
case "${SIGNED_DEVKEY_LC}" in
171+
present)
172+
DEVKEY_REVOKED_VALUE="1"
173+
;;
174+
"not present"|notpresent)
175+
DEVKEY_REVOKED_VALUE="0"
176+
;;
177+
*)
178+
: ;;
179+
esac
180+
fi
181+
153182
# Signed boot: 1 for secure provisioning, 0 for non-secure, NULL for unknown
154183
SIGNED_BOOT_VALUE="NULL"
155184
if [ "${SECURE}" = "1" ]; then
@@ -195,6 +224,7 @@ metadata_gather() {
195224
jtag_locked, \
196225
eeprom_write_protected, \
197226
pubkey_programmed, \
227+
devkey_revoked, \
198228
signed_boot_enabled, \
199229
os_image_filename, \
200230
os_image_sha256 \
@@ -215,6 +245,7 @@ metadata_gather() {
215245
${JTAG_LOCKED_VALUE}, \
216246
${EEPROM_WP_VALUE}, \
217247
${PUBKEY_PROGRAMMED_VALUE}, \
248+
${DEVKEY_REVOKED_VALUE}, \
218249
${SIGNED_BOOT_VALUE}, \
219250
'${OS_IMAGE_FILENAME}', \
220251
'${OS_IMAGE_SHA256}' \

provisioner-service/src/views/manufacturing.csp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,7 @@
288288
<th>JTAG Locked</th>
289289
<th>EEPROM WP</th>
290290
<th>Pubkey Prog.</th>
291+
<th>Devkey Revoked</th>
291292
<th>Signed Boot</th>
292293
<th>OS Image Filename</th>
293294
<th>OS Image SHA256</th>
@@ -318,6 +319,7 @@
318319
<td class="security-field">${formatSecurityField(device.jtag_locked)}</td>
319320
<td class="security-field">${formatSecurityField(device.eeprom_write_protected)}</td>
320321
<td class="security-field">${formatSecurityField(device.pubkey_programmed)}</td>
322+
<td class="security-field">${formatSecurityField(device.devkey_revoked)}</td>
321323
<td class="security-field">${formatSecurityField(device.signed_boot_enabled)}</td>
322324
<td>${device.os_image_filename || ''}</td>
323325
<td style="font-family: monospace;">${device.os_image_sha256 || ''}</td>

0 commit comments

Comments
 (0)