This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Validate Phase-1.0AL against the exact pinned SDK source."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import hashlib
|
||||
import json
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def digest(path: Path) -> tuple[int, str]:
|
||||
data = path.read_bytes()
|
||||
return len(data), hashlib.sha256(data).hexdigest()
|
||||
|
||||
|
||||
def main() -> int:
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--root", type=Path, required=True)
|
||||
parser.add_argument("--sdk-root", type=Path, required=True)
|
||||
args = parser.parse_args()
|
||||
data = json.loads((args.root / "manifests/retroarch/phase-1.0al-mdbg-copy-audit.json").read_text(encoding="utf-8"))
|
||||
bindings = data["source_bindings"]
|
||||
assert hashlib.sha256((args.root / "manifests/retroarch/phase-1.0ak-hybrid-composition.json").read_bytes()).hexdigest() == bindings["phase10ak_manifest_sha256"]
|
||||
sdk_commit = subprocess.run(["git", "rev-parse", "HEAD"], cwd=args.sdk_root,
|
||||
check=True, capture_output=True, text=True).stdout.strip()
|
||||
assert sdk_commit == bindings["sdk_commit"]
|
||||
for prefix, relative in (("mdbg_c", "crt/mdbg.c"),
|
||||
("public_header", "include/ps5/mdbg.h")):
|
||||
size, sha256 = digest(args.sdk_root / relative)
|
||||
assert size == bindings[f"{prefix}_size"]
|
||||
assert sha256 == bindings[f"{prefix}_sha256"]
|
||||
findings = data["findings"]
|
||||
assert findings["target_may_be_partially_mutated_on_error"] is True
|
||||
assert findings["return_zero_proves_complete_copy"] is False
|
||||
assert findings["monotonic_deadline_present"] is False
|
||||
assert not any(data["authorizations"].values())
|
||||
assert data["decision"]["direct_sdk_mdbg_copy_reuse_allowed"] is False
|
||||
print("Phase-1.0AL mdbg copy audit validation passed")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
Reference in New Issue
Block a user