Skip to content

WP2: HMAC-SHA256 integrity (replace CRC32) #6

Description

@Brad-Edwards

Context

CRC32 is trivially collisible. A cheat can modify .text and compute a patch that preserves the CRC32. Graviton3 has ARMv8.4 SHA extensions making HMAC-SHA256 fast.

Work

  • New daemon/hmac_sha256.{h,c}: wrapper around libcrypto HMAC. Random 256-bit key from /dev/urandom at daemon start.
  • Modify daemon/integrity.{h,c}: baseline_crc -> baseline_hmac[32]. Keep owl_crc32() for heartbeat state_hash.
  • New tests/test_hmac_sha256.c. Modify tests/test_integrity.c.
  • Add -lssl -lcrypto to daemon/Makefile.

Tests

10 unit tests (RFC 4231 known vectors, empty input, large input, key change, same data same hash, integrity baseline+check round-trip, violation detection).

Part of v2.0.0

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions