Changes to support OpenSSL in Windows Mobile 2003 (PDAs) with console

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Changes to support OpenSSL in Windows Mobile 2003 (PDAs) with console

Daniel Diaz Sanchez-2

 

Hi,

 

We have modified the code of OpenSSL in order to be compiled with Embedded Visual Studio 4.0 SP4 and for use the most possible native functions of windows CE 4.21. We have compiled it against a console driver so can be used directly in the pocket pc without any other thing.

 

We hope you would find this interesting

 

Daniel Diaz and Andres Marin

[hidden email]

[hidden email]

 

*´¯`*.¸¸.*´¯`*.¸¸.*´¯`*.¸¸.*´¯`*.¸¸.*´¯`*.¸¸

____________________________________________

Daniel Díaz Sánchez /Univ.Carlos III

Investigador      /Depto.Ing. Telematica

[hidden email]   /Edif.Torres Quevedo

www.it.uc3m.es/dds /Avd.dela universidad,30

Tlf: 916248816/Leganes,Madrid, 28911

____________________________________________

 

`*.¸¸.*´¯`*.¸¸.*´¯`*.¸¸.*´¯`*.¸¸.*´¯`*.¸¸.*´

 

 

STEP 1:

 

Necessary tools

 

 

1 Windows Mobile 2003 SDK (free)

2 Embedded Visual C++ 4.0 SP4 (free) [CD code appears Microsoft Download page]

3 OpenSSL 0.9.7f [Not tested with newer versions]

4 Console for Pocket PC (Port SDK) [http://www.symbolictools.de/public/pocketconsole/]

 

 

STEP 2:

 

Code added [Some functions taked form MozCE project and wincecompat]

 

---- wce_lite_compat.cpp/.h ------ attached

 

---- fcntl.h -------- attached

 

---- Makefile_wcelitecompat ------- attached

 

STEP 3:

 

change and build the code using the makefile ntdll.mak with many changes [attached also]

 

 

Windows CE 4.21 changes to OpenSSL

 

Changes to code to support Windows mobile 2003 and pocket

pc 2003 without wcecompat and with on device console

 

 

 

 

-------------------------------------------------------

 

--- D:\www\openssl-0.9.7f-old\crypto\aes\aes_locl.h         Sat Jul 17 14:54:54 2004

+++ D:\www\openssl-0.9.7f_ppc\crypto\aes\aes_locl.h    Thu May 05 12:32:47 2005

@@ -58,15 +58,15 @@

 #error AES is disabled.

 #endif

 

 #include <stdio.h>

 #include <stdlib.h>

 #include <string.h>

 

-#if defined(_MSC_VER) && !defined(_M_IA64) && !defined(OPENSSL_SYS_WINCE)

+#if defined(_MSC_VER) && !defined(_M_IA64) && !defined(OPENSSL_SYS_WINCE) && !defined(PPC2003)

 # define SWAP(x) (_lrotl(x, 8) & 0x00ff00ff | _lrotr(x, 8) & 0xff00ff00)

 # define GETU32(p) SWAP(*((u32 *)(p)))

 # define PUTU32(ct, st) { *((u32 *)(ct)) = SWAP((st)); }

 #else

 # define GETU32(pt) (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ ((u32)(pt)[2] <<  8) ^ ((u32)(pt)[3]))

 # define PUTU32(ct, st) { (ct)[0] = (u8)((st) >> 24); (ct)[1] = (u8)((st) >> 16); (ct)[2] = (u8)((st) >>  8); (ct)[3] = (u8)(st); }

 #endif

 

 

-------------------------------------------------------

 

--- D:\www\openssl-0.9.7f-old\apps\apps.c          Tue Jan 11 08:53:30 2005

+++ D:\www\openssl-0.9.7f_ppc\apps\apps.c      Wed May 04 18:14:36 2005

@@ -121,14 +121,19 @@

 #include <openssl/pem.h>

 #include <openssl/pkcs12.h>

 #include <openssl/ui.h>

 #include <openssl/safestack.h>

 #ifndef OPENSSL_NO_ENGINE

 #include <openssl/engine.h>

 #endif

+#ifdef PPC2003

+#define _IOFBF           0

+#define _IOLBF           1

+#define _IONBF           2

+#endif

 

 #define NON_MAIN

 #include "apps.h"

 #undef NON_MAIN

 

 typedef struct {

            char *name;

@@ -1585,17 +1590,18 @@

                        serialfile, old_suffix);

 #else

            j = BIO_snprintf(buf[1], sizeof buf[1], "%s-%s",

                        serialfile, old_suffix);

 #endif

            if (stat(serialfile,&sb) < 0)

                        {

-                       if (errno != ENOENT

-#ifdef ENOTDIR

-                                  && errno != ENOTDIR)

+                      if (errno != ENOENT)

+#ifdef ENOTDIR //dds

+                                 //&& (errno != ENOTDIR)

+                                 if (errno != ENOTDIR)

 #endif

                                   goto err;

                        }

            else

                        {

 #ifdef RL_DEBUG

                        BIO_printf(bio_err, "DEBUG: renaming \"%s\" to \"%s\"\n",

@@ -1887,17 +1893,18 @@

                        dbfile, old_suffix);

 #else

            j = BIO_snprintf(buf[3], sizeof buf[3], "%s-attr-%s",

                        dbfile, old_suffix);

 #endif

 

 

-------------------------------------------------------

 

 

--- D:\www\openssl-0.9.7f-old\crypto\bio\b_sock.c           Sat Dec 27 16:40:50 2003

+++ D:\www\openssl-0.9.7f_ppc\crypto\bio\b_sock.c       Wed May 04 12:34:45 2005

@@ -479,15 +479,18 @@

 void BIO_sock_cleanup(void)

            {

 #ifdef OPENSSL_SYS_WINDOWS

            if (wsa_init_done)

                        {

                        wsa_init_done=0;

 #ifndef OPENSSL_SYS_WINCE

+//next line added by dds to allow PPC2003