Commit e7e3a80
committed
[fix] PSS auto salt-length verify failed due leading zeros
RSABlindedEngine.processBlock() converts the raw modular-exponentiation
result back through BigInteger, which strips leading zero bytes.
When the encoded message (EM) happened to start with 0x00 — roughly a
1-in-256 chance per signature — the returned array was shorter than the
expected emLen = ceil((modBits-1)/8). The hand-rolled PSS parser in
pssAutoSaltLength() used the array length as emLen, which shifted every
subsequent offset (maskedDB, H, the 0x01 separator), causing the
salt-length recovery to fail and verify_pss to return false.
Add a deterministic regression test with a hardcoded signature whose EM
is known to have a leading 0x00 byte for the rsa2048 test fixture key.1 parent 63d0b43 commit e7e3a80
File tree
2 files changed
+37
-2
lines changed- src
- main/java/org/jruby/ext/openssl
- test/ruby/rsa
2 files changed
+37
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1095 | 1095 | | |
1096 | 1096 | | |
1097 | 1097 | | |
1098 | | - | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
1099 | 1112 | | |
1100 | 1113 | | |
1101 | | - | |
1102 | 1114 | | |
1103 | 1115 | | |
1104 | 1116 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
291 | 314 | | |
292 | 315 | | |
293 | 316 | | |
| |||
0 commit comments