[PATCH] OpenSSL for Windows Mobile 2003

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] OpenSSL for Windows Mobile 2003

Daniel Diaz Sanchez-2
I send this topic another time adding [PATCH] to the subject (contribution).

Hi,
 
We have modified the code of OpenSSL in order to be compiled with Embedded
Visual Studio 4.0 SP4 using the most possible native functions of windows CE
4.21. We have compiled it against a console driver so can be used directly
in a pocket pc without having connected the pocket pc to the host (actual
patch) to use a console, no WCE compat is necessary and standard console of
the device can be used (port SDK). Follow the steps detailed in this mail.
 
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
+#ifndef PPC2003
                        WSACancelBlockingCall();
+#endif //dds
 #endif
                        WSACleanup();
                        }
 #endif
            }
 
 #if !defined(OPENSSL_SYS_VMS) || __VMS_VER >= 70000000
 
 
-------------------------------------------------------
 
--- D:\www\openssl-0.9.7f-old\crypto\cryptlib.c     Mon Aug 02 16:15:08 2004
+++ D:\www\openssl-0.9.7f_ppc\crypto\cryptlib.c            Wed May 04
13:08:05 2005
@@ -57,14 +57,20 @@
  */
 
 #include <stdio.h>
 #include <string.h>
 #include "cryptlib.h"
 #include <openssl/crypto.h>
 #include <openssl/safestack.h>
+#ifdef PPC2003 //added by dds
+void abort(void); //only declaration
+#endif //dds
 
 #if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_WIN16)
 static double SSLeay_MSVC5_hack=0.0; /* and for VC1.5 */
 #endif
 
 DECLARE_STACK_OF(CRYPTO_dynlock)
 IMPLEMENT_STACK_OF(CRYPTO_dynlock)
 
-------------------------------------------------------
 
--- D:\www\openssl-0.9.7f-old\e_os.h       Fri Jan 14 18:22:02 2005
+++ D:\www\openssl-0.9.7f_ppc\e_os.h  Wed May 04 18:20:20 2005
@@ -269,15 +269,15 @@
 #  ifndef R_OK
 #    define R_OK          4
 #  endif
 #  define OPENSSL_CONF       "openssl.cnf"
 #  define SSLEAY_CONF         OPENSSL_CONF
 #  define NUL_DEV      "nul"
 #  define RFILE                        ".rnd"
-#  ifdef OPENSSL_SYS_WINCE
+#  if defined(OPENSSL_SYS_WINCE)||defined(PPC2003)
 #    define DEFAULT_HOME  ""
 #  else
 #    define DEFAULT_HOME  "C:"
 #  endif
 
 #else /* The non-microsoft world world */
 
 
-------------------------------------------------------
 
--- D:\www\openssl-0.9.7f-old\test\ectest.c          Fri Jul 08 17:18:40
2005
+++ D:\www\openssl-0.9.7f_ppc\test\ectest.c     Wed May 04 17:46:12 2005
@@ -156,24 +156,28 @@
            EC_POINT *P, *Q, *R;
            BIGNUM *x, *y, *z;
            unsigned char buf[100];
            size_t i, len;
            int k;
           
            /* enable memory leak checking unless explicitly disabled */
+#ifndef PPC203
            if (!((getenv("OPENSSL_DEBUG_MEMORY") != NULL) && (0 ==
strcmp(getenv("OPENSSL_DEBUG_MEMORY"), "off"))))
                        {
                        CRYPTO_malloc_debug_init();
                        CRYPTO_set_mem_debug_options(V_CRYPTO_MDEBUG_ALL);
                        }
            else
                        {
+#endif
                        /* OPENSSL_DEBUG_MEMORY=off */
                        CRYPTO_set_mem_debug_functions(0, 0, 0, 0, 0);
+#ifndef PPC2003
                        }
+#endif
            CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_ON);
            ERR_load_crypto_strings();
 
 #if 1 /* optional */
            ctx = BN_CTX_new();
            if (!ctx) ABORT;
 #endif
 
 
-------------------------------------------------------
 
--- D:\www\openssl-0.9.7f-old\fips\aes\fips_aes_locl.h      Mon Dec 20
15:10:28 2004
+++ D:\www\openssl-0.9.7f_ppc\fips\aes\fips_aes_locl.h Thu May 05 12:29:01
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\crypto\rand\rand_win.c       Sat Mar 19
13:40:42 2005
+++ D:\www\openssl-0.9.7f_ppc\crypto\rand\rand_win.c  Mon May 09 02:12:25
2005
@@ -168,15 +168,17 @@
 typedef BOOL (WINAPI *HEAP32LIST)(HANDLE, LPHEAPLIST32);
 typedef BOOL (WINAPI *PROCESS32)(HANDLE, LPPROCESSENTRY32);
 typedef BOOL (WINAPI *THREAD32)(HANDLE, LPTHREADENTRY32);
 typedef BOOL (WINAPI *MODULE32)(HANDLE, LPMODULEENTRY32);
 
 #include <lmcons.h>
 #ifndef OPENSSL_SYS_WINCE
+#ifndef PPC2003 //added by dds for PPC2003
 #include <lmstats.h>
+#endif //added by dds for PPC2003
 #endif
 #if 1 /* The NET API is Unicode only.  It requires the use of the UNICODE
        * macro.  When UNICODE is defined LPTSTR becomes LPWSTR.  LMSTR was
        * was added to the Platform SDK to allow the NET API to be used in
        * non-Unicode applications provided that Unicode strings were still
        * used for input.  LMSTR is defined as LPWSTR.
        */
@@ -208,30 +210,35 @@
            /* Determine the OS version we are on so we can turn off things
             * that do not work properly.
             */
         OSVERSIONINFO osverinfo ;
         osverinfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO) ;
         GetVersionEx( &osverinfo ) ;
 
-#if defined(OPENSSL_SYS_WINCE) && WCEPLATFORM!=MS_HPC_PRO
+//#if defined(OPENSSL_SYS_WINCE) && WCEPLATFORM!=MS_HPC_PRO
+//next line modified by dds to suppot windows CE PPC2203 without compiling
for CE
+#if ((defined(OPENSSL_SYS_WINCE)&&
WCEPLATFORM!=MS_HPC_PRO)||(defined(PPC2003)&&defined(OPENSSL_SYSNAME_WIN32))
)
 #ifndef CryptAcquireContext
 #define CryptAcquireContext CryptAcquireContextW
 #endif
            /* poll the CryptoAPI PRNG */
            /* The CryptoAPI returns sizeof(buf) bytes of randomness */
            if (CryptAcquireContext(&hProvider, 0, 0, PROV_RSA_FULL,
CRYPT_VERIFYCONTEXT))
                        {
                        if (CryptGenRandom(hProvider, sizeof(buf), buf))
                                   RAND_add(buf, sizeof(buf), sizeof(buf));
                        CryptReleaseContext(hProvider, 0);
                        }
 #endif
 
-#ifndef OPENSSL_SYS_WINCE
-           /*
+//#ifndef OPENSSL_SYS_WINCE
+//next line modified by dds to support ppc2003
+#if !defined(OPENSSL_SYS_WINCE)&&!defined(PPC2003)
+
 
-------------------------------------------------------
 
--- D:\www\openssl-0.9.7f-old\crypto\rc2\rc2_skey.c        Wed Jan 26
22:00:34 2005
+++ D:\www\openssl-0.9.7f_ppc\crypto\rc2\rc2_skey.c    Tue Apr 12 18:52:19
2005
@@ -87,15 +87,15 @@
 
 /* It has come to my attention that there are 2 versions of the RC2
  * key schedule.  One which is normal, and anther which has a hook to
  * use a reduced key length.
  * BSAFE uses the 'retarded' version.  What I previously shipped is
  * the same as specifying 1024 for the 'bits' parameter.  Bsafe uses
  * a version where the bits parameter is the same as len*8 */
-
+#pragma optimize("g",off)
 #ifdef OPENSSL_FIPS
 void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int
bits)
            {
            if (FIPS_mode())
                        FIPS_BAD_ABORT(RC2)
            private_RC2_set_key(key, len, data, bits);
            }
@@ -145,7 +145,8 @@
 
            /* copy from bytes into RC2_INT's */
            ki= &(key->data[63]);
            for (i=127; i>=0; i-=2)
                        *(ki--)=((k[i]<<8)|k[i-1])&0xffff;
            }
 
+#pragma optimize("g",on)
 
-------------------------------------------------------
 
--- D:\www\openssl-0.9.7f-old\apps\s_socket.c    Tue Jan 04 12:21:54 2005
+++ D:\www\openssl-0.9.7f_ppc\apps\s_socket.c           Sun May 08 17:56:10
2005
 
@@ -137,15 +142,17 @@
 #ifdef OPENSSL_SYS_WINDOWS
 static void ssl_sock_cleanup(void)
            {
            if (wsa_init_done)
                        {
                        wsa_init_done=0;
 #ifndef OPENSSL_SYS_WINCE
+#ifndef PPC2003
                        WSACancelBlockingCall();
+#endif
 #endif
                        WSACleanup();
                        }
            }
 #endif
 
 static int ssl_sock_init(void)
 
-------------------------------------------------------
 
--- D:\www\openssl-0.9.7f-old\ssl\ssltest.c          Tue Jan 11 20:25:26
2005
+++ D:\www\openssl-0.9.7f_ppc\ssl\ssltest.c      Thu May 05 12:30:28 2005
@@ -146,15 +146,15 @@
 #else
 #include OPENSSL_UNISTD
 #endif
 
 #ifdef OPENSSL_SYS_VMS
 #  define TEST_SERVER_CERT "SYS$DISK:[-.APPS]SERVER.PEM"
 #  define TEST_CLIENT_CERT "SYS$DISK:[-.APPS]CLIENT.PEM"
-#elif defined(OPENSSL_SYS_WINCE)
+#elif defined(OPENSSL_SYS_WINCE)||defined(PPC2003)
 #  define TEST_SERVER_CERT "\\OpenSSL\\server.pem"
 #  define TEST_CLIENT_CERT "\\OpenSSL\\client.pem"
 #else
 #  define TEST_SERVER_CERT "../apps/server.pem"
 #  define TEST_CLIENT_CERT "../apps/client.pem"
 #endif
 
-------------------------------------------------------
 
--- D:\www\openssl-0.9.7f-old\crypto\ui\ui_openssl.c        Mon Jan 13
15:15:20 2003
+++ D:\www\openssl-0.9.7f_ppc\crypto\ui\ui_openssl.c   Wed May 04 12:36:44
2005
@@ -156,15 +156,18 @@
 #  pragma message disable DOLLARID
 # endif
 #endif
 
 #ifdef WIN_CONSOLE_BUG
 # include <windows.h>
 #ifndef OPENSSL_SYS_WINCE
+//next line added by dds to allow PPC compiling
+#ifndef PPC2003
 # include <wincon.h>
+#endif //dds
 #endif
 #endif
 
 
 /* There are 5 types of terminal interface supported,
  * TERMIO, TERMIOS, VMS, MSDOS and SGTTY
  */
@@ -370,16 +373,18 @@
                        break;
            default:
                        break;
                        }
            return 1;
            }
 
-
-#if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE)
+//
+//#if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE)
+//next line modified by dds to support PPC2003
+#if (!defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE)) &&
!defined(PPC2003)
 /* Internal functions to read a string without echoing */
 static void read_till_nl(FILE *in)
            {
 #define SIZE 4
            char buf[SIZE+1];
 
            do        {
@@ -392,15 +397,17 @@
 
 static int read_string_inner(UI *ui, UI_STRING *uis, int echo, int
strip_nl)
            {
            static int ps;
            int ok;
            char result[BUFSIZ];
            int maxsize = BUFSIZ-1;
-#if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE)
+//#if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE)
+//next line modified by dds to support PPC2003
+#if (!defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE)) &&
!defined(PPC2003)
            char *p;
 
            intr_signal=0;
            ok=0;
            ps=0;
 
            pushsig();
@@ -557,15 +564,17 @@
 #endif
            CRYPTO_w_unlock(CRYPTO_LOCK_UI);
 
            return 1;
            }
 
 
-#if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE)
+//#if !defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE)
+//next line modified by dds to support PPC2003
+#if (!defined(OPENSSL_SYS_WIN16) && !defined(OPENSSL_SYS_WINCE)) &&
!defined(PPC2003)
 /* Internal functions to handle signals and act on them */
 static void pushsig(void)
            {
            int i;
 #ifdef SIGACTION
            struct sigaction sa;
 
@@ -652,22 +661,25 @@
                        *(p++)=i;
                        if (i == '\n')
                                   {
                                   *p='\0';
                                   break;
                                   }
                        }
+//next line added by dds to support PPC2003
+#if !defined(PPC2003)
 #ifdef WIN_CONSOLE_BUG
 /* Win95 has several evil console bugs: one of these is that the
  * last character read using getch() is passed to the next read: this is
  * usually a CR so this can be trouble. No STDIO fix seems to work but
  * flushing the console appears to do the trick.
  */
                        {
                                   HANDLE inh;
                                   inh = GetStdHandle(STD_INPUT_HANDLE);
                                   FlushConsoleInputBuffer(inh);
                        }
 #endif
+#endif //dds
            return(strlen(buf));
            }
 #endif
 
-------------------------------------------------------
 
--- D:\www\openssl-0.9.7f-old\apps\openssl.c      Tue Jan 11 20:25:28 2005
+++ D:\www\openssl-0.9.7f_ppc\apps\openssl.c Sun May 08 23:44:09 2005
@@ -127,14 +127,19 @@
 #endif
 #define USE_SOCKETS /* needed for the _O_BINARY defs in the MS world */
 #include "progs.h"
 #include "s_apps.h"
 #include <openssl/err.h>
 #include <openssl/fips.h>
 
+
+#ifdef PPC2003
+int _fmode;
+#endif
 /* The LHASH callbacks ("hash" & "cmp") have been replaced by functions
with the
  * base prototypes (we cast each variable inside the function to the
required
  * type of "FUNCTION*"). This removes the necessity for macro-generated
wrapper
  * functions. */
 
 /* static unsigned long MS_CALLBACK hash(FUNCTION *a); */
 static unsigned long MS_CALLBACK hash(const void *a_void);
 
 
--- D:\www\openssl-0.9.7f-old\crypto\opensslconf.h          Tue Mar 22
21:18:28 2005
+++ D:\www\openssl-0.9.7f_ppc\crypto\opensslconf.h     Tue Apr 12 18:18:24
2005
+/* opensslconf.h */
+/* WARNING: Generated automatically from opensslconf.h.in by Configure. */
+
+/* OpenSSL was configured with the following options: */
+#ifndef OPENSSL_SYSNAME_WIN32
+# define OPENSSL_SYSNAME_WIN32
+#endif
+#ifndef OPENSSL_DOING_MAKEDEPEND
+
+#ifndef OPENSSL_NO_KRB5
+# define OPENSSL_NO_KRB5
+#endif
+
+#endif /* OPENSSL_DOING_MAKEDEPEND */
+#ifndef OPENSSL_THREADS
+# define OPENSSL_THREADS
+#endif
+
+/* The OPENSSL_NO_* macros are also defined as NO_* if the application
+   asks for it.  This is a transient feature that is provided for those
+   who haven't had the time to do the appropriate changes in their
+   applications.  */
+#ifdef OPENSSL_ALGORITHM_DEFINES
+# if defined(OPENSSL_NO_KRB5) && !defined(NO_KRB5)
+#  define NO_KRB5
+# endif
+#endif
+
+/* crypto/opensslconf.h.in */
+
+/* Generate 80386 code? */
+#undef I386_ONLY
+
+#if !(defined(VMS) || defined(__VMS)) /* VMS uses logical names instead */
+#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR)
+#define OPENSSLDIR "/usr/local/ssl"
+#endif
+#endif
+
+#undef OPENSSL_UNISTD
+#define OPENSSL_UNISTD <unistd.h>
+
+#undef OPENSSL_EXPORT_VAR_AS_FUNCTION
+#define OPENSSL_EXPORT_VAR_AS_FUNCTION
+
+#if defined(HEADER_IDEA_H) && !defined(IDEA_INT)
+#define IDEA_INT unsigned int
+#endif
+
+#if defined(HEADER_MD2_H) && !defined(MD2_INT)
+#define MD2_INT unsigned int
+#endif
+
+#if defined(HEADER_RC2_H) && !defined(RC2_INT)
+/* I need to put in a mod for the alpha - eay */
+#define RC2_INT unsigned int
+#endif
+
+#if defined(HEADER_RC4_H)
+#if !defined(RC4_INT)
+/* using int types make the structure larger but make the code faster
+ * on most boxes I have tested - up to %20 faster. */
+/*
+ * I don't know what does "most" mean, but declaring "int" is a must on:
+ * - Intel P6 because partial register stalls are very expensive;
+ * - elder Alpha because it lacks byte load/store instructions;
+ */
+#define RC4_INT unsigned int
+#endif
+#if !defined(RC4_CHUNK)
+/*
+ * This enables code handling data aligned at natural CPU word
+ * boundary. See crypto/rc4/rc4_enc.c for further details.
+ */
+#undef RC4_CHUNK
+#endif
+#endif
+
+#if (defined(HEADER_NEW_DES_H) || defined(HEADER_DES_H)) &&
!defined(DES_LONG)
+/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a
+ * %20 speed up (longs are 8 bytes, int's are 4). */
+#ifndef DES_LONG
+#define DES_LONG unsigned long
+#endif
+#endif
+
+#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
+#define CONFIG_HEADER_BN_H
+#define BN_LLONG
+
+/* Should we define BN_DIV2W here? */
+
+/* Only one for the following should be defined */
+/* The prime number generation stuff may not work when
+ * EIGHT_BIT but I don't care since I've only used this mode
+ * for debuging the bignum libraries */
+#undef SIXTY_FOUR_BIT_LONG
+#undef SIXTY_FOUR_BIT
+#define THIRTY_TWO_BIT
+#undef SIXTEEN_BIT
+#undef EIGHT_BIT
+#endif
+
+#if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)
+#define CONFIG_HEADER_RC4_LOCL_H
+/* if this is defined data[i] is used instead of *data, this is a %20
+ * speedup on x86 */
+#define RC4_INDEX
+#endif
+
+#if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H)
+#define CONFIG_HEADER_BF_LOCL_H
+#undef BF_PTR
+#endif /* HEADER_BF_LOCL_H */
+
+#if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H)
+#define CONFIG_HEADER_DES_LOCL_H
+#ifndef DES_DEFAULT_OPTIONS
+/* the following is tweaked from a config script, that is why it is a
+ * protected undef/define */
+#ifndef DES_PTR
+#undef DES_PTR
+#endif
+
+/* This helps C compiler generate the correct code for multiple functional
+ * units.  It reduces register dependancies at the expense of 2 more
+ * registers */
+#ifndef DES_RISC1
+#undef DES_RISC1
+#endif
+
+#ifndef DES_RISC2
+#undef DES_RISC2
+#endif
+
+#if defined(DES_RISC1) && defined(DES_RISC2)
+YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
+#endif
+
+/* Unroll the inner loop, this sometimes helps, sometimes hinders.
+ * Very mucy CPU dependant */
+#ifndef DES_UNROLL
+#undef DES_UNROLL
+#endif
+
+/* These default values were supplied by
+ * Peter Gutman <[hidden email]>
+ * They are only used if nothing else has been defined */
+#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) &&
!defined(DES_UNROLL)
+/* Special defines which change the way the code is built depending on the
+   CPU and OS.  For SGI machines you can use _MIPS_SZLONG (32 or 64) to
find
+   even newer MIPS CPU's, but at the moment one size fits all for
+   optimization options.  Older Sparc's work better with only UNROLL, but
+   there's no way to tell at compile time what it is you're running on */
+
+#if defined( sun )                     /* Newer Sparc's */
+#  define DES_PTR
+#  define DES_RISC1
+#  define DES_UNROLL
+#elif defined( __ultrix )  /* Older MIPS */
+#  define DES_PTR
+#  define DES_RISC2
+#  define DES_UNROLL
+#elif defined( __osf1__ )           /* Alpha */
+#  define DES_PTR
+#  define DES_RISC2
+#elif defined ( _AIX )                 /* RS6000 */
+  /* Unknown */
+#elif defined( __hpux )              /* HP-PA */
+  /* Unknown */
+#elif defined( __aux )               /* 68K */
+  /* Unknown */
+#elif defined( __dgux )              /* 88K (but P6 in latest boxes) */
+#  define DES_UNROLL
+#elif defined( __sgi )                /* Newer MIPS */
+#  define DES_PTR
+#  define DES_RISC2
+#  define DES_UNROLL
+#elif defined(i386) || defined(__i386__)   /* x86 boxes, should be gcc */
+#  define DES_PTR
+#  define DES_RISC1
+#  define DES_UNROLL
+#endif /* Systems-specific speed defines */
+#endif
+
+#endif /* DES_DEFAULT_OPTIONS */
+#endif /* HEADER_DES_LOCL_H */
 
 
*´¯`*.¸¸.*´¯`*.¸¸.*´¯`*.¸¸.*´¯`*.¸¸.*´¯`*.¸¸
____________________________________________
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
____________________________________________
 
`*.¸¸.*´¯`*.¸¸.*´¯`*.¸¸.*´¯`*.¸¸.*´¯`*.¸¸.*´
 

fcntl.h (1K) Download Attachment
ntdll.mak (29K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] OpenSSL for Windows Mobile 2003

Andy Polyakov
> I send this topic another time adding [PATCH] to the subject (contribution).

Well, it's not really "[PATCH]" keyword in the subject that makes
magical difference, but rather our ability to audit and test the
submitted code multiplied by degree of common interest for platform in
question. In other words, *if* either of development team members had
access to platform in question or similar one *and* there was commonly
expressed need for CE support, then you would observe better
round-trips. Just to make sure, "*if*" in previous sentence means that
none of us has access to Windows CE platform, which is why we're a bit
reluctant to even *say* something on the matter. We kind of expect other
Windows CE developers on the list to speak up, make some peer review and
put a word for submission.

> 3 OpenSSL 0.9.7f [Not tested with newer versions]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This is actually another
reason for us to be reluctant. We don't want to add new platforms to
branch in support-only phase. Note that there is a number of CE-specific
changes in development as well as just released 0.9.8 version and would
rather refine newer version than risk support-only/stable version get
broken. So that if you wish to pursue this, I would really recommend to
switch to development branch or at least 0.9.8.

And some comments after just scrolling through...

> -#if ... !defined(OPENSSL_SYS_WINCE)
> +#if ... !defined(OPENSSL_SYS_WINCE) && !defined(PPC2003)

... and similar in different flavors in a lot of other places. Why not
define OPENSSL_SYS_WINCE at command line or by some other means instead?
As far as I understand platform in question *is* Windows CE-based. One
can argue that we should/could have used pre-defined _WIN32_WCE macro
instead of own private OPENSSL_SYS_WINCE, but that's the way things are.
So I'd strongly recommend to find a way to define OPENSSL_SYS_WINCE
instead of "polluting" the code with own private PPC2003 macro.

> +//next line added by dds to allow PPC2003

Avoid C++ style comments.

> +#pragma optimize("g",off)

This alone can disqualify whole submission, as it with 100% probability
affects a lot of other platforms:-) Should be at least

#if defined(_MSC_VER) && defined(_WIN32_WCE)
#pragma optimize("g",off)
#endif

> +#ifdef PPC2003
> +int _fmode;
> +#endif

Think more universally, consider bigger picture! Is something similar to
this [including wcecompat things] of interest/use for *all* Windows CE
developers. Defend your standpoint! Consider more generic CE-specific
macro, not something you made up yourself to solve your particular
problem...

These are the kind of things we [at least I] expect to see/hear/find in
submissions we can't directly test. A.

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] OpenSSL for Windows Mobile 2003

Farkas Levente
Andy Polyakov wrote:

>> I send this topic another time adding [PATCH] to the subject
>> (contribution).
>
>
> Well, it's not really "[PATCH]" keyword in the subject that makes
> magical difference, but rather our ability to audit and test the
> submitted code multiplied by degree of common interest for platform in
> question. In other words, *if* either of development team members had
> access to platform in question or similar one *and* there was commonly
> expressed need for CE support, then you would observe better
> round-trips. Just to make sure, "*if*" in previous sentence means that
> none of us has access to Windows CE platform, which is why we're a bit
> reluctant to even *say* something on the matter. We kind of expect other
> Windows CE developers on the list to speak up, make some peer review and
> put a word for submission.

i'm realy would like to see this patch included in the upstream openssl!
  i even volunteer to review the patch or modify to your fit.
about the win ce platform access. all win ce (pocket pc, windows mobile)
development enviroment (eg. eMbedded Visual C++) can be downloaded from
ms for free (which is not usual from ms:-) at the same time you can
download "Emulator Images for Windows Mobile 2003 Second Edition
software for Pocket PC" so you can compile with eVC++ on win32 for CE
and you can also test it on win32 with the pocket pc emulator.

>> 3 OpenSSL 0.9.7f [Not tested with newer versions]
>
>             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This is actually another
> reason for us to be reluctant. We don't want to add new platforms to
> branch in support-only phase. Note that there is a number of CE-specific
> changes in development as well as just released 0.9.8 version and would
> rather refine newer version than risk support-only/stable version get
> broken. So that if you wish to pursue this, I would really recommend to
> switch to development branch or at least 0.9.8.

it'sacceptable, although since the api change a bit, it'd be nice to
backport it to the latest 0.9.7 release too.

> And some comments after just scrolling through...
>
>> -#if ... !defined(OPENSSL_SYS_WINCE)
>> +#if ... !defined(OPENSSL_SYS_WINCE) && !defined(PPC2003)
>
>
> ... and similar in different flavors in a lot of other places. Why not
> define OPENSSL_SYS_WINCE at command line or by some other means instead?
> As far as I understand platform in question *is* Windows CE-based. One
> can argue that we should/could have used pre-defined _WIN32_WCE macro
> instead of own private OPENSSL_SYS_WINCE, but that's the way things are.
> So I'd strongly recommend to find a way to define OPENSSL_SYS_WINCE
> instead of "polluting" the code with own private PPC2003 macro.

it's a bit more complicated since not all wince is ppc2003, but all
ppc2003 is wince:-)

> These are the kind of things we [at least I] expect to see/hear/find in
> submissions we can't directly test. A.

this also means it'd be better to split the patch into smaller patches
and you can accept these patches one-by-one? and we can fix these small
patches more easily.

--
   Levente                               "Si vis pacem para bellum!"

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

RE: [PATCH] OpenSSL for Windows Mobile 2003

Daniel Diaz Sanchez-2
Hello,

I will try to correct the "patch" using the developer's branch asap. It may
take some time, but is reasonable.  Once I modify the code of last version
of openssl somebody may test it :), apart from me of course

The reason of this patch is that Pocket PC, Windows Mobile... and also Smart
Phones are a subset (or implements a subset) of Windows CE so many standard
C/C++ is missing and other things as console are missing also, so openssl
does not work for those platforms unless "specific" changes are taken into
account when compiling (limited devices).

What Farkas Levente submit is absolutely true, while all the development
tools of Microsoft are really expensive, embedded visual studio and
emulators are free. Perhaps, can be a good idea to have openssl everywhere,
including smart phones :)

I'll try to submit the new patch as soon as possible,

Thanks for the comments,

Daniel Díaz

> -----Original Message-----
> From: Farkas Levente [mailto:[hidden email]]
> Sent: miércoles, 20 de julio de 2005 19:22
> To: [hidden email]
> Cc: [hidden email]; 'amarin'
> Subject: Re: [PATCH] OpenSSL for Windows Mobile 2003
>
> Andy Polyakov wrote:
> >> I send this topic another time adding [PATCH] to the subject
> >> (contribution).
> >
> >
> > Well, it's not really "[PATCH]" keyword in the subject that makes
> > magical difference, but rather our ability to audit and test the
> > submitted code multiplied by degree of common interest for platform in
> > question. In other words, *if* either of development team members had
> > access to platform in question or similar one *and* there was commonly
> > expressed need for CE support, then you would observe better
> > round-trips. Just to make sure, "*if*" in previous sentence means that
> > none of us has access to Windows CE platform, which is why we're a bit
> > reluctant to even *say* something on the matter. We kind of expect other
> > Windows CE developers on the list to speak up, make some peer review and
> > put a word for submission.
>
> i'm realy would like to see this patch included in the upstream openssl!
>   i even volunteer to review the patch or modify to your fit.
> about the win ce platform access. all win ce (pocket pc, windows mobile)
> development enviroment (eg. eMbedded Visual C++) can be downloaded from
> ms for free (which is not usual from ms:-) at the same time you can
> download "Emulator Images for Windows Mobile 2003 Second Edition
> software for Pocket PC" so you can compile with eVC++ on win32 for CE
> and you can also test it on win32 with the pocket pc emulator.
>
> >> 3 OpenSSL 0.9.7f [Not tested with newer versions]
> >
> >             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This is actually another
> > reason for us to be reluctant. We don't want to add new platforms to
> > branch in support-only phase. Note that there is a number of CE-specific
> > changes in development as well as just released 0.9.8 version and would
> > rather refine newer version than risk support-only/stable version get
> > broken. So that if you wish to pursue this, I would really recommend to
> > switch to development branch or at least 0.9.8.
>
> it'sacceptable, although since the api change a bit, it'd be nice to
> backport it to the latest 0.9.7 release too.
>
> > And some comments after just scrolling through...
> >
> >> -#if ... !defined(OPENSSL_SYS_WINCE)
> >> +#if ... !defined(OPENSSL_SYS_WINCE) && !defined(PPC2003)
> >
> >
> > ... and similar in different flavors in a lot of other places. Why not
> > define OPENSSL_SYS_WINCE at command line or by some other means instead?
> > As far as I understand platform in question *is* Windows CE-based. One
> > can argue that we should/could have used pre-defined _WIN32_WCE macro
> > instead of own private OPENSSL_SYS_WINCE, but that's the way things are.
> > So I'd strongly recommend to find a way to define OPENSSL_SYS_WINCE
> > instead of "polluting" the code with own private PPC2003 macro.
>
> it's a bit more complicated since not all wince is ppc2003, but all
> ppc2003 is wince:-)
>
> > These are the kind of things we [at least I] expect to see/hear/find in
> > submissions we can't directly test. A.
>
> this also means it'd be better to split the patch into smaller patches
> and you can accept these patches one-by-one? and we can fix these small
> patches more easily.
>
> --
>    Levente                               "Si vis pacem para bellum!"



______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] OpenSSL for Windows Mobile 2003

Andy Polyakov
In reply to this post by Farkas Levente
> about the win ce platform access. all win ce (pocket pc, windows mobile)
> development enviroment (eg. eMbedded Visual C++) can be downloaded from
> ms for free (which is not usual from ms:-) at the same time you can
> download "Emulator Images for Windows Mobile 2003 Second Edition
> software for Pocket PC" so you can compile with eVC++ on win32 for CE
> and you can also test it on win32 with the pocket pc emulator.

I've tried to install this once, but all attempts to run emulator
resulted in system lock-up [first network went off, then system got
slower and slower beyond frustration limit and I was ending up pulling
the power plug]. Would I trouble-shoot to get it working? No way, I
simply don't have the energy, burden is heavy enough already... I mean
general availabilty doesn't necessarily means that some of team members
actually have it and actively use it in development cycle.

>>> -#if ... !defined(OPENSSL_SYS_WINCE)
>>> +#if ... !defined(OPENSSL_SYS_WINCE) && !defined(PPC2003)
>>
>> ... and similar in different flavors in a lot of other places. Why not
>> define OPENSSL_SYS_WINCE at command line or by some other means
>> instead?
>
> it's a bit more complicated since not all wince is ppc2003, but all
> ppc2003 is wince:-)

??? This is kind of my argument. I mean if all ppc2003 are wince, how
come more generic CE-specific macro is not good for them? I fail to see
how it's complicated... Always consider larger picture! A.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [hidden email]
Automated List Manager                           [hidden email]