IBM / OpenJCEPlus

This project makes use of Java and C/C++. This project will create OpenJCEPlus and OpenJCEPlusFIPS cryptographic providers which are implementations of the Java™ Cryptography Extensions (JCE) APIs. The actual cryptographic code will come from the OpenCryptographyKitC project which is based on OpenSSL.
Apache License 2.0
4 stars 10 forks source link

Force chop size between 1 and 4096 in BaseByteArrayOutputDelayTest #113

Closed jasonkatonica closed 2 weeks ago

jasonkatonica commented 2 weeks ago

Occasionally while executing the test TestByteArrayOutputDelay we observe the following exception:

java.lang.IllegalArgumentException: chopSize must be greater than zero; given: 0
    at openjceplus/ibm.jceplus.junit.base.BaseByteArrayOutputDelayTest.testByteArrayOutputDelay(BaseByteArrayOutputDelayTest.java:139)
    at openjceplus/ibm.jceplus.junit.base.BaseByteArrayOutputDelayTest.testRandom(BaseByteArrayOutputDelayTest.java:89)
    at openjceplus/ibm.jceplus.junit.base.BaseByteArrayOutputDelayTest.testRandom(BaseByteArrayOutputDelayTest.java:65)
    at java.base/java.lang.reflect.Method.invoke(Method.java:586)
    at junit.framework.TestCase.runTest(TestCase.java:177)
    at junit.framework.TestCase.runBare(TestCase.java:142)
    at junit.framework.TestResult$1.protect(TestResult.java:122)
    at junit.framework.TestResult.runProtected(TestResult.java:142)
    at junit.framework.TestResult.run(TestResult.java:125)
    at junit.framework.TestCase.run(TestCase.java:130)
    at junit.framework.TestSuite.runTest(TestSuite.java:241)
    at junit.framework.TestSuite.run(TestSuite.java:236)

When generating a random number in the BaseByteArrayOutputDelayTest test numbers can be between 0 and 4096. If 0 is randomly selected this test can fail with the above error. This update forces the value to be generated between 1 and 4096.

Signed-off-by: Jason Katonica katonica@us.ibm.com