|
@@ -55,6 +55,8 @@ def _copy_bound_receipt(
|
|
|
commit: str,
|
|
commit: str,
|
|
|
bitstream_sha256: str,
|
|
bitstream_sha256: str,
|
|
|
project_config_sha256: str,
|
|
project_config_sha256: str,
|
|
|
|
|
+ preserve_bitstream_sha256: bool = False,
|
|
|
|
|
+ require_bitstream_sha256: bool = False,
|
|
|
) -> dict[str, Any]:
|
|
) -> dict[str, Any]:
|
|
|
try:
|
|
try:
|
|
|
value = json.loads(Path(source).read_text(encoding="utf-8-sig"))
|
|
value = json.loads(Path(source).read_text(encoding="utf-8-sig"))
|
|
@@ -65,7 +67,6 @@ def _copy_bound_receipt(
|
|
|
bindings = {
|
|
bindings = {
|
|
|
"verification_run_id": run_id,
|
|
"verification_run_id": run_id,
|
|
|
"commit": commit,
|
|
"commit": commit,
|
|
|
- "bitstream_sha256": bitstream_sha256,
|
|
|
|
|
"project_config_sha256": project_config_sha256,
|
|
"project_config_sha256": project_config_sha256,
|
|
|
}
|
|
}
|
|
|
for field, expected in bindings.items():
|
|
for field, expected in bindings.items():
|
|
@@ -73,6 +74,16 @@ def _copy_bound_receipt(
|
|
|
if observed not in {None, "", expected}:
|
|
if observed not in {None, "", expected}:
|
|
|
raise ValueError(f"receipt binding mismatch for {field}: {source}")
|
|
raise ValueError(f"receipt binding mismatch for {field}: {source}")
|
|
|
value[field] = expected
|
|
value[field] = expected
|
|
|
|
|
+ if not preserve_bitstream_sha256:
|
|
|
|
|
+ observed = value.get("bitstream_sha256")
|
|
|
|
|
+ if value.get("status") == "pass" and require_bitstream_sha256 and observed != bitstream_sha256:
|
|
|
|
|
+ raise ValueError(f"authoritative receipt bitstream binding mismatch: {source}")
|
|
|
|
|
+ if observed not in {None, ""} and observed != bitstream_sha256:
|
|
|
|
|
+ raise ValueError(f"receipt bitstream binding mismatch: {source}")
|
|
|
|
|
+ if observed not in {None, ""}:
|
|
|
|
|
+ value["bitstream_sha256"] = bitstream_sha256
|
|
|
|
|
+ elif value.get("status") == "pass" and not SHA256_RE.fullmatch(str(value.get("bitstream_sha256", ""))):
|
|
|
|
|
+ raise ValueError(f"confirmation receipt requires its own bitstream SHA256: {source}")
|
|
|
value["commit_full"] = commit
|
|
value["commit_full"] = commit
|
|
|
value["source_receipt_sha256"] = sha256_file(source)
|
|
value["source_receipt_sha256"] = sha256_file(source)
|
|
|
_write_json(destination, value)
|
|
_write_json(destination, value)
|
|
@@ -628,6 +639,8 @@ def create_unverified_package(
|
|
|
commit=commit_full,
|
|
commit=commit_full,
|
|
|
bitstream_sha256=bitstream_sha256,
|
|
bitstream_sha256=bitstream_sha256,
|
|
|
project_config_sha256=project_config_sha256,
|
|
project_config_sha256=project_config_sha256,
|
|
|
|
|
+ preserve_bitstream_sha256=name == "td-confirmation",
|
|
|
|
|
+ require_bitstream_sha256=name == "td-primary",
|
|
|
)
|
|
)
|
|
|
else:
|
|
else:
|
|
|
_write_json(
|
|
_write_json(
|
|
@@ -678,7 +691,7 @@ def create_unverified_package(
|
|
|
validation_summary = {
|
|
validation_summary = {
|
|
|
"schema": "prod2u-p4-normal-v3-validation-summary-v1",
|
|
"schema": "prod2u-p4-normal-v3-validation-summary-v1",
|
|
|
"status": "UNVERIFIED",
|
|
"status": "UNVERIFIED",
|
|
|
- "delivery_mode": "urgent_single_td",
|
|
|
|
|
|
|
+ "delivery_mode": "normal_dual_td",
|
|
|
"verification_complete": False,
|
|
"verification_complete": False,
|
|
|
"confirmation_td_present": confirmation_bitstream_sha256 is not None,
|
|
"confirmation_td_present": confirmation_bitstream_sha256 is not None,
|
|
|
"verification_run_id": run_id,
|
|
"verification_run_id": run_id,
|
|
@@ -701,6 +714,11 @@ def create_unverified_package(
|
|
|
"resource_confirmation": {"status": "pass" if confirmation_bitstream_sha256 else "not_run"},
|
|
"resource_confirmation": {"status": "pass" if confirmation_bitstream_sha256 else "not_run"},
|
|
|
},
|
|
},
|
|
|
"hardware_validation": "not_run",
|
|
"hardware_validation": "not_run",
|
|
|
|
|
+ "verification_scope": "offline",
|
|
|
|
|
+ "board_validation": "not_run",
|
|
|
|
|
+ "programming_validation": "not_run",
|
|
|
|
|
+ "COM": False,
|
|
|
|
|
+ "JTAG": False,
|
|
|
}
|
|
}
|
|
|
_write_json(evidence / "validation-summary.json", validation_summary)
|
|
_write_json(evidence / "validation-summary.json", validation_summary)
|
|
|
_write_json(package / "verification_summary.json", validation_summary)
|
|
_write_json(package / "verification_summary.json", validation_summary)
|
|
@@ -708,7 +726,7 @@ def create_unverified_package(
|
|
|
"schema": PACKAGE_INFO_SCHEMA,
|
|
"schema": PACKAGE_INFO_SCHEMA,
|
|
|
"profile": RUNTIME_PROFILE,
|
|
"profile": RUNTIME_PROFILE,
|
|
|
"project_id": PROJECT_ID,
|
|
"project_id": PROJECT_ID,
|
|
|
- "delivery_mode": "urgent_single_td",
|
|
|
|
|
|
|
+ "delivery_mode": "normal_dual_td",
|
|
|
"verification_complete": False,
|
|
"verification_complete": False,
|
|
|
"confirmation_td_present": confirmation_bitstream_sha256 is not None,
|
|
"confirmation_td_present": confirmation_bitstream_sha256 is not None,
|
|
|
"verification_run_id": run_id,
|
|
"verification_run_id": run_id,
|
|
@@ -725,6 +743,9 @@ def create_unverified_package(
|
|
|
"synthesis_input_hash": td_synthesis_input_hash,
|
|
"synthesis_input_hash": td_synthesis_input_hash,
|
|
|
"confirmation_bitstream_sha256": confirmation_bitstream_sha256,
|
|
"confirmation_bitstream_sha256": confirmation_bitstream_sha256,
|
|
|
"confirmation_synthesis_input_hash": confirmation_synthesis_input_hash,
|
|
"confirmation_synthesis_input_hash": confirmation_synthesis_input_hash,
|
|
|
|
|
+ "td_source_manifest_sha256": sha256_file(repo / SOURCE_MANIFEST_PATH),
|
|
|
|
|
+ "canonical_bitstream_build": "primary",
|
|
|
|
|
+ "bitstream_hash_equal": confirmation_bitstream_sha256 == bitstream_sha256 if confirmation_bitstream_sha256 else None,
|
|
|
"td_receipt_sha256": sha256_file(evidence / "td-primary-receipt.json"),
|
|
"td_receipt_sha256": sha256_file(evidence / "td-primary-receipt.json"),
|
|
|
"td_source_receipt_sha256": td_receipt_sha256,
|
|
"td_source_receipt_sha256": td_receipt_sha256,
|
|
|
"confirmation_td_receipt_sha256": sha256_file(evidence / "td-confirmation-receipt.json"),
|
|
"confirmation_td_receipt_sha256": sha256_file(evidence / "td-confirmation-receipt.json"),
|
|
@@ -732,6 +753,11 @@ def create_unverified_package(
|
|
|
"package_selftest_result_sha256": sha256_file(evidence / "package-selftest-result.json"),
|
|
"package_selftest_result_sha256": sha256_file(evidence / "package-selftest-result.json"),
|
|
|
"file_sha256": _package_file_hashes(package),
|
|
"file_sha256": _package_file_hashes(package),
|
|
|
"hardware_validation": "not_run",
|
|
"hardware_validation": "not_run",
|
|
|
|
|
+ "verification_scope": "offline",
|
|
|
|
|
+ "board_validation": "not_run",
|
|
|
|
|
+ "programming_validation": "not_run",
|
|
|
|
|
+ "COM": False,
|
|
|
|
|
+ "JTAG": False,
|
|
|
}
|
|
}
|
|
|
_write_json(package / "package-info.json", package_info)
|
|
_write_json(package / "package-info.json", package_info)
|
|
|
manifest = {
|
|
manifest = {
|
|
@@ -754,8 +780,17 @@ def create_unverified_package(
|
|
|
"td_receipt": "evidence/td-primary-receipt.json",
|
|
"td_receipt": "evidence/td-primary-receipt.json",
|
|
|
"td_receipt_sha256": sha256_file(evidence / "td-primary-receipt.json"),
|
|
"td_receipt_sha256": sha256_file(evidence / "td-primary-receipt.json"),
|
|
|
"td_source_receipt_sha256": td_receipt_sha256,
|
|
"td_source_receipt_sha256": td_receipt_sha256,
|
|
|
|
|
+ "td_source_manifest_sha256": sha256_file(repo / SOURCE_MANIFEST_PATH),
|
|
|
|
|
+ "canonical_bitstream_build": "primary",
|
|
|
|
|
+ "confirmation_bitstream_sha256": confirmation_bitstream_sha256,
|
|
|
|
|
+ "bitstream_hash_equal": confirmation_bitstream_sha256 == bitstream_sha256 if confirmation_bitstream_sha256 else None,
|
|
|
"file_sha256": _package_file_hashes(package),
|
|
"file_sha256": _package_file_hashes(package),
|
|
|
"hardware_validation": "not_run",
|
|
"hardware_validation": "not_run",
|
|
|
|
|
+ "verification_scope": "offline",
|
|
|
|
|
+ "board_validation": "not_run",
|
|
|
|
|
+ "programming_validation": "not_run",
|
|
|
|
|
+ "COM": False,
|
|
|
|
|
+ "JTAG": False,
|
|
|
}
|
|
}
|
|
|
_write_json(package / "package_manifest.json", manifest)
|
|
_write_json(package / "package_manifest.json", manifest)
|
|
|
return package
|
|
return package
|