ast10x0-hace: eliminate remaining panic_is_possible in digest/HMAC path

The no_panics_test scans the compiled ELF and fails if any panic path is
reachable. Two root causes remained in the SHA-2 / HMAC code linked into
the hace_sha256 binary:

- div_by_zero: chunks_exact(4).zip(..) in load_iv / digest_from_context.
  ChunksExact stores its chunk size as a runtime field, so Zip::new emits
  a len / chunk_size division the optimizer cannot prove non-zero.
  Replaced with index-stride loops over length-proven [u8; 4] arrays.

- copy_from_slice len_mismatch_fail: the staging copies in
  HaceDigest::update and HaceHmacCtx::update copy between two range-sliced
  &[u8] of equal-by-construction length the optimizer cannot prove equal.
  Replaced with zip element-wise copies (no length assert, no division).

Also hardened the AES IV copies (AesCipher::crypt, AesSkin CBC chaining)
to use <[u8; AES_BLOCK]>::try_from array assignment instead of
copy_from_slice, per the project no-panic patterns.

no_panics_test now PASSES; nm shows no panic_is_possible, len_mismatch_fail,
or div_by_zero symbols.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
4 files changed
tree: 48c99d7b9f1dbd970cf56159134813b482fbf182
  1. .github/
  2. docs/
  3. drivers/
  4. hal/
  5. openprot/
  6. platform/
  7. presubmit/
  8. services/
  9. target/
  10. third_party/
  11. tools/
  12. util/
  13. .bazelignore
  14. .bazelrc
  15. .bazelversion
  16. .clang-format
  17. .gitignore
  18. .semgrepignore
  19. BUILD.bazel
  20. CONTRIBUTING.md
  21. LICENSE
  22. MODULE.bazel
  23. MODULE.bazel.lock
  24. pw
  25. README.md
  26. rust-toolchain.toml
  27. workflows.json
README.md

OpenPRoT

Technical Charter

The OpenPRoT Technical Charter can be found at https://github.com/OpenPRoT/.github/blob/main/GOVERNANCE.md

Getting Started

NOTE: We are converting our build system to bazel. We recommend installing bazelisk to automatically manage bazel versions.

Available Tasks

You can run tasks using the Pigweed workflow launcher pw or bazel.

  • ./pw presubmit - Run presubmit checks: formatting, license checks, C/C++ header checks and clippy.
  • ./pw format - Run the code formatters.
  • bazel test //... - Run all tests.
  • bazel build //docs - Build documentation.

Development

The project is structured as a bazel module.

Requirements

  • Bazel. We recommend installing bazelisk to automatically manage bazel versions.

No additional tools are required - all dependencies are managed by bazel.