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
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
daemon/hmac_sha256.{h,c}: wrapper around libcrypto HMAC. Random 256-bit key from /dev/urandom at daemon start.daemon/integrity.{h,c}:baseline_crc->baseline_hmac[32]. Keepowl_crc32()for heartbeat state_hash.tests/test_hmac_sha256.c. Modifytests/test_integrity.c.-lssl -lcryptotodaemon/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