Skip to content

Fix unaligned memory access in ML-DSA#10816

Draft
kojiws wants to merge 1 commit into
wolfSSL:masterfrom
kojiws:fix_mem_cast_on_mldsa
Draft

Fix unaligned memory access in ML-DSA#10816
kojiws wants to merge 1 commit into
wolfSSL:masterfrom
kojiws:fix_mem_cast_on_mldsa

Conversation

@kojiws

@kojiws kojiws commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Description

Fix unaligned memory access in ML-DSA (Dilithium) encoding and decoding functions in wc_mldsa.c. Direct casts from byte* to word32*/word16*/sword32* are replaced with writeUnalignedWord32, readUnalignedWord32, and byte-by-byte access, which are safe on strict-alignment platforms such as ARM and AArch64.

Testing

Use gcc -DHAVE_CONFIG_H -I. -DWOLFSSL_MLDSA_ALIGNMENT=0 -Wcast-align -c wolfcrypt/src/wc_mldsa.c to verify no new cast violations are introduced.

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@kojiws kojiws self-assigned this Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant