Skip to content

Commit 34b7f4d

Browse files
Use shorter message to avoid error in RSA/ECB/NoPadding benchmark (#1227)
The message needs to be smaller than the key not just in number of bytes, but in absolute bitwise value. Having the key and message be the exact same number of bytes (when no padding is added) and be created randomly leads to cases where this condition does not apply and the operations fail. To ensure that this doesn't happen, we make the message one byte smaller. Signed-off-by: Kostas Tsiounis <kostas.tsiounis@ibm.com>
1 parent 4cf54a2 commit 34b7f4d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/test/java/ibm/jceplus/jmh/RSACipherBenchmark.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public void setup() throws Exception {
5151
super.setup(keySize, "RSA", provider);
5252

5353
Map<String, Integer> paddings = new HashMap<>();
54-
paddings.put("NoPadding", 0);
54+
paddings.put("NoPadding", 1);
5555
paddings.put("PKCS1Padding", 11);
5656
paddings.put("OAEPPadding", (2 * 20 + 2)); // SHA-1 size is 20 bytes
5757

0 commit comments

Comments
 (0)