I’ve been banging my head against the wall for a while now. I have a library that depends on openssl (and by customer requirements FIPS enabled). Then I use that library from Java via JNI (Windows). I’ve tried all kind of things and I have narrowed down the problem to the following:
Whenever I try to load JUST the openssl library from Java with FIPS enabled, it gives the following error
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)
If I use 1.7u80 JRE it loads fine. But it fails with JRE 1.8u65. Both x86.
If I compile libeay32 without FIPS then it works fine.
I thought it might have something to do with it being loaded in a fixed memory address (0xFB00000) so I tried others (0xA000000, 0x100000) and it still failed with the same error.
This is the code for loading the 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();
}
}
The OpenSsl version is 1.0.0.1q and FIPS 2.0.5
Any ideas or suggestions?