mirror of
https://github.com/luxfi/lattice.git
synced 2026-09-24 00:25:44 +00:00
fix: nosec annotation for constant-time ctLt (gosec G115)
This commit is contained in:
+3
-2
@@ -217,6 +217,7 @@ func (s *CBDSampler) cbdGeneric(coeffs [][]uint64, moduli []uint64, N int, buf [
|
||||
|
||||
// ctLt returns 0xFFFFFFFFFFFFFFFF if a < b, 0 otherwise (constant-time).
|
||||
func ctLt(a, b uint64) uint64 {
|
||||
// If a < b, then a - b underflows, setting the high bit
|
||||
return uint64(int64(a-b) >> 63)
|
||||
// If a < b, then a - b underflows, setting the high bit.
|
||||
/* #nosec G115 -- intentional: constant-time comparison requires signed arithmetic on the borrow bit */
|
||||
return uint64(int64(a-b) >> 63) //nolint:gosec
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user