diff -Naur vendor/Configure rel_openssl_0.9.7c/Configure
--- vendor/Configure	2004-03-19 08:23:57.593750000 -0700
+++ rel_openssl_0.9.7c/Configure	2004-03-19 08:53:35.609375000 -0700
@@ -493,6 +493,10 @@
 #
 "OS390-Unix","c89.sh:-O -DB_ENDIAN -DCHARSET_EBCDIC -DNO_SYS_PARAM_H  -D_ALL_SOURCE::(unknown):::THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::",
 
+# OS/390 System Programming C (SPC) Environment
+#
+"OS390-SPC","c89.sh:-O -DB_ENDIAN -DCHARSET_EBCDIC -DNO_SYS_PARAM_H  -D_ALL_SOURCE -DOPENSSL_SYS_OS390_SPC -DGETPID_IS_MEANINGLESS -DTERMIOS -DOPENSSL_THREADS -DBN_DIV2W -DOPENSSL_NO_SOCK -DOPENSSL_NO_STDIO -DOPENSSL_NO_FP_API::(unknown):::THIRTY_TWO_BIT DES_PTR DES_UNROLL MD2_CHAR RC4_INDEX RC4_CHAR BF_PTR:::",
+
 # Windows NT, Microsoft Visual C++ 4.0
 
 "VC-NT","cl::::WINNT::BN_LLONG RC4_INDEX EXPORT_VAR_AS_FN ${x86_gcc_opts}::::::::::win32",
diff -Naur vendor/apps/ca.c rel_openssl_0.9.7c/apps/ca.c
--- vendor/apps/ca.c	2003-04-03 11:50:48.000000000 -0700
+++ rel_openssl_0.9.7c/apps/ca.c	2004-01-12 14:34:54.000000000 -0700
@@ -3203,13 +3203,22 @@
 	p=(char *)str->data;
 	for (j=str->length; j>0; j--)
 		{
+#ifdef CHARSET_EBCDIC
+		if ((*p >= 0x20) && (*p <= 0x7e))
+		        BIO_printf(bio_err,"%c", os_toebcdic[*p]);
+#else
 		if ((*p >= ' ') && (*p <= '~'))
 			BIO_printf(bp,"%c",*p);
+#endif
 		else if (*p & 0x80)
 			BIO_printf(bp,"\\0x%02X",*p);
 		else if ((unsigned char)*p == 0xf7)
 			BIO_printf(bp,"^?");
+#ifdef CHARSET_EBCDIC
+	        else    BIO_printf(bio_err,"^%c",os_toebcdic[*p+0x40]);
+#else
 		else	BIO_printf(bp,"^%c",*p+'@');
+#endif
 		p++;
 		}
 	BIO_printf(bp,"'\n");
diff -Naur vendor/crypto/asn1/a_print.c rel_openssl_0.9.7c/crypto/asn1/a_print.c
--- vendor/crypto/asn1/a_print.c	2000-12-08 12:06:56.000000000 -0700
+++ rel_openssl_0.9.7c/crypto/asn1/a_print.c	2004-01-12 14:34:55.000000000 -0700
@@ -72,27 +72,18 @@
 	while ((*s) && (len-- != 0))
 		{
 		c= *(s++);
-#ifndef CHARSET_EBCDIC
-		if (!(	((c >= 'a') && (c <= 'z')) ||
-			((c >= 'A') && (c <= 'Z')) ||
-			(c == ' ') ||
-			((c >= '0') && (c <= '9')) ||
-			(c == ' ') || (c == '\'') ||
-			(c == '(') || (c == ')') ||
-			(c == '+') || (c == ',') ||
-			(c == '-') || (c == '.') ||
-			(c == '/') || (c == ':') ||
-			(c == '=') || (c == '?')))
-			ia5=1;
 		if (c&0x80)
+		  {
 			t61=1;
-#else
-		if (!isalnum(c) && (c != ' ') &&
-		    strchr("'()+,-./:=?", c) == NULL)
+			break;
+		  }
+                if (!(  ((c > 0x40) && (c < 0x5b)) ||   /* AZ */
+			((c > 0x60) && (c < 0x7b)) ||   /* az */
+			((c > 0x2a) && (c < 0x3b)) ||   /* +,-./09: */
+			(c == 0x20) || (c == 0x27) ||   /* SPC, ' */
+			(c == 0x28) || (c == 0x29) ||   /* () */
+			(c == 0x3d) || (c == 0x3f)))    /* =? */
 			ia5=1;
-		if (os_toascii[c] & 0x80)
-			t61=1;
-#endif
 		}
 	if (t61) return(V_ASN1_T61STRING);
 	if (ia5) return(V_ASN1_IA5STRING);
diff -Naur vendor/crypto/asn1/a_strex.c rel_openssl_0.9.7c/crypto/asn1/a_strex.c
--- vendor/crypto/asn1/a_strex.c	2003-05-21 09:29:28.000000000 -0600
+++ rel_openssl_0.9.7c/crypto/asn1/a_strex.c	2004-02-15 09:29:17.000000000 -0700
@@ -513,7 +513,7 @@
 	return do_name_ex(send_bio_chars, out, nm, indent, flags);
 }
 
-
+#ifndef OPENSSL_NO_FP_API
 int X509_NAME_print_ex_fp(FILE *fp, X509_NAME *nm, int indent, unsigned long flags)
 {
 	if(flags == XN_FLAG_COMPAT)
@@ -528,6 +528,7 @@
 		}
 	return do_name_ex(send_fp_chars, fp, nm, indent, flags);
 }
+#endif
 
 int ASN1_STRING_print_ex(BIO *out, ASN1_STRING *str, unsigned long flags)
 {
@@ -535,10 +536,12 @@
 }
 
 
+#ifndef OPENSSL_NO_FP_API
 int ASN1_STRING_print_ex_fp(FILE *fp, ASN1_STRING *str, unsigned long flags)
 {
 	return do_print_ex(send_fp_chars, fp, flags, str);
 }
+#endif
 
 /* Utility function: convert any string type to UTF8, returns number of bytes
  * in output string or a negative error code
diff -Naur vendor/crypto/bio/bss_log.c rel_openssl_0.9.7c/crypto/bio/bss_log.c
--- vendor/crypto/bio/bss_log.c	2002-11-15 15:41:53.000000000 -0700
+++ rel_openssl_0.9.7c/crypto/bio/bss_log.c	2004-02-13 09:24:16.000000000 -0700
@@ -274,7 +274,11 @@
 {
 	LPCSTR lpszStrings[2];
 	WORD evtype= EVENTLOG_ERROR_TYPE;
+#if defined(GETPID_IS_MEANINGLESS)
+	int pid = 1;
+#else
 	int pid = _getpid();
+#endif
 	char pidbuf[DECIMAL_SIZE(pid)+4];
 
 	switch (priority)
diff -Naur vendor/crypto/bn/bn_kron.c rel_openssl_0.9.7c/crypto/bn/bn_kron.c
--- vendor/crypto/bn/bn_kron.c	2000-11-29 17:18:19.000000000 -0700
+++ rel_openssl_0.9.7c/crypto/bn/bn_kron.c	2004-02-15 07:35:01.000000000 -0700
@@ -53,6 +53,7 @@
  *
  */
 
+#include <stdlib.h>
 #include "bn_lcl.h"
 
 
diff -Naur vendor/crypto/conf/conf.h rel_openssl_0.9.7c/crypto/conf/conf.h
--- vendor/crypto/conf/conf.h	2002-06-13 12:38:51.000000000 -0600
+++ rel_openssl_0.9.7c/crypto/conf/conf.h	2004-02-15 07:50:11.000000000 -0700
@@ -125,7 +125,9 @@
 char *CONF_get_string(LHASH *conf,const char *group,const char *name);
 long CONF_get_number(LHASH *conf,const char *group,const char *name);
 void CONF_free(LHASH *conf);
+#ifndef OPENSSL_NO_FP_API
 int CONF_dump_fp(LHASH *conf, FILE *out);
+#endif
 int CONF_dump_bio(LHASH *conf, BIO *out);
 
 void OPENSSL_config(const char *config_name);
@@ -159,7 +161,9 @@
 char *NCONF_get_string(const CONF *conf,const char *group,const char *name);
 int NCONF_get_number_e(const CONF *conf,const char *group,const char *name,
 		       long *result);
+#ifndef OPENSSL_NO_FP_API
 int NCONF_dump_fp(const CONF *conf, FILE *out);
+#endif
 int NCONF_dump_bio(const CONF *conf, BIO *out);
 
 #if 0 /* The following function has no error checking,
diff -Naur vendor/crypto/conf/conf_def.c rel_openssl_0.9.7c/crypto/conf/conf_def.c
--- vendor/crypto/conf/conf_def.c	2002-11-13 23:50:32.000000000 -0700
+++ rel_openssl_0.9.7c/crypto/conf/conf_def.c	2004-02-15 10:29:20.000000000 -0700
@@ -100,7 +100,11 @@
 	def_dump,
 	def_is_number,
 	def_to_int,
+#ifndef OPENSSL_NO_STDIO
 	def_load
+#else
+	NULL
+#endif
 	};
 
 static CONF_METHOD WIN32_method = {
@@ -113,7 +117,11 @@
 	def_dump,
 	def_is_number,
 	def_to_int,
+#ifndef OPENSSL_NO_STDIO
 	def_load
+#else
+	NULL
+#endif
 	};
 
 CONF_METHOD *NCONF_default()
@@ -181,6 +189,7 @@
 	return 1;
 	}
 
+#ifndef OPENSSL_NO_STDIO
 static int def_load(CONF *conf, const char *name, long *line)
 	{
 	int ret;
@@ -205,6 +214,7 @@
 
 	return ret;
 	}
+#endif
 
 static int def_load_bio(CONF *conf, BIO *in, long *line)
 	{
diff -Naur vendor/crypto/conf/conf_lib.c rel_openssl_0.9.7c/crypto/conf/conf_lib.c
--- vendor/crypto/conf/conf_lib.c	2002-06-13 12:38:51.000000000 -0600
+++ rel_openssl_0.9.7c/crypto/conf/conf_lib.c	2004-02-15 10:26:38.000000000 -0700
@@ -87,6 +87,7 @@
 	return 1;
 	}
 
+#ifndef OPENSSL_NO_STDIO
 LHASH *CONF_load(LHASH *conf, const char *file, long *eline)
 	{
 	LHASH *ltmp;
@@ -108,6 +109,7 @@
 
 	return ltmp;
 	}
+#endif
 
 #ifndef OPENSSL_NO_FP_API
 LHASH *CONF_load_fp(LHASH *conf, FILE *fp,long *eline)
diff -Naur vendor/crypto/conf/conf_mod.c rel_openssl_0.9.7c/crypto/conf/conf_mod.c
--- vendor/crypto/conf/conf_mod.c	2002-07-30 06:20:12.000000000 -0600
+++ rel_openssl_0.9.7c/crypto/conf/conf_mod.c	2004-02-15 15:55:11.000000000 -0700
@@ -162,6 +162,7 @@
 
 	}
 
+#ifndef OPENSSL_NO_STDIO
 int CONF_modules_load_file(const char *filename, const char *appname,
 			   unsigned long flags)
 	{
@@ -201,6 +202,7 @@
 
 	return ret;
 	}
+#endif
 
 static int module_run(const CONF *cnf, char *name, char *value,
 		      unsigned long flags)
@@ -542,6 +544,7 @@
 
 /* Return default config file name */
 
+#ifndef OPENSSL_NO_STDIO
 char *CONF_get1_default_config_file(void)
 	{
 	char *file;
@@ -569,6 +572,7 @@
 
 	return file;
 	}
+#endif
 
 /* This function takes a list separated by 'sep' and calls the
  * callback function giving the start and length of each member
diff -Naur vendor/crypto/conf/conf_sap.c rel_openssl_0.9.7c/crypto/conf/conf_sap.c
--- vendor/crypto/conf/conf_sap.c	2003-01-30 10:37:39.000000000 -0700
+++ rel_openssl_0.9.7c/crypto/conf/conf_sap.c	2004-02-15 10:20:41.000000000 -0700
@@ -86,7 +86,7 @@
 #endif
 	/* Add others here? */
 
-
+#ifndef OPENSSL_NO_FP_API
 	ERR_clear_error();
 	if (CONF_modules_load_file(NULL, NULL,
 					CONF_MFLAGS_IGNORE_MISSING_FILE) <= 0)
@@ -101,7 +101,7 @@
 			}
 		exit(1);
 		}
-
+#endif
 	return;
 	}
 
diff -Naur vendor/crypto/des/read2pwd.c rel_openssl_0.9.7c/crypto/des/read2pwd.c
--- vendor/crypto/des/read2pwd.c	2002-12-03 07:21:02.000000000 -0700
+++ rel_openssl_0.9.7c/crypto/des/read2pwd.c	2004-02-15 07:30:35.000000000 -0700
@@ -113,6 +113,8 @@
 #include <openssl/des.h>
 #include <openssl/ui.h>
 
+#ifndef OPENSSL_NO_STDIO
+
 int DES_read_password(DES_cblock *key, const char *prompt, int verify)
 	{
 	int ok;
@@ -137,3 +139,5 @@
 	OPENSSL_cleanse(buff,BUFSIZ);
 	return(ok);
 	}
+
+#endif
diff -Naur vendor/crypto/engine/eng_openssl.c rel_openssl_0.9.7c/crypto/engine/eng_openssl.c
--- vendor/crypto/engine/eng_openssl.c	2002-12-04 15:54:13.000000000 -0700
+++ rel_openssl_0.9.7c/crypto/engine/eng_openssl.c	2004-02-15 12:20:30.000000000 -0700
@@ -93,6 +93,9 @@
 #undef TEST_ENG_OPENSSL_SHA_P_UPDATE
 #undef TEST_ENG_OPENSSL_SHA_P_FINAL 
 #endif
+#if defined(OPENSSL_SYS_OS390_SPC)
+#undef TEST_ENG_OPENSSL_PKEY
+#endif
 
 #ifdef TEST_ENG_OPENSSL_RC4
 static int openssl_ciphers(ENGINE *e, const EVP_CIPHER **cipher,
diff -Naur vendor/crypto/engine/hw_aep.c rel_openssl_0.9.7c/crypto/engine/hw_aep.c
--- vendor/crypto/engine/hw_aep.c	2002-06-27 11:32:15.000000000 -0600
+++ rel_openssl_0.9.7c/crypto/engine/hw_aep.c	2004-02-15 10:00:57.000000000 -0700
@@ -848,8 +848,11 @@
 
 	CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
 
+#ifndef GETPID_IS_MEANINGLESS
 	curr_pid = getpid();
-
+#else
+	curr_pid = 1;
+#endif
 	/*Check if this is the first time this is being called from the current
 	  process*/
 	if (recorded_pid != curr_pid)
diff -Naur vendor/crypto/md2/md2test.c rel_openssl_0.9.7c/crypto/md2/md2test.c
--- vendor/crypto/md2/md2test.c	2003-05-28 14:56:04.000000000 -0600
+++ rel_openssl_0.9.7c/crypto/md2/md2test.c	2004-01-12 14:34:57.000000000 -0700
@@ -87,6 +87,7 @@
 	NULL,
 	};
 
+#ifndef CHARSET_EBCDIC
 static char *ret[]={
 	"8350e5a3e24c153df2275c9f80692773",
 	"32ec01ec4a6dac72c0ab96fb34c0b5d1",
@@ -96,6 +97,17 @@
 	"da33def2a42df13975352846c30338cd",
 	"d5976f79d83d3a0dc9806c3c66f3efd8",
 	};
+#else
+static char *ret[]={
+ "8350e5a3e24c153df2275c9f80692773",
+ "491d9d69de47a033c512df07b0dcd392",
+ "58f8cbcc062baa2bfe9359d67ebe8b78",
+ "c2074269e16867f9593dc86cbcc678c2",
+ "b7c1f9e023dca329a418565b7a6e5fce",
+ "7392fa94b7045ab8b570e07c8abf7b70",
+ "fa12bc355832afefeccf179b9ebee0ed",
+ };
+#endif
 
 static char *pt(unsigned char *md);
 int main(int argc, char *argv[])
diff -Naur vendor/crypto/md4/md4test.c rel_openssl_0.9.7c/crypto/md4/md4test.c
--- vendor/crypto/md4/md4test.c	2002-11-28 11:57:03.000000000 -0700
+++ rel_openssl_0.9.7c/crypto/md4/md4test.c	2004-01-12 14:34:57.000000000 -0700
@@ -83,6 +83,7 @@
 	NULL,
 	};
 
+#ifndef CHARSET_EBCDIC
 static char *ret[]={
 "31d6cfe0d16ae931b73c59d7e0c089c0",
 "bde52cb31de33e46245e05fbdbd6fb24",
@@ -92,6 +93,17 @@
 "043f8582f241db351ce627e153e7f0e4",
 "e33b4ddc9c38f2199c3e7b164fcc0536",
 };
+#else
+static char *ret[]={
+"31d6cfe0d16ae931b73c59d7e0c089c0",
+"9d16e62335fbfc2946dd98546d5ca3e6",
+"6c4e5574c289fe63e55f9b6e0c4df7b7",
+"d35339c99cdb1a7066142b77718905f8",
+"337b8432160246114f1194ee77d8d0b3",
+"cec19c9121bb833f8cf6759a1f56862c",
+"c6cc0b153597adcfa5a7b0790475b463",
+};
+#endif
 
 static char *pt(unsigned char *md);
 int main(int argc, char *argv[])
diff -Naur vendor/crypto/md5/md5test.c rel_openssl_0.9.7c/crypto/md5/md5test.c
--- vendor/crypto/md5/md5test.c	2002-11-28 11:57:05.000000000 -0700
+++ rel_openssl_0.9.7c/crypto/md5/md5test.c	2004-01-12 14:34:57.000000000 -0700
@@ -83,6 +83,7 @@
 	NULL,
 	};
 
+#ifndef CHARSET_EBCDIC
 static char *ret[]={
 	"d41d8cd98f00b204e9800998ecf8427e",
 	"0cc175b9c0f1b6a831c399e269772661",
@@ -92,6 +93,17 @@
 	"d174ab98d277d9f5a5611c2c9f419d9f",
 	"57edf4a22be3c955ac49da2e2107b67a",
 	};
+#else
+static char *ret[]={
+ "d41d8cd98f00b204e9800998ecf8427e",
+ "cd25041f9f36811b04ab3015805fe816",
+ "fe4ea0d98f9cd8d1d27f102a93cb0bb0",
+ "8cd8d86f6282b06cf090780618fbab67",
+ "423ea6e0bc36b9603b60a1018c7db97d",
+ "126bf19c50165c22ee28cb62c3ce36cc",
+ "1a54413ed5f35c0ab22b22beb2b94f99",
+ };
+#endif
 
 static char *pt(unsigned char *md);
 int main(int argc, char *argv[])
diff -Naur vendor/crypto/opensslconf.h.in rel_openssl_0.9.7c/crypto/opensslconf.h.in
--- vendor/crypto/opensslconf.h.in	2004-03-19 08:24:04.906250000 -0700
+++ rel_openssl_0.9.7c/crypto/opensslconf.h.in	2004-03-19 08:53:20.484375000 -0700
@@ -156,3 +156,9 @@
 
 #endif /* DES_DEFAULT_OPTIONS */
 #endif /* HEADER_DES_LOCL_H */
+
+#if defined(OPENSSL_SYS_OS390_SPC)
+/* OS/390 SPC options */
+#pragma runopts(NOSPIE NOSTAE)
+#pragma pack(1)
+#endif /* _OSMVS */
diff -Naur vendor/crypto/pem/pem.h rel_openssl_0.9.7c/crypto/pem/pem.h
--- vendor/crypto/pem/pem.h	2002-11-12 06:22:41.000000000 -0700
+++ rel_openssl_0.9.7c/crypto/pem/pem.h	2004-02-15 08:13:06.000000000 -0700
@@ -505,6 +505,7 @@
 #endif
 
 #ifndef OPENSSL_SYS_WIN16
+#ifndef OPENSSL_NO_FP_API
 int	PEM_read(FILE *fp, char **name, char **header,
 		unsigned char **data,long *len);
 int	PEM_write(FILE *fp,char *name,char *hdr,unsigned char *data,long len);
@@ -515,6 +516,8 @@
 		       pem_password_cb *callback, void *u);
 STACK_OF(X509_INFO) *	PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk,
 	pem_password_cb *cb, void *u);
+#endif /* OPENSSL_NO_FP_API */
+
 #endif
 
 int	PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type,
@@ -597,6 +600,7 @@
 				  pem_password_cb *cb, void *u);
 EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, void *u);
 
+#ifndef OPENSSL_NO_FP_API
 int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
 				  char *kstr, int klen,
 				  pem_password_cb *cb, void *u);
@@ -611,6 +615,7 @@
 
 int PEM_write_PKCS8PrivateKey(FILE *fp,EVP_PKEY *x,const EVP_CIPHER *enc,
 			      char *kstr,int klen, pem_password_cb *cd, void *u);
+#endif /* OPENSSL_NO_FP_API */
 
 #endif /* SSLEAY_MACROS */
 
diff -Naur vendor/crypto/rand/rand_unix.c rel_openssl_0.9.7c/crypto/rand/rand_unix.c
--- vendor/crypto/rand/rand_unix.c	2002-11-28 01:08:40.000000000 -0700
+++ rel_openssl_0.9.7c/crypto/rand/rand_unix.c	2004-02-13 12:01:12.000000000 -0700
@@ -115,7 +115,7 @@
 #include <openssl/rand.h>
 #include "rand_lcl.h"
 
-#if !(defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_VXWORKS))
+#if !(defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_OS390_SPC) )
 
 #include <sys/types.h>
 #include <sys/time.h>
@@ -243,3 +243,18 @@
     return 0;
 }
 #endif
+
+#if defined(OPENSSL_SYS_OS390_SPC)
+
+#include <time.h>
+
+int RAND_poll(void)
+{
+  unsigned long l;
+  
+  l=time(NULL);
+  RAND_add(&l,sizeof(l),0);
+  
+  return 0;
+}
+#endif
diff -Naur vendor/crypto/ui/ui_compat.c rel_openssl_0.9.7c/crypto/ui/ui_compat.c
--- vendor/crypto/ui/ui_compat.c	2002-02-05 10:15:18.000000000 -0700
+++ rel_openssl_0.9.7c/crypto/ui/ui_compat.c	2004-02-15 10:07:13.000000000 -0700
@@ -56,6 +56,8 @@
 #include <string.h>
 #include <openssl/ui_compat.h>
 
+#ifndef OPENSSL_NO_STDIO
+
 int _ossl_old_des_read_pw_string(char *buf,int length,const char *prompt,int verify)
 	{
 	return UI_UTIL_read_pw_string(buf, length, prompt, verify);
@@ -65,3 +67,5 @@
 	{
 	return UI_UTIL_read_pw(buf, buff, size, prompt, verify);
 	}
+
+#endif
diff -Naur vendor/crypto/ui/ui_openssl.c rel_openssl_0.9.7c/crypto/ui/ui_openssl.c
--- vendor/crypto/ui/ui_openssl.c	2003-01-13 06:15:19.000000000 -0700
+++ rel_openssl_0.9.7c/crypto/ui/ui_openssl.c	2004-02-15 13:44:21.000000000 -0700
@@ -199,6 +199,12 @@
 #undef SGTTY
 #endif
 
+#if defined(OPENSSL_SYS_OS390_SPC)
+#undef TERMIOS
+#undef TERMIO
+#undef SGTTY
+#endif
+
 #ifdef TERMIOS
 # include <termios.h>
 # define TTY_STRUCT		struct termios
@@ -255,6 +261,9 @@
  */
 # define TTY_STRUCT int
 #endif
+#if defined(OPENSSL_SYS_OS390_SPC)
+# define TTY_STRUCT int
+#endif
 
 #ifndef NX509_SIG
 # define NX509_SIG 32
@@ -319,6 +328,8 @@
 	return &ui_openssl;
 	}
 
+#ifndef OPENSSL_SYS_OS390_SPC
+
 /* The following function makes sure that info and error strings are printed
    before any prompt. */
 static int write_string(UI *ui, UI_STRING *uis)
@@ -460,7 +471,7 @@
 	CRYPTO_w_lock(CRYPTO_LOCK_UI);
 	is_a_tty = 1;
 
-#if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS)
+#if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_OS390_SPC)
 	tty_in=stdin;
 	tty_out=stderr;
 #else
@@ -671,3 +682,27 @@
 	return(strlen(buf));
 	}
 #endif
+
+#else /* OPENSSL_SYS_OS390_SPC */
+
+static int read_string(UI *ui, UI_STRING *uis)
+{
+   return 0;
+}
+
+static int write_string(UI *ui, UI_STRING *uis)
+{
+   return 0;
+}
+
+static int open_console(UI *ui)
+{
+   return 0;
+}
+
+static int close_console(UI *ui)
+{
+   return 1;
+}
+
+#endif /* OPENSSL_SYS_OS390_SPC */
diff -Naur vendor/crypto/ui/ui_util.c rel_openssl_0.9.7c/crypto/ui/ui_util.c
--- vendor/crypto/ui/ui_util.c	2003-01-13 07:17:47.000000000 -0700
+++ rel_openssl_0.9.7c/crypto/ui/ui_util.c	2004-02-15 08:16:58.000000000 -0700
@@ -56,6 +56,8 @@
 #include <string.h>
 #include <openssl/ui.h>
 
+#ifndef OPENSSL_NO_STDIO
+
 int UI_UTIL_read_pw_string(char *buf,int length,const char *prompt,int verify)
 	{
 	char buff[BUFSIZ];
@@ -65,6 +67,7 @@
 	OPENSSL_cleanse(buff,BUFSIZ);
 	return(ret);
 	}
+#endif
 
 int UI_UTIL_read_pw(char *buf,char *buff,int size,const char *prompt,int verify)
 	{
diff -Naur vendor/crypto/uid.c rel_openssl_0.9.7c/crypto/uid.c
--- vendor/crypto/uid.c	2002-10-09 08:41:11.000000000 -0600
+++ rel_openssl_0.9.7c/crypto/uid.c	2004-02-15 13:30:02.000000000 -0700
@@ -65,7 +65,7 @@
 	return issetugid();
 	}
 
-#elif defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VXWORKS)
+#elif defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_OS390_SPC)
 
 int OPENSSL_issetugid(void)
 	{
diff -Naur vendor/crypto/x509v3/v3_alt.c rel_openssl_0.9.7c/crypto/x509v3/v3_alt.c
--- vendor/crypto/x509v3/v3_alt.c	2001-04-11 07:55:06.000000000 -0600
+++ rel_openssl_0.9.7c/crypto/x509v3/v3_alt.c	2004-01-12 14:34:58.000000000 -0700
@@ -94,6 +94,15 @@
 	return ret;
 }
 
+#ifdef CHARSET_EBCDIC
+static const char _unsup[] = {0x3c,0x75,0x6e,0x73,0x75,0x70,0x70,0x6f,
+       0x72,0x74,0x65,0x64,0x3e,0 };
+static const char _inval[] = {0x3c,0x69,0x6e,0x76,0x61,0x6c,0x69,0x64,0x3e,0};
+#else
+static const char _unsup[] = "<unsupported>";
+static const char _inval[] = "<invalid>";
+#endif
+
 STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method,
 				GENERAL_NAME *gen, STACK_OF(CONF_VALUE) *ret)
 {
@@ -102,15 +111,15 @@
 	switch (gen->type)
 	{
 		case GEN_OTHERNAME:
-		X509V3_add_value("othername","<unsupported>", &ret);
+		X509V3_add_value("othername",_unsup, &ret);
 		break;
 
 		case GEN_X400:
-		X509V3_add_value("X400Name","<unsupported>", &ret);
+		X509V3_add_value("X400Name",_unsup, &ret);
 		break;
 
 		case GEN_EDIPARTY:
-		X509V3_add_value("EdiPartyName","<unsupported>", &ret);
+		X509V3_add_value("EdiPartyName",_unsup, &ret);
 		break;
 
 		case GEN_EMAIL:
@@ -134,15 +143,21 @@
 		p = gen->d.ip->data;
 		/* BUG: doesn't support IPV6 */
 		if(gen->d.ip->length != 4) {
-			X509V3_add_value("IP Address","<invalid>", &ret);
+			X509V3_add_value("IP Address",_inval, &ret);
 			break;
 		}
 		sprintf(oline, "%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
+#ifdef CHARSET_EBCDIC
+		ebcdic2ascii(oline, oline, strlen(oline));
+#endif
 		X509V3_add_value("IP Address",oline, &ret);
 		break;
 
 		case GEN_RID:
 		i2t_ASN1_OBJECT(oline, 256, gen->d.rid);
+#ifdef CHARSET_EBCDIC
+                ebcdic2ascii(oline, oline, strlen(oline));
+#endif
 		X509V3_add_value("Registered ID",oline, &ret);
 		break;
 	}
@@ -439,6 +454,9 @@
 }
 
 if(is_string) {
+#ifdef CHARSET_EBCDIC
+        ebcdic2ascii(value, value, strlen(value));
+#endif
 	if(!(gen->d.ia5 = M_ASN1_IA5STRING_new()) ||
 		      !ASN1_STRING_set(gen->d.ia5, (unsigned char*)value,
 				       strlen(value))) {
diff -Naur vendor/crypto/x509v3/v3_utl.c rel_openssl_0.9.7c/crypto/x509v3/v3_utl.c
--- vendor/crypto/x509v3/v3_utl.c	2002-11-13 17:45:04.000000000 -0700
+++ rel_openssl_0.9.7c/crypto/x509v3/v3_utl.c	2004-01-12 14:34:58.000000000 -0700
@@ -111,17 +111,25 @@
 	OPENSSL_free(conf);
 }
 
+#ifdef CHARSET_EBCDIC
+static const char _true[] = {0x54, 0x52, 0x55, 0x45, 0x00 };
+static const char _false[] = {0x46, 0x41, 0x4c, 0x53, 0x45, 0x00};
+#else
+static const char _true[] = "TRUE";
+static const char _false[] = "FALSE";
+#endif
+
 int X509V3_add_value_bool(const char *name, int asn1_bool,
 						STACK_OF(CONF_VALUE) **extlist)
 {
-	if(asn1_bool) return X509V3_add_value(name, "TRUE", extlist);
-	return X509V3_add_value(name, "FALSE", extlist);
+	if(asn1_bool) return X509V3_add_value(name, _true, extlist);
+	return X509V3_add_value(name, _false, extlist);
 }
 
 int X509V3_add_value_bool_nf(char *name, int asn1_bool,
 						STACK_OF(CONF_VALUE) **extlist)
 {
-	if(asn1_bool) return X509V3_add_value(name, "TRUE", extlist);
+	if(asn1_bool) return X509V3_add_value(name, _true, extlist);
 	return 1;
 }
 
diff -Naur vendor/crypto/x509v3/x509v3.h rel_openssl_0.9.7c/crypto/x509v3/x509v3.h
--- vendor/crypto/x509v3/x509v3.h	2003-01-29 08:06:38.000000000 -0700
+++ rel_openssl_0.9.7c/crypto/x509v3/x509v3.h	2004-02-15 08:04:26.000000000 -0700
@@ -523,8 +523,9 @@
 void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent,
 								 int ml);
 int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, int indent);
+#ifndef OPENSSL_NO_FP_API
 int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent);
-
+#endif
 int X509V3_extensions_print(BIO *out, char *title, STACK_OF(X509_EXTENSION) *exts, unsigned long flag, int indent);
 
 int X509_check_purpose(X509 *x, int id, int ca);
diff -Naur vendor/ms/do_masm.bat rel_openssl_0.9.7c/ms/do_masm.bat
--- vendor/ms/do_masm.bat	2004-03-19 08:24:11.906250000 -0700
+++ rel_openssl_0.9.7c/ms/do_masm.bat	2004-03-19 08:53:24.125000000 -0700
@@ -61,6 +61,8 @@
 perl util\mk1mf.pl dll VC-W31-32 >ms\w31dll.mak
 perl util\mk1mf.pl VC-WIN32 >ms\nt.mak
 perl util\mk1mf.pl dll VC-WIN32 >ms\ntdll.mak
+perl util\mk1mf.pl debug VC-WIN32 >ms\ntdbg.mak
+perl util\mk1mf.pl dll debug VC-WIN32 >ms\ntdlldbg.mak
 
 perl util\mkdef.pl 16 libeay > ms\libeay16.def
 perl util\mkdef.pl 32 libeay > ms\libeay32.def
diff -Naur vendor/ssl/ssl_cert.c rel_openssl_0.9.7c/ssl/ssl_cert.c
--- vendor/ssl/ssl_cert.c	2003-02-05 09:37:15.000000000 -0700
+++ rel_openssl_0.9.7c/ssl/ssl_cert.c	2004-02-15 09:18:29.000000000 -0700
@@ -658,7 +658,6 @@
 	if (x != NULL) X509_free(x);
 	return(ret);
 	}
-#endif
 
 /*!
  * Add a file of certs to a stack.
@@ -718,6 +717,7 @@
 
 	return ret;
 	}
+#endif
 
 /*!
  * Add a directory of certs to a stack.
@@ -734,6 +734,7 @@
 #ifndef OPENSSL_SYS_VMS		/* XXXX This may be fixed in the future */
 #ifndef OPENSSL_SYS_MACINTOSH_CLASSIC /* XXXXX: Better scheme needed! */
 
+#ifndef OPENSSL_NO_STDIO
 int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
 				       const char *dir)
 	{
@@ -777,7 +778,7 @@
 	CRYPTO_w_unlock(CRYPTO_LOCK_READDIR);
 	return ret;
 	}
-
+#endif
 #endif
 #endif
 
diff -Naur vendor/tools/c89.sh rel_openssl_0.9.7c/tools/c89.sh
--- vendor/tools/c89.sh	2004-03-19 08:24:14.234375000 -0700
+++ rel_openssl_0.9.7c/tools/c89.sh	2004-03-19 08:53:25.265625000 -0700
@@ -2,14 +2,16 @@
 #
 # Re-order arguments so that -L comes first
 #
-opts=""
-lopts=""
-        
+opts=" "
+lopts=" "
+
 for arg in $* ; do
   case $arg in
-    -L*) lopts="$lopts $arg" ;;
-    *) opts="$opts $arg" ;;
+    -L*) lopts="$lopts$arg " ;;
+    -o*) opts="$opts -o ./" ;;
+    *) opts="$opts$arg " ;;
   esac
 done
 
-c89 $lopts $opts
+#echo c89 $lopts $opts
+c89 -I./ $lopts $opts
