ML-DSA Wconversion fixes#10399
Open
Frauschi wants to merge 1 commit intowolfSSL:masterfrom
Open
Conversation
624af9c to
591f28a
Compare
591f28a to
78a27c4
Compare
douzzer
requested changes
May 5, 2026
Contributor
douzzer
left a comment
There was a problem hiding this comment.
seeing some new warnings from this currently, atop current (6a3eb6f) master:
[quantum-safe-wolfssl-all-clang-tidy] [29 of 42] [41a62b2e29]
configure with clang-tidy... real 0m12.471s user 0m0.002s sys 0m0.005s
build...075e6a3f8a (<tobias@wolfssl.com> 2026-05-05 15:21:15 +0200 2835) state[4*4 + l] = (word64)(0x1f0000U + ((word32)k << 8) + (word32)l);
/tmp/tmp.4346_38755/wolfssl_test_workdir.2622907/wolfssl/wolfcrypt/src/dilithium.c:2835:30: warning: either cast from 'unsigned int' to 'word64' (aka 'unsigned long') is ineffective, or there is loss of precision before the conversion [bugprone-misplaced-widening-cast]
2835 | state[4*4 + l] = (word64)(0x1f0000U + ((word32)k << 8) + (word32)l);
| ^
075e6a3f8a (<tobias@wolfssl.com> 2026-05-05 15:21:15 +0200 2942) state[4*4 + l] = (word64)(0x1f0000U + ((word32)((k + l) / 5) << 8) +
/tmp/tmp.4346_38755/wolfssl_test_workdir.2622907/wolfssl/wolfcrypt/src/dilithium.c:2942:30: warning: either cast from 'unsigned int' to 'word64' (aka 'unsigned long') is ineffective, or there is loss of precision before the conversion [bugprone-misplaced-widening-cast]
2942 | state[4*4 + l] = (word64)(0x1f0000U + ((word32)((k + l) / 5) << 8) +
| ^
075e6a3f8a (<tobias@wolfssl.com> 2026-05-05 15:21:15 +0200 2997) state[4*4 + l] = (word64)(0x1f0000U + (5U << 8) + (word32)(l + 3));
/tmp/tmp.4346_38755/wolfssl_test_workdir.2622907/wolfssl/wolfcrypt/src/dilithium.c:2997:26: warning: either cast from 'unsigned int' to 'word64' (aka 'unsigned long') is ineffective, or there is loss of precision before the conversion [bugprone-misplaced-widening-cast]
2997 | state[4*4 + l] = (word64)(0x1f0000U + (5U << 8) + (word32)(l + 3));
| ^
075e6a3f8a (<tobias@wolfssl.com> 2026-05-05 15:21:15 +0200 3088) state[4*4 + l] = (word64)(0x1f0000U + ((word32)((k + l) / 7) << 8) +
/tmp/tmp.4346_38755/wolfssl_test_workdir.2622907/wolfssl/wolfcrypt/src/dilithium.c:3088:30: warning: either cast from 'unsigned int' to 'word64' (aka 'unsigned long') is ineffective, or there is loss of precision before the conversion [bugprone-misplaced-widening-cast]
3088 | state[4*4 + l] = (word64)(0x1f0000U + ((word32)((k + l) / 7) << 8) +
| ^
075e6a3f8a (<tobias@wolfssl.com> 2026-05-05 15:21:15 +0200 3700) state[8*4 + l] = (word64)(0x1f0000U + ((word32)k * 4U + (word32)l));
/tmp/tmp.4346_38755/wolfssl_test_workdir.2622907/wolfssl/wolfcrypt/src/dilithium.c:3700:30: warning: either cast from 'unsigned int' to 'word64' (aka 'unsigned long') is ineffective, or there is loss of precision before the conversion [bugprone-misplaced-widening-cast]
3700 | state[8*4 + l] = (word64)(0x1f0000U + ((word32)k * 4U + (word32)l));
| ^
075e6a3f8a (<tobias@wolfssl.com> 2026-05-05 15:21:15 +0200 3813) state[8*4 + l] = (word64)(0x1f0000U + ((word32)k * 4U + (word32)l));
/tmp/tmp.4346_38755/wolfssl_test_workdir.2622907/wolfssl/wolfcrypt/src/dilithium.c:3813:30: warning: either cast from 'unsigned int' to 'word64' (aka 'unsigned long') is ineffective, or there is loss of precision before the conversion [bugprone-misplaced-widening-cast]
3813 | state[8*4 + l] = (word64)(0x1f0000U + ((word32)k * 4U + (word32)l));
| ^
075e6a3f8a (<tobias@wolfssl.com> 2026-05-05 15:21:15 +0200 3866) state[8*4 + l] = (word64)(0x1f0000U + 8U + (word32)l);
/tmp/tmp.4346_38755/wolfssl_test_workdir.2622907/wolfssl/wolfcrypt/src/dilithium.c:3866:26: warning: either cast from 'unsigned int' to 'word64' (aka 'unsigned long') is ineffective, or there is loss of precision before the conversion [bugprone-misplaced-widening-cast]
3866 | state[8*4 + l] = (word64)(0x1f0000U + 8U + (word32)l);
| ^
075e6a3f8a (<tobias@wolfssl.com> 2026-05-05 15:21:15 +0200 3968) state[8*4 + l] = (word64)(0x1f0000U + ((word32)k * 4U + (word32)l));
/tmp/tmp.4346_38755/wolfssl_test_workdir.2622907/wolfssl/wolfcrypt/src/dilithium.c:3968:30: warning: either cast from 'unsigned int' to 'word64' (aka 'unsigned long') is ineffective, or there is loss of precision before the conversion [bugprone-misplaced-widening-cast]
3968 | state[8*4 + l] = (word64)(0x1f0000U + ((word32)k * 4U + (word32)l));
| ^
075e6a3f8a (<tobias@wolfssl.com> 2026-05-05 15:21:15 +0200 4021) state[8*4 + l] = (word64)(0x1f0000U + 12U + (word32)l);
/tmp/tmp.4346_38755/wolfssl_test_workdir.2622907/wolfssl/wolfcrypt/src/dilithium.c:4021:26: warning: either cast from 'unsigned int' to 'word64' (aka 'unsigned long') is ineffective, or there is loss of precision before the conversion [bugprone-misplaced-widening-cast]
4021 | state[8*4 + l] = (word64)(0x1f0000U + 12U + (word32)l);
| ^
075e6a3f8a (<tobias@wolfssl.com> 2026-05-05 15:21:15 +0200 4224) state[8*4 + l] = (word64)(0x1f0000U + (word32)kappa + (word32)l);
/tmp/tmp.4346_38755/wolfssl_test_workdir.2622907/wolfssl/wolfcrypt/src/dilithium.c:4224:26: warning: either cast from 'unsigned int' to 'word64' (aka 'unsigned long') is ineffective, or there is loss of precision before the conversion [bugprone-misplaced-widening-cast]
4224 | state[8*4 + l] = (word64)(0x1f0000U + (word32)kappa + (word32)l);
| ^
075e6a3f8a (<tobias@wolfssl.com> 2026-05-05 15:21:15 +0200 4294) state[8*4 + l] = (word64)(0x1f0000U + (word32)kappa + (word32)l);
/tmp/tmp.4346_38755/wolfssl_test_workdir.2622907/wolfssl/wolfcrypt/src/dilithium.c:4294:26: warning: either cast from 'unsigned int' to 'word64' (aka 'unsigned long') is ineffective, or there is loss of precision before the conversion [bugprone-misplaced-widening-cast]
4294 | state[8*4 + l] = (word64)(0x1f0000U + (word32)kappa + (word32)l);
| ^
075e6a3f8a (<tobias@wolfssl.com> 2026-05-05 15:21:15 +0200 4372) state[8*4 + l] = (word64)(0x1f0000U + (word32)kappa + (word32)l);
/tmp/tmp.4346_38755/wolfssl_test_workdir.2622907/wolfssl/wolfcrypt/src/dilithium.c:4372:26: warning: either cast from 'unsigned int' to 'word64' (aka 'unsigned long') is ineffective, or there is loss of precision before the conversion [bugprone-misplaced-widening-cast]
4372 | state[8*4 + l] = (word64)(0x1f0000U + (word32)kappa + (word32)l);
| ^
075e6a3f8a (<tobias@wolfssl.com> 2026-05-05 15:21:15 +0200 4401) state[8*4 + l] = (word64)(0x1f0000U + (word32)kappa + (word32)l);
/tmp/tmp.4346_38755/wolfssl_test_workdir.2622907/wolfssl/wolfcrypt/src/dilithium.c:4401:26: warning: either cast from 'unsigned int' to 'word64' (aka 'unsigned long') is ineffective, or there is loss of precision before the conversion [bugprone-misplaced-widening-cast]
4401 | state[8*4 + l] = (word64)(0x1f0000U + (word32)kappa + (word32)l);
| ^
Suppressed 18 warnings (18 in non-user code).
real 0m16.168s user 0m0.061s sys 0m0.075s
clang-tidy reported defects in 1 file(s).
78a27c4 to
96a220b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add ML-DSA to Wconversion CI tests and add required casts to fix all errors. Required for FIPS 140-3 certification.