现在我已经把头撞在墙上了。 我有一个依赖于openssl的库(以及由客户要求FIPS启用)。 然后我通过JNI(Windows)使用Java库。 我已经尝试过所有的事情,并且把问题的范围缩小到了以下几点:
每当我尝试从启用了FIPS的Java加载JUST openssl库时,它会给出以下错误
java.lang.UnsatisfiedLinkError: C:\Users\Joaquin\Downloads\libeay32\q\x86\libeay32.dll: Attempt to access invalid address at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(Unknown Source) at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at aspera.com.utilities.TestDllLoad.loadLibrary(TestDllLoad.java:31) at aspera.com.utilities.TestDllLoad.main(TestDllLoad.java:19)
如果我使用1.7u80 JRE,它会加载正常。 但是它与JRE 1.8u65失败。 两个x86。
如果我没有FIPS编译libeay32,那么它工作正常。
我认为这可能与它被加载到一个固定的内存地址(0xFB00000)有关,所以我尝试了其他人(0xA000000,0x100000),它仍然失败,同样的错误。
这是加载DLL的代码:
/** * @param args the absolute path to the dll to test */ public static void main(String[] pArgs) { if (pArgs.length < 1) { System.out.println("Usage: TestDllLoad absolute/path/to/dll"); System.exit(1);; } File dll = new File(pArgs[0]); try { Runtime.getRuntime().load(dll.getAbsolutePath()); } catch (Throwable t) { t.printStackTrace(); } }
OpenSsl版本是1.0.0.1q和FIPS 2.0.5
任何想法或build议?