Windows/MFC

openssl for wince

aucd29 2013. 10. 2. 18:22
http://karajan.it.uc3m.es/~pervasive/wce_lite_compat/


INSTALLATION FOR THE WINDOWS CE PLATFORM
----------------------------------------

There are two ways for building OpenSSL for Windows CE.

1) If you are using a hanheld or any device with an early version of
Windows CE must follow the instructions written in "Building with
WceCompat". These instructions generates binaries that are invoked
from the host, executed in the device but the output (stdout) is
redirected again to the host.

Building OpenSSL for Windows CE requires the following external tools:

* Microsoft eMbedded Visual C++ 3.0
* wcecompat compatibility library (www.essemer.com.au)
* Optionally ceutils for running automated tests (www.essemer.com.au)

Windows CE support in OpenSSL relies on wcecompat and therefore it's
appropriate to check http://www.essemer.com.au/windowsce/ for updates in
case of compilation problems. As for the moment of this writing version
1.1 is available and actually required for WCE 4.2 and newer platforms.
All Windows CE specific issues should be directed to www.essemer.com.au.

The C Runtime Library implementation for Windows CE that is included with
Microsoft eMbedded Visual C++ 3.0 is incomplete and in some places
incorrect. wcecompat plugs the holes and tries to bring the Windows CE
CRT to a level that is more compatible with ANSI C. wcecompat goes further
and provides low-level IO and stream IO support for stdin/stdout/stderr
(which Windows CE does not provide). This IO functionality is not needed
by the OpenSSL library itself but is used for the tests and openssl.exe.
More information is available at www.essemer.com.au.

You also need Perl for Win32. You will need ActiveState Perl, available
from http://www.activestate.com/ActivePerl.

2) If you want to use Openssl applications for instance OpenSSL.exe
in a PDA or any Windows CE based device that do not implement a text
console (all of them) you can follow the instructions written in the
"Building with PortSDK". Besides you will need the following software
to use OpenSSL directly in the PDA:

* Microsoft eMbedded Visual C++ 4.0
* Pocket PC 2003 SDK (Windows CE 4.20)
* wce_lite_compat library (www.it.uc3m.es/pervasive/wce_lite_compat)
* Pocket Console Driver (http://www.symbolictools.de/public/pocketconsole/)
* Port SDK (http://www.symbolictools.de/public/pocketconsole/developers
        /portsdk.htm)
* Microsoft CMD (can be downloaded from http://www.symbolictools.de/public/
            pocketconsole/applications/cmd/index.htm)



The C Runtime Library implementation of Windows CE 3.0 is incomplete but newer
versions of Windows CE provide more functionality, so wcecompat is not needed.
The C Runtime Library is still incomplete but only few functions taken from
MOZCE project have been packed in wce_lite_compat.

This way of compiling Windows CE for a PDA provides binaries ready to be invoked
from the PDA, executed in the PDA and the output of the command will be shown in
the PDA also, so you will have portable OpenSSL!.

Follow the process described in "Building with PortSDK" to obtain binaries.


Building with WceCompat
-----------------------

Setup the eMbedded Visual C++ environment. There are batch files for doing
this installed with eVC++. For an ARM processor, for example, execute:

> "C:\Program Files\Microsoft eMbedded Tools\EVC\WCE300\BIN\WCEARM.BAT"

Next indicate where wcecompat is located:

> set WCECOMPAT=C:\wcecompat

Next you should run Configure:

> perl Configure VC-CE

Next you need to build the Makefiles:

> ms\do_ms

If you get errors about things not having numbers assigned then check the
troubleshooting section in INSTALL.W32: you probably won't be able to compile
it as it stands.

Then from the VC++ environment at a prompt do:

- to build static libraries:

> nmake -f ms\ce.mak

- or to build DLLs:

> nmake -f ms\cedll.mak

If all is well it should compile and you will have some static libraries and
executables in out32, or some DLLs and executables in out32dll. If you want
to try the tests then make sure the ceutils are in the path and do:

> cd out32
> ..\ms\testce

This will copy each of the test programs to the Windows CE device and execute
them, displaying the output of the tests on this computer. The output should
look similar to the output produced by running the tests for a regular Windows
build.


Building with PortSDK
-----------------------

Setup the eMbedded Visual C++ environment. There are batch files for doing
this installed with eVC++. For an ARM processor, for example, execute:

> "C:\Program Files\Microsoft eMbedded Tools\EVC\WCE420\BIN\WCEARM.BAT"

Next build wce_lite_compat, in the same console (embedded C++ environment),
goto wce_lite_compat directory and type:

> nmake -f Makefile

Next indicate where PORTSDK and wce_lite_compat is located:

> set PORTSDK_DIR=C:\PortSDK
> set WCE_LITE_COMPAT=C:\wce_lite_compat

Next you should run Configure:

> perl Configure VC-CE_PDA_CONSOLE --openssldir=\OpenSSL\

Next you need to build the Makefiles:

> ms\do_ms

If you get errors about things not having numbers assigned then check the
troubleshooting section in INSTALL.W32: you probably won't be able to compile
it as it stands.

Then from the VC++ environment at a prompt do:

- to build static libraries:

> nmake -f ms\cepdaconsole.mak

- or to build DLLs:

> nmake -f ms\cepdaconsoledll.mak

If things go rigth, it should compile and you will have some static
libraries and executables in out32, or some DLLs and executables in
out32dll. If you want to try the tests, make sure the Pocket
Console Driver and Microsoft CMD are instaled in your PDA and run:

out32dll_ARMV4_pda_console> ..\ms\mkfile_dllcepda.bat ( for dlls )

This bat file generates a directory structure and copies some files to it. This
files are in directory toPDA\, copy all the content of this directory in your
home directory in your PDA, so you will have:

\OpenSSL\OpenSSL\ <- binaries
\OpenSSL\ms\        <- test files
\OpenSSL\test\     <- some files to help tests
\OpenSSL\certs\     <- some example certs

To test OpenSSL in your PDA open a console, move to \OpenSSL\OpenSSL and run:
> ..\ms\test_cepda.bat