ML-KEM, ML-DSA: fix a -Wsign-compare warning. Good news is that it did not impact correctness, as values involved were provably in 0..168. Bug: 503700354 Change-Id: I9f40cb7516945a4fc8ab225340a082fc6a6a6964 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/102627 Presubmit-BoringSSL-Verified: boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com <boringssl-scoped@luci-project-accounts.iam.gserviceaccount.com> Commit-Queue: Adam Langley <agl@google.com> Reviewed-by: Adam Langley <agl@google.com> Auto-Submit: Rudolf Polzer <rpolzer@google.com>
diff --git a/crypto/fipsmodule/mldsa/mldsa.cc.inc b/crypto/fipsmodule/mldsa/mldsa.cc.inc index 004f58d..e0fa058 100644 --- a/crypto/fipsmodule/mldsa/mldsa.cc.inc +++ b/crypto/fipsmodule/mldsa/mldsa.cc.inc
@@ -1203,7 +1203,7 @@ // Branchless sampling as long as there is enough space in the output buffer // even if all sampled numbers are < `kPrime`. size_t i = 0; - for (; i <= int{168 - 3 * kStep} && *done <= int{kDegree - kStep}; + for (; i <= size_t{168 - 3 * kStep} && *done <= int{kDegree - kStep}; i += 3 * kStep) { uint32_t d[kStep]; for (size_t k = 0; k < kStep; ++k) {
diff --git a/crypto/fipsmodule/mlkem/mlkem.cc.inc b/crypto/fipsmodule/mlkem/mlkem.cc.inc index 99ab2d3..8071a42 100644 --- a/crypto/fipsmodule/mlkem/mlkem.cc.inc +++ b/crypto/fipsmodule/mlkem/mlkem.cc.inc
@@ -446,7 +446,7 @@ // Branchless sampling as long as there is enough space in the output buffer // even if all sampled numbers are < `kPrime`. size_t i = 0; - for (; i <= int{168 - 3 * kStep} && *done <= int{DEGREE - 2 * kStep}; + for (; i <= size_t{168 - 3 * kStep} && *done <= int{DEGREE - 2 * kStep}; i += 3 * kStep) { uint16_t d[2 * kStep]; for (size_t k = 0; k < kStep; ++k) {