Skip to content

Commit 09c012b

Browse files
committed
8231357: sun/security/pkcs11/Cipher/TestKATForGCM.java fails on SLES11 using mozilla-nss-3.14
Reviewed-by: clanger, valeriep
1 parent a664c9c commit 09c012b

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

test/jdk/sun/security/pkcs11/Cipher/TestKATForGCM.java

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@
3030
* @summary Known Answer Test for AES cipher with GCM mode support in
3131
* PKCS11 provider.
3232
*/
33-
import java.security.*;
34-
import javax.crypto.*;
35-
import javax.crypto.spec.*;
36-
import java.math.*;
37-
38-
import java.util.*;
33+
import java.security.GeneralSecurityException;
34+
import java.security.Provider;
35+
import java.util.Arrays;
36+
import javax.crypto.Cipher;
37+
import javax.crypto.SecretKey;
38+
import javax.crypto.spec.GCMParameterSpec;
39+
import javax.crypto.spec.SecretKeySpec;
3940

4041
public class TestKATForGCM extends PKCS11Test {
4142

@@ -319,15 +320,21 @@ public void main(Provider p) throws Exception {
319320
System.out.println("Test Passed!");
320321
}
321322
} catch (Exception e) {
322-
double ver = getNSSInfo("nss");
323-
if (ver < 3.251d && p.getName().contains("SunPKCS11-NSS") &&
324-
System.getProperty("os.name").equals("SunOS")) {
325-
// buggy behaviour from solaris on 11.2 OS (nss < 3.251)
326-
System.out.println("Skipping: SunPKCS11-NSS: Old NSS: " + ver);
327-
return; // OK
328-
} else {
329-
throw e;
323+
System.out.println("Exception occured using " + p.getName() + " version " + p.getVersionStr());
324+
325+
if (isNSS(p)) {
326+
double ver = getNSSInfo("nss");
327+
String osName = System.getProperty("os.name");
328+
if (ver < 3.251d && osName.equals("SunOS")) {
329+
// buggy behaviour from solaris on 11.2 OS (nss < 3.251)
330+
System.out.println("Skipping: SunPKCS11-NSS: Old NSS: " + ver);
331+
return; // OK
332+
} else if (ver > 3.139 && ver < 3.15 && osName.equals("Linux")) {
333+
// warn about buggy behaviour on Linux with nss 3.14
334+
System.out.println("Warning: old NSS " + ver + " might be problematic, consider upgrading it");
335+
}
330336
}
337+
throw e;
331338
}
332339
}
333340
}

0 commit comments

Comments
 (0)