Commit graph

4 commits

Author SHA1 Message Date
Leonardo Francisco
78fcfd3cd4 tests: revise comments — remove debug-finding language and issue tracking
Drop 'Regression: Issue #N' / 'Bug #N' numbering, 'dead while loop',
'the old code', 'This catches the bug where' and similar changelog-style
language from test comments. Keep concise descriptions of what each test
validates. Also simplify data-loader test headers and the verify
interrupt comment.
2026-04-22 03:06:34 +00:00
Leonardo Francisco
5cdabef0db validity: format code for consistency and readability 2026-04-22 03:06:34 +00:00
Leonardo Francisco
f35dd0322a validity: externalize proprietary blob data to runtime-loaded files
Remove ~400KB of compiled-in .inc blob files and replace with a runtime
data loader that reads HMAC-SHA256 verified .bin files from disk at
device open time.

New components:
- validity_data.h/c: Runtime data file loader with HMAC-SHA256 integrity
  verification. Searches /usr/share/libfprint/validity/ and
  /usr/local/share/libfprint/validity/ for per-device and common data
  files. Skipped entirely in emulation mode.

Changes to existing code:
- validity.c: New OPEN_LOAD_DATA SSM state loads device and common data
  files between firmware info reception and init sequence. Populates TLS
  key pointers from loaded data. Frees data stores on close.
- validity_hal.h/c: Simplified device_table to vid/pid/flash_layout only
  (all blob pointers and partition_sig removed from structs).
- validity_pair.c/h: Updated make_cert, build_partition_flash_cmd,
  build_tls_flash to take data parameters instead of using compiled-in
  arrays. Reset/DBE blob accessors use data store.
- validity_tls.c/h: Removed 4 static key arrays, added pointer fields
  to ValidityTlsState populated from loaded data.
- validity_db.c/h, validity_fwext.c/h: Updated get_write_enable_blob
  to take FpiDeviceValidity* and access data store.
- validity_enroll.c: Updated all 5 callers for new signatures.

Deleted files:
- validity_blobs_0090.inc, validity_blobs_0097.inc,
  validity_blobs_009a.inc, validity_blobs_009d.inc (~400KB)
- validity_pair_constants.inc (~6KB)

Tests (171 total, all passing):
- 15 data loader tests covering: empty store, double-free safety,
  valid/corrupt/too-small/nonexistent file loading, tag enum,
  load_device with missing dir/missing mandatory file/valid files/
  corrupt HMAC, load_common with missing/valid files, enroll
  db_write_enable accessor with empty and populated stores.
- All existing unit and integration tests updated and passing.

The data files are distributed separately via the
libfprint-validity-data package.
2026-04-22 03:06:34 +00:00
Leonardo Francisco
0f5f454c7c Refactor code structure for improved readability and maintainability 2026-04-22 03:06:34 +00:00