Commit 401887a
authored
streebog: fix bit-length counter carry propagation to 512-bit (#759)
The update_n() implementation propagated carry only through limbs 1..6,
effectively making n a 448-bit counter. According to GOST R 34.11-2012
(RFC 6986), the total processed bit-length must be tracked modulo 2^512.
This change extends the loop to include limb 7 so carry ripples through
all eight 64-bit words and any further carry is discarded, thus
restoring correct modulo 2^512 semantics. Although this bug only
manifests for astronomically large inputs, it is a correctness issue and
brings the implementation in line with the specification and the
behavior of similar counters in this codebase.1 parent 44b2e75 commit 401887a
1 file changed
+37
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
0 commit comments