Skip to content

[provisioning] Backport #25167 #27656

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion sw/host/provisioning/ft/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ package(default_visibility = ["//visibility:public"])

filegroup(
name = "ft_all",
testonly = True,
srcs = [
":ft_{}".format(sku)
for sku in EARLGREY_SKUS.keys()
Expand Down
11 changes: 2 additions & 9 deletions sw/host/provisioning/orchestrator/src/device_id.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# SPDX-License-Identifier: Apache-2.0
"""Module for computing OpenTitan device IDs."""

import binascii
import struct
from dataclasses import dataclass

Expand Down Expand Up @@ -74,7 +73,6 @@ class DeviceId():
si_creator_id: A 16-bit number assigned by the OpenTitan project.
product_id: A 16-bit number assigned by the OpenTitan project.
din: A 64-bit unique identifier.
crc32: A CRC32 over the above 96-bits.
package_id: A 16-bit number indicating which package the chip is in.
sku_id: A 32-bit string indicating the SKU the chip was provisioned for.
"""
Expand Down Expand Up @@ -103,14 +101,9 @@ def __init__(self, sku_config: SkuConfig, din: DeviceIdentificationNumber):
# - Wafer Y coord.
self.din = din

# Build CRC32 over HW origin + DIN.
self.crc32 = binascii.crc32(
struct.pack("<IQ", self._hw_origin, self.din.to_int()))

# Build base unique ID.
self._base_uid = bytes_to_int(
struct.pack("<IQI", self._hw_origin, self.din.to_int(),
self.crc32))
struct.pack("<IQI", self._hw_origin, self.din.to_int(), 0))

# Build SKU specific field.
self.package_id = sku_config.package_id
Expand Down Expand Up @@ -147,12 +140,12 @@ def pretty_print(self):
print("DIN Wafer: {}".format(self.din.wafer))
print("DIN Wafer X Coord: {}".format(self.din.wafer_x_coord))
print("DIN Wafer Y Coord: {}".format(self.din.wafer_y_coord))
print("Reserved: {}".format(hex(0)))
print("SKU ID: {} ({})".format(
format_hex(self.sku_id),
self.sku_id.to_bytes(length=4, byteorder="big").decode("utf-8")))
print("Package ID: {} ({})".format(self.package_id,
self._package))
print("CRC32: {}".format(hex(self.crc32)))

def __str__(self):
return self.to_hexstr()
2 changes: 1 addition & 1 deletion sw/host/provisioning/orchestrator/src/ot_dut.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def run_ft(self) -> None:
fw_bundle_bin = fw_bundle_bin.format(self.sku_config.name,
"silicon_creator")

# Assemble bazel command.
# Assemble FT command.
# TODO: support multiple CAs
# TODO: support cloud KMS CAs
# TODO: autocompute measurements of expected ROM_EXT + Owner FW payloads
Expand Down
7 changes: 2 additions & 5 deletions sw/host/provisioning/orchestrator/tests/device_id_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# SPDX-License-Identifier: Apache-2.0
"""Unittests for device_id.py module."""

import binascii
import unittest

import hjson
Expand Down Expand Up @@ -105,10 +104,8 @@ def test_din_reserved_field(self):
format_hex(actual_field, width=2),
format_hex(expected_field, width=2)))

def test_crc32_field(self):
expected_field = binascii.crc32(
((self.din.to_int() << 32) | 0x00024001).to_bytes(
length=12, byteorder="little"))
def test_uid_reserved_field(self):
expected_field = 0
actual_field = (self.device_id.to_int() >> 96) & 0xffffffff
self.assertEqual(
actual_field, expected_field, "actual: {}, expected: {}.".format(
Expand Down
Loading