简体   繁体   English

为WP8平台构建本机OpenSSL库

[英]Build native OpenSSL library for WP8 Platform

I am creating Windows phone 8 application.I need to create App which uses compiled OpenSSL library.I was following standard latest library. 我正在创建Windows phone 8应用程序。我需要创建使用已编译的OpenSSL库的App。我遵循标准的最新库。

I am following INSTALL.W64 steps, as I don't know which INSTALL.* to be used.As my machine is 64 bit I preferred this: 我正在按照INSTALL.W64步骤进行操作,因为我不知道要使用哪个。*因为我的机器是64位我更喜欢这个:

To build for Win64/x64: 要为Win64 / x64构建:

1 perl Configure VC-WIN64A 1 perl配置VC-WIN64A
2 ms\\do_win64a 2 ms \\ do_win64a
3 nmake -f ms\\ntdll.mak 3 nmake -f ms \\ ntdll.mak
4 cd out32dll 4 cd out32dll
5 ..\\ms\\test 5 .. \\ ms \\ test

Using Visual Studio Command Prompt.Upto step 2 is fine.At 3rd step it fails to build and doesn't create library in out32dll Folder.It gives error like: 使用Visual Studio命令Prompt.Upto第2步很好。第3步它无法构建,也没有在out32dll Folder中创建库。它给出了如下错误:

C:\Program Files (x86)\Windows Phone Kits\8.0\include\windows.h(182) : fatal err
or C1083: Cannot open include file: 'winreg.h': No such file or directory
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0
\VC\WPSDK\WP80\BIN\cl.EXE"' : return code '0x2'
Stop.

My question is : Is really OpenSSL supported for Windows Phone Platform .As I seen this which is true/false I am not sure. 我的问题是: Windows Phone平台是否真的支持OpenSSL 。我看到是真/假我不确定。

Apart from this standard way I also tried this solution.Able to complete steps mentioned in answer.got build compiled in visual studio.Referenced OpenSSLWP8 in Windows Phone 8 Project.Compiled libeay32 . 除了这种标准方式,我还尝试了这个解决方案。能够完成在visual studio中编译的answer.got构建中提到的步骤。在Windows Phone 8 Project.Compiled libeay32 OpenSSLWP8

But when I try to create reference NativeCrypto nc = new NativeCrypto() I get FileNotFoundException in that library.Am I missing something? 但是当我尝试创建引用NativeCrypto nc = new NativeCrypto()我在该库中得到了FileNotFoundException 。我错过了什么?

Which solution is better or there is any other solution available so that I can build OpenSSL for WP8 . 哪种解决方案更好,或者有任何其他解决方案可用,以便我可以为WP8构建OpenSSL

Any help is appreciated. 任何帮助表示赞赏。 Thanks. 谢谢。

My question is: Is really OpenSSL supported for Windows Phone Platform. 我的问题是:Windows Phone平台是否真的支持OpenSSL。 As I seen this which is true/false I am not sure. 我看到这是真/假我不确定。

Not officially. 不正式。

I know one of the OpenSSL developers regularly build OpenSSL for Windows 8. I was also able to build for Windows 8. However... 我知道其中一个OpenSSL开发人员定期为Windows 8构建OpenSSL。我也能够为Windows 8构建。但是......

I've got a bunch of patches for Windows RT and Windows Phone. 我有一堆Windows RT和Windows Phone的补丁。 The patches add three new targets, and it don't use VC-WIN64A . 这些补丁添加了三个新目标,并且它不使用VC-WIN64A The added targets are VC-WP8-X86 , VC-WP8-ARM , and VC-WINRT-ARM . 增加的目标是VC-WP8-X86VC-WP8-ARMVC-WINRT-ARM

I added two new defines ( OPENSSL_SYS_WINRT and OPENSSL_SYS_WINPHONE ) so a lot of this went on: 我添加了两个新的定义( OPENSSL_SYS_WINRTOPENSSL_SYS_WINPHONE ),所以很多这样的事情继续:

-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(OPENSSL_SYS_WINCE) &&
     !defined(OPENSSL_SYS_WINRT) && !defined(OPENSSL_SYS_WINPHONE)

The cflags needed some tuning. cflags需要一些调整。 For example, here's from Windows RT: 例如,这是来自Windows RT:

+    $base_cflags.= " /D WINAPI_FAMILY=WINAPI_PARTITION_APP";
+    $base_cflags.= " /FI SDKDDKVer.h /FI winapifamily.h";

And Windows Phone: 和Windows Phone:

+    $base_cflags.= " /D WINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP";
+    $base_cflags.= " /AI\"$ENV{'WINDOWSMETADATA'}\"";
+    $base_cflags.= " /FI SDKDDKVer.h /FI winapifamily.h";

The Windows RT target is severely crippled. Windows RT目标严重瘫痪。 As an example of how bad things are on Windows RT: the target needed both -DOPENSSL_NO_SOCK and -DOPENSSL_NO_DGRAM because applications are not allowed to access the socket API. 作为Windows RT上有多糟糕的一个例子:目标需要-DOPENSSL_NO_SOCK-DOPENSSL_NO_DGRAM因为不允许应用程序访问socket API。 That makes it pretty useless SSL library since TCP and UDP was gutted. 这使得它非常无用的SSL库,因为TCP和UDP被毁坏了。

The Windows Phone target is a little better. Windows Phone目标稍微好一些。 Windows Phone allows access to the socket API (so TCP and UDP are available), but the random number generator seeding is broken. Windows Phone允许访问socket API(因此TCP和UDP可用),但随机数生成器播种被破坏。 Its broken because Microsoft does not provide CryptGenRandom or the older Win32 screen APIs that were used to scrape state. 它破碎是因为微软没有提供CryptGenRandom或用于刮擦状态的旧版Win32屏幕API。 Application will need to explicitly seed from RNGCryptoServiceProvider . 应用程序需要从RNGCryptoServiceProvider显式种子。

You can see traces of my suffering on Stack Overflow. 你可以在Stack Overflow上看到我的痛苦痕迹。 For example, Windows RT: where is sockaddr_in? 例如, Windows RT:sockaddr_in在哪里? .

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM