297 } |
297 } |
298 String osid = osName + "-" |
298 String osid = osName + "-" |
299 + props.getProperty("os.arch") + "-" + props.getProperty("sun.arch.data.model"); |
299 + props.getProperty("os.arch") + "-" + props.getProperty("sun.arch.data.model"); |
300 String[] nssLibDirs = osMap.get(osid); |
300 String[] nssLibDirs = osMap.get(osid); |
301 if (nssLibDirs == null) { |
301 if (nssLibDirs == null) { |
302 System.out.println("Unsupported OS, skipping: " + osid); |
302 System.out.println("Warning: unsupported OS: " + osid |
|
303 + ", please initialize NSS librarys location firstly, skipping test"); |
303 return null; |
304 return null; |
304 } |
305 } |
305 if (nssLibDirs.length == 0) { |
306 if (nssLibDirs.length == 0) { |
306 System.out.println("NSS not supported on this platform, skipping test"); |
307 System.out.println("Warning: NSS not supported on this platform, skipping test"); |
307 return null; |
308 return null; |
308 } |
309 } |
309 String nssLibDir = null; |
310 String nssLibDir = null; |
310 for (String dir : nssLibDirs) { |
311 for (String dir : nssLibDirs) { |
311 if (new File(dir).exists() && |
312 if (new File(dir).exists() && |
312 new File(dir + System.mapLibraryName(library)).exists()) { |
313 new File(dir + System.mapLibraryName(library)).exists()) { |
313 nssLibDir = dir; |
314 nssLibDir = dir; |
314 System.setProperty("pkcs11test.nss.libdir", nssLibDir); |
315 System.setProperty("pkcs11test.nss.libdir", nssLibDir); |
315 break; |
316 break; |
316 } |
317 } |
|
318 } |
|
319 if (nssLibDir == null) { |
|
320 System.out.println("Warning: can't find NSS librarys on this machine, skipping test"); |
|
321 return null; |
317 } |
322 } |
318 return nssLibDir; |
323 return nssLibDir; |
319 } |
324 } |
320 |
325 |
321 static boolean isBadNSSVersion(Provider p) { |
326 static boolean isBadNSSVersion(Provider p) { |
622 PKCS11_BASE + "/nss/lib/windows-i586/".replace('/', SEP)}); |
627 PKCS11_BASE + "/nss/lib/windows-i586/".replace('/', SEP)}); |
623 osMap.put("Windows-amd64-64", new String[]{ |
628 osMap.put("Windows-amd64-64", new String[]{ |
624 PKCS11_BASE + "/nss/lib/windows-amd64/".replace('/', SEP)}); |
629 PKCS11_BASE + "/nss/lib/windows-amd64/".replace('/', SEP)}); |
625 osMap.put("MacOSX-x86_64-64", new String[]{ |
630 osMap.put("MacOSX-x86_64-64", new String[]{ |
626 PKCS11_BASE + "/nss/lib/macosx-x86_64/"}); |
631 PKCS11_BASE + "/nss/lib/macosx-x86_64/"}); |
|
632 osMap.put("Linux-arm-32", new String[]{ |
|
633 "/usr/lib/arm-linux-gnueabi/nss/", |
|
634 "/usr/lib/arm-linux-gnueabihf/nss/"}); |
|
635 osMap.put("Linux-aarch64-64", new String[]{ |
|
636 "/usr/lib/aarch64-linux-gnu/nss/"}); |
627 } |
637 } |
628 |
638 |
629 private final static char[] hexDigits = "0123456789abcdef".toCharArray(); |
639 private final static char[] hexDigits = "0123456789abcdef".toCharArray(); |
630 |
640 |
631 static final boolean badNSSVersion = |
641 static final boolean badNSSVersion = |