OpenSSL in Windows?

Nov 1, 2014 at 4:27 AM
Hi,

I got the latest from the development branch and after compiling (using the vs solution) with vs 2013 I see that OpenSSL is refereed inside cpprest120D_2_2.dll.

So are you moving to use openssl in windows?

Thanks,

G.
Coordinator
Nov 1, 2014 at 4:55 AM
Hi G,

We're using openssl on windows desktop to implement secure websockets. Windows Store & Phone applications will still be using straight WinRT.

roschuma
Nov 1, 2014 at 1:25 PM
The issue is that this increased the # of DLL to be deployed by 2 or by 4 if one does 32 and 64 bit...

Is there a way to compile Casablanca to statically link the OpenSSL into the cpprest DLL? The size will increase but we do not have to deploy so many DLLs.

Thanks,

G.
Coordinator
Nov 3, 2014 at 9:09 PM
We don't have explicit support for that, however looking at the OpenSSL NuGet package you should be able to add the following section into Release\src\build\vs120\casablanca120.vcxproj:
<PropertyGroup>
<Linkage-openssl>static</Linkage-openssl>
</PropertyGroup>
roschuma
Coordinator
Nov 6, 2014 at 5:14 PM
Hi G,

We only use openssl on Windows Desktop for the websocket_client. So another option, if you aren't using websockets, could be to recompile turning websockets off by defining the following macro:
CPPREST_EXCLUDE_WEBSOCKETS
In the future we might take a look at static linking. I've opened an issue to track.

Steve
Nov 7, 2014 at 4:27 PM
Hi Steve,

I just tested the macro and it still does not work. The code controlled by the macro it is shown as disabled, however the two ssl DLLs are still in the rest DLL. I tried to use the delay loading of the two DLL but it does not work. When the app starts, the code tries to load them and it crashes.

Thanks,

G.
Coordinator
Nov 7, 2014 at 4:32 PM
Hi G,

Yes I see you are correct. I see the problem is the macro only controls turning off the features which actually depend on OpenSSL. The Visual Studio project files will still link with the OpenSSL libs. You can stop that by opening the vcxproj file you are building and removing the lines that will pull in linking and the OpenSSL includes. For example if you are building the Windows desktop Visual Studio 2013 version remove the following lines from Release\src\build\vs12\casablanca120.vcxproj:
    <Import Project="$(PackagesRoot)\openssl.1.0.1.25\build\native\openssl.props" Condition="Exists('$(PackagesRoot)\openssl.1.0.1.25\build\native\openssl.props')" />
    <Import Project="$(PackagesRoot)\openssl.redist.1.0.1.25\build\native\openssl.redist.targets" Condition="Exists('$(PackagesRoot)\openssl.redist.1.0.1.25\build\native\openssl.redist.targets')" />
    <Import Project="$(PackagesRoot)\openssl.1.0.1.25\build\native\openssl.targets" Condition="Exists('$(PackagesRoot)\openssl.1.0.1.25\build\native\openssl.targets')" />
Steve
Coordinator
Dec 11, 2014 at 9:38 PM
Hi G,

I've changed everything to statically link to OpenSSL on Windows now in the development. This longer will be an issue in the 2.4.0 release. Openssl will no longer be a runtime package dependency.

Steve
Dec 12, 2014 at 12:45 AM
Hi Steve,

Great! I just run a compilation and all seems OK.

Thanks,

G.