diff --git a/.gitignore b/.gitignore index 039af15..a2b6bfc 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,12 @@ report/ IDE/Android/.idea/deploymentTargetDropDown.xml IDE/Android/app/.cxx/ IDE/Android/app/src/main/cpp/wolfssl/ +IDE/WIN/.vs +IDE/WIN/wolfssljni.vcxproj.user +IDE/WIN/DLL Debug +IDE/WIN/DLL Debug FIPS +IDE/WIN/DLL Release +IDE/WIN/DLL Release FIPS # RPM package files rpm/spec diff --git a/IDE/WIN/wolfssljni.props b/IDE/WIN/wolfssljni.props new file mode 100644 index 0000000..504ef07 --- /dev/null +++ b/IDE/WIN/wolfssljni.props @@ -0,0 +1,61 @@ + + + + + ..\..\..\wolfssl + $(wolfSSLDir)\Debug\Win32 + $(wolfSSLDir)\Release\Win32 + $(wolfSSLDir)\Debug\x64 + $(wolfSSLDir)\Release\x64 + $(wolfSSLDir)\DLL Debug\Win32 + $(wolfSSLDir)\DLL Release\Win32 + $(wolfSSLDir)\DLL Debug\x64 + $(wolfSSLDir)\DLL Release\x64 + $(wolfSSLDir)\IDE\WIN10\DLL Debug\Win32 + $(wolfSSLDir)\IDE\WIN10\DLL Release\Win32 + $(wolfSSLDir)\IDE\WIN10\DLL Debug\x64 + $(wolfSSLDir)\IDE\WIN10\DLL Release\x64 + + + + + $(wolfSSLDir) + + + $(wolfSSLDebug32) + + + $(wolfSSLRelease32) + + + $(wolfSSLDebug64) + + + $(wolfSSLRelease64) + + + $(wolfSSLDllDebug32) + + + $(wolfSSLDllRelease32) + + + $(wolfSSLDllDebug64) + + + $(wolfSSLDllRelease64) + + + $(wolfSSLDllDebug32FIPS) + + + $(wolfSSLDllRelease32FIPS) + + + $(wolfSSLDllDebug64FIPS) + + + $(wolfSSLDllRelease64FIPS) + + + diff --git a/IDE/WIN/wolfssljni.sln b/IDE/WIN/wolfssljni.sln new file mode 100644 index 0000000..adc12a6 --- /dev/null +++ b/IDE/WIN/wolfssljni.sln @@ -0,0 +1,43 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30621.155 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wolfssljni", "wolfssljni.vcxproj", "{A5CBD153-C26C-4AD5-A507-0A159F074B58}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + DLL Debug FIPS|Win32 = DLL Debug FIPS|Win32 + DLL Debug FIPS|x64 = DLL Debug FIPS|x64 + DLL Debug|Win32 = DLL Debug|Win32 + DLL Debug|x64 = DLL Debug|x64 + DLL Release FIPS|Win32 = DLL Release FIPS|Win32 + DLL Release FIPS|x64 = DLL Release FIPS|x64 + DLL Release|Win32 = DLL Release|Win32 + DLL Release|x64 = DLL Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A5CBD153-C26C-4AD5-A507-0A159F074B58}.DLL Debug FIPS|Win32.ActiveCfg = DLL Debug FIPS|Win32 + {A5CBD153-C26C-4AD5-A507-0A159F074B58}.DLL Debug FIPS|Win32.Build.0 = DLL Debug FIPS|Win32 + {A5CBD153-C26C-4AD5-A507-0A159F074B58}.DLL Debug FIPS|x64.ActiveCfg = DLL Debug FIPS|x64 + {A5CBD153-C26C-4AD5-A507-0A159F074B58}.DLL Debug FIPS|x64.Build.0 = DLL Debug FIPS|x64 + {A5CBD153-C26C-4AD5-A507-0A159F074B58}.DLL Debug|Win32.ActiveCfg = DLL Debug|Win32 + {A5CBD153-C26C-4AD5-A507-0A159F074B58}.DLL Debug|Win32.Build.0 = DLL Debug|Win32 + {A5CBD153-C26C-4AD5-A507-0A159F074B58}.DLL Debug|x64.ActiveCfg = DLL Debug|x64 + {A5CBD153-C26C-4AD5-A507-0A159F074B58}.DLL Debug|x64.Build.0 = DLL Debug|x64 + {A5CBD153-C26C-4AD5-A507-0A159F074B58}.DLL Release FIPS|Win32.ActiveCfg = DLL Release FIPS|Win32 + {A5CBD153-C26C-4AD5-A507-0A159F074B58}.DLL Release FIPS|Win32.Build.0 = DLL Release FIPS|Win32 + {A5CBD153-C26C-4AD5-A507-0A159F074B58}.DLL Release FIPS|x64.ActiveCfg = DLL Release FIPS|x64 + {A5CBD153-C26C-4AD5-A507-0A159F074B58}.DLL Release FIPS|x64.Build.0 = DLL Release FIPS|x64 + {A5CBD153-C26C-4AD5-A507-0A159F074B58}.DLL Release|Win32.ActiveCfg = DLL Release|Win32 + {A5CBD153-C26C-4AD5-A507-0A159F074B58}.DLL Release|Win32.Build.0 = DLL Release|Win32 + {A5CBD153-C26C-4AD5-A507-0A159F074B58}.DLL Release|x64.ActiveCfg = DLL Release|x64 + {A5CBD153-C26C-4AD5-A507-0A159F074B58}.DLL Release|x64.Build.0 = DLL Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5DCEC0DE-9962-4100-AA08-921D4697C999} + EndGlobalSection +EndGlobal diff --git a/IDE/WIN/wolfssljni.vcxproj b/IDE/WIN/wolfssljni.vcxproj new file mode 100644 index 0000000..8d91e01 --- /dev/null +++ b/IDE/WIN/wolfssljni.vcxproj @@ -0,0 +1,431 @@ + + + + + DLL Debug FIPS + Win32 + + + DLL Debug FIPS + x64 + + + DLL Debug + Win32 + + + DLL Release FIPS + Win32 + + + DLL Release FIPS + x64 + + + DLL Release + Win32 + + + DLL Debug + x64 + + + DLL Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + 16.0 + Win32Proj + {a5cbd153-c26c-4ad5-a507-0a159f074b58} + wolfssljni + 10.0 + wolfssljni + + + + DynamicLibrary + true + v142 + Unicode + + + DynamicLibrary + true + v142 + Unicode + + + DynamicLibrary + false + v142 + true + Unicode + + + DynamicLibrary + false + v142 + true + Unicode + + + DynamicLibrary + true + v142 + Unicode + + + DynamicLibrary + true + v142 + Unicode + + + DynamicLibrary + false + v142 + true + Unicode + + + DynamicLibrary + false + v142 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + $(SolutionDir)$(Configuration)\$(Platform)\ + $(Configuration)\$(Platform)\ + + + true + $(SolutionDir)$(Configuration)\$(Platform)\ + $(Configuration)\$(Platform)\ + + + + + $(SolutionDir)$(Configuration)\$(Platform)\ + $(Configuration)\$(Platform)\ + + + + $(SolutionDir)$(Configuration)\$(Platform)\ + $(Configuration)\$(Platform)\ + + + true + $(SolutionDir)$(Configuration)\$(Platform)\ + $(Configuration)\$(Platform)\ + + + true + $(SolutionDir)$(Configuration)\$(Platform)\ + $(Configuration)\$(Platform)\ + + + + + $(SolutionDir)$(Configuration)\$(Platform)\ + $(Configuration)\$(Platform)\ + + + + $(SolutionDir)$(Configuration)\$(Platform)\ + $(Configuration)\$(Platform)\ + + + + Level3 + true + WIN32;_DEBUG;WOLFCRYPTJNI_EXPORTS;WOLFSSL_USER_SETTINGS;WOLFSSL_LIB;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + false + NotUsing + pch.h + ..;..\..\..\native;$(wolfSSLDir);$(wolfSSLDir)/IDE/WIN;$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;%(AdditionalIncludeDirectories) + EditAndContinue + + + Windows + true + false + $(wolfSSLDllDebug32) + wolfssl.lib;ws2_32.lib;%(AdditionalDependencies) + msvcrt.lib + + + cd ..\..\ +set JUNIT_HOME=$(SolutionDir)..\..\ +ant + + + + + Level3 + true + WIN32;_DEBUG;WOLFCRYPTJNI_EXPORTS;WOLFSSL_USER_SETTINGS;WOLFSSL_LIB;HAVE_FIPS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + false + NotUsing + pch.h + ..;..\..\..\native;$(wolfSSLDir);$(wolfSSLDir)/IDE/WIN10;$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;%(AdditionalIncludeDirectories) + EditAndContinue + + + Windows + true + false + $(wolfSSLDllDebug32FIPS) + wolfssl-fips.lib;ws2_32.lib;%(AdditionalDependencies) + msvcrt.lib + + + cd ..\..\ +set JUNIT_HOME=$(SolutionDir)..\..\ +ant + + + + + Level3 + true + true + true + WIN32;NDEBUG;WOLFCRYPTJNI_EXPORTS;WOLFSSL_USER_SETTINGS;WOLFSSL_LIB;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + false + NotUsing + pch.h + ..;..\..\..\native;$(wolfSSLDir);$(wolfSSLDir)/IDE/WIN;$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + true + $(wolfSSLDllRelease32) + wolfssl.lib;ws2_32.lib;%(AdditionalDependencies) + + + + + cd ..\..\ +set JUNIT_HOME=$(SolutionDir)..\..\ +ant + + + + + Level3 + true + true + true + WIN32;NDEBUG;WOLFCRYPTJNI_EXPORTS;WOLFSSL_USER_SETTINGS;WOLFSSL_LIB;HAVE_FIPS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + false + NotUsing + pch.h + ..;..\..\..\native;$(wolfSSLDir);$(wolfSSLDir)/IDE/WIN10;$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + true + $(wolfSSLDllRelease32FIPS) + wolfssl-fips.lib;ws2_32.lib;%(AdditionalDependencies) + + + + + cd ..\..\ +set JUNIT_HOME=$(SolutionDir)..\..\ +ant + + + + + Level3 + true + WIN32;_DEBUG;WOLFCRYPTJNI_EXPORTS;WOLFSSL_USER_SETTINGS;WOLFSSL_LIB;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + false + NotUsing + pch.h + ..;..\..\..\native;$(wolfSSLDir);$(wolfSSLDir)/IDE/WIN;$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;%(AdditionalIncludeDirectories) + + + Windows + true + false + $(wolfSSLDllDebug64) + wolfssl.lib;ws2_32.lib;%(AdditionalDependencies) + msvcrt.lib + false + + + cd ..\..\ +set JUNIT_HOME=$(SolutionDir)..\..\ +ant + + + + + + + Level3 + true + WIN32;_DEBUG;WOLFCRYPTJNI_EXPORTS;WOLFSSL_USER_SETTINGS;WOLFSSL_LIB;HAVE_FIPS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + false + NotUsing + pch.h + ..;..\..\..\native;$(wolfSSLDir);$(wolfSSLDir)/IDE/WIN10;$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;%(AdditionalIncludeDirectories) + + + Windows + true + false + $(wolfSSLDllDebug64FIPS) + wolfssl-fips.lib;ws2_32.lib;%(AdditionalDependencies) + msvcrt.lib + false + + + cd ..\..\ +set JUNIT_HOME=$(SolutionDir)..\..\ +ant + + + + + + + Level3 + true + true + + + WIN32;NDEBUG;WOLFCRYPTJNI_EXPORTS;WOLFSSL_USER_SETTINGS;WOLFSSL_LIB;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + false + NotUsing + pch.h + ..;..\..\..\native;$(wolfSSLDir);$(wolfSSLDir)/IDE/WIN;$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;%(AdditionalIncludeDirectories) + + + Windows + + + + + true + true + $(wolfSSLDllRelease64) + wolfssl.lib;ws2_32.lib;%(AdditionalDependencies) + + + + + cd ..\..\ +set JUNIT_HOME=$(SolutionDir)..\..\ +ant + + + + + Level3 + true + true + + + WIN32;NDEBUG;WOLFCRYPTJNI_EXPORTS;WOLFSSL_USER_SETTINGS;WOLFSSL_LIB;HAVE_FIPS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + false + NotUsing + pch.h + ..;..\..\..\native;$(wolfSSLDir);$(wolfSSLDir)/IDE/WIN10;$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;%(AdditionalIncludeDirectories) + + + Windows + + + + + true + true + $(wolfSSLDllRelease64FIPS) + wolfssl-fips.lib;ws2_32.lib;%(AdditionalDependencies) + + + + + cd ..\..\ +set JUNIT_HOME=$(SolutionDir)..\..\ +ant + + + + + + \ No newline at end of file diff --git a/IDE/WIN/wolfssljni.vcxproj.filters b/IDE/WIN/wolfssljni.vcxproj.filters new file mode 100644 index 0000000..e911186 --- /dev/null +++ b/IDE/WIN/wolfssljni.vcxproj.filters @@ -0,0 +1,81 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + \ No newline at end of file diff --git a/src/java/com/wolfssl/WolfSSL.java b/src/java/com/wolfssl/WolfSSL.java index a830c03..76e64c5 100644 --- a/src/java/com/wolfssl/WolfSSL.java +++ b/src/java/com/wolfssl/WolfSSL.java @@ -428,11 +428,26 @@ public class WolfSSL { */ public static void loadLibrary() throws UnsatisfiedLinkError { + int fipsLoaded = 0; + String osName = System.getProperty("os.name").toLowerCase(); if (osName.contains("win")) { - System.loadLibrary("wolfssl"); + try { + /* Default wolfCrypt FIPS library on Windows is compiled + * as "wolfssl-fips" by Visual Studio solution */ + System.loadLibrary("wolfssl-fips"); + fipsLoaded = 1; + } catch (UnsatisfiedLinkError e) { + /* wolfCrypt FIPS not available */ + } + + if (fipsLoaded == 0) { + /* FIPS library not loaded, try normal libwolfssl */ + System.loadLibrary("wolfssl"); + } } + /* Load wolfssljni library */ System.loadLibrary("wolfssljni"); }