Commit b440c25d authored by Dr. Stephen Henson's avatar Dr. Stephen Henson
Browse files

Changes needed to support WinCE compilation:

Don't try to raise SIGABRT if not defined.
Return from fips_dhvs.c main instead of calling exit.
Workaround for lack of GetSystemFileAsFileTime.
Disable optimisation for part of bn_nist.c to avoid compiler bug.
Remove /WX flag so we don't exist on warnings.
parent 76f4af20
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1047,6 +1047,10 @@ int BN_nist_mod_384(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,
	return 1;
	}

#ifdef _W32_WCE
#pragma optimize( "", off )
#endif

#define BN_NIST_521_RSHIFT	(521%BN_BITS2)
#define BN_NIST_521_LSHIFT	(BN_BITS2-BN_NIST_521_RSHIFT)
#define BN_NIST_521_TOP_MASK	((BN_ULONG)BN_MASK2>>BN_NIST_521_LSHIFT)
@@ -1113,6 +1117,10 @@ int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,
	return 1;
	}

#ifdef _W32_WCE
#pragma optimize( "", on )
#endif

int (*BN_nist_mod_func(const BIGNUM *p))(BIGNUM *r, const BIGNUM *a, const BIGNUM *field, BN_CTX *ctx)
	{
	if (BN_ucmp(&_bignum_nist_p_192, p) == 0)
+2 −0
Original line number Diff line number Diff line
@@ -382,7 +382,9 @@ void OpenSSLDie(const char *file,int line,const char *assertion)
	abort();
#else
	/* Win32 abort() customarily shows a dialog, but we just did that... */
#ifdef SIGABRT
	raise(SIGABRT);
#endif
	_exit(3);
#endif
	}
+1 −1
Original line number Diff line number Diff line
@@ -286,7 +286,7 @@ int main(int argc, char **argv)
	return 0;
	parse_error:
	fprintf(stderr, "Error Parsing request file\n");
	exit(1);
	return 1;
	}

#endif
+8 −0
Original line number Diff line number Diff line
@@ -232,6 +232,9 @@ void FIPS_get_timevec(unsigned char *buf, unsigned long *pctr)
	{
#ifdef OPENSSL_SYS_WIN32
	FILETIME ft;
#ifdef _WIN32_WCE
	SYSTEMTIME t;
#endif
#elif defined(OPENSSL_SYS_VXWORKS)
        struct timespec ts;
#else
@@ -243,7 +246,12 @@ void FIPS_get_timevec(unsigned char *buf, unsigned long *pctr)
#endif

#ifdef OPENSSL_SYS_WIN32
#ifdef _WIN32_WCE
	GetSystemTime(&t);
	SystemTimeToFileTime(&t, &ft);
#else
	GetSystemTimeAsFileTime(&ft);
#endif
	buf[0] = (unsigned char) (ft.dwHighDateTime & 0xff);
	buf[1] = (unsigned char) ((ft.dwHighDateTime >> 8) & 0xff);
	buf[2] = (unsigned char) ((ft.dwHighDateTime >> 16) & 0xff);
+1 −1
Original line number Diff line number Diff line
@@ -123,7 +123,7 @@ elsif ($FLAVOR =~ /CE/)
    }

    $cc='$(CC)';
    $base_cflags=' /W3 /WX /GF /Gy /nologo -DUNICODE -D_UNICODE -DOPENSSL_SYSNAME_WINCE -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -DOPENSSL_SMALL_FOOTPRINT';
    $base_cflags=' /W3 /GF /Gy /nologo -DUNICODE -D_UNICODE -DOPENSSL_SYSNAME_WINCE -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -DNO_CHMOD -DOPENSSL_SMALL_FOOTPRINT';
    $base_cflags.=" $wcecdefs";
    $base_cflags.=' -I$(WCECOMPAT)/include'		if (defined($ENV{'WCECOMPAT'}));
    $base_cflags.=' -I$(PORTSDK_LIBPATH)/../../include'	if (defined($ENV{'PORTSDK_LIBPATH'}));