Blame EDKII_openssl-1.0.2j-no-srp.patch

Tom Callaway da615e
diff --git a/Configure b/Configure
b17819
index c39f71a..98dd1d0 100755
Tom Callaway da615e
--- a/Configure
Tom Callaway da615e
+++ b/Configure
Tom Callaway da615e
@@ -609,6 +609,9 @@ my %table=(
Tom Callaway da615e
 # with itself, Applink is never engaged and can as well be omitted.
Tom Callaway da615e
 "mingw64", "gcc:-mno-cygwin -DL_ENDIAN -O3 -Wall -DWIN32_LEAN_AND_MEAN -DUNICODE -D_UNICODE::-D_MT:MINGW64:-lws2_32 -lgdi32 -lcrypt32:SIXTY_FOUR_BIT RC4_CHUNK_LL DES_INT EXPORT_VAR_AS_FN:${x86_64_asm}:mingw64:win32:cygwin-shared:-D_WINDLL:-mno-cygwin:.dll.a",
Tom Callaway da615e
 
Tom Callaway da615e
+# UEFI
Tom Callaway da615e
+"UEFI", "cc:-DL_ENDIAN -O:::UEFI::::",
Tom Callaway da615e
+
Tom Callaway da615e
 # UWIN 
Tom Callaway da615e
 "UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32",
Tom Callaway da615e
 
b17819
@@ -1083,7 +1086,7 @@ if (defined($disabled{"md5"}) || defined($disabled{"sha"})
Tom Callaway da615e
 	}
Tom Callaway da615e
 
Tom Callaway da615e
 if (defined($disabled{"ec"}) || defined($disabled{"dsa"})
Tom Callaway da615e
-    || defined($disabled{"dh"}))
Tom Callaway da615e
+    || defined($disabled{"dh"}) || defined($disabled{"stdio"}))
Tom Callaway da615e
 	{
Tom Callaway da615e
 	$disabled{"gost"} = "forced";
Tom Callaway da615e
 	}
Tom Callaway da615e
diff --git a/apps/apps.c b/apps/apps.c
b17819
index 9fdc3e0..6c183b0 100644
Tom Callaway da615e
--- a/apps/apps.c
Tom Callaway da615e
+++ b/apps/apps.c
b17819
@@ -2375,6 +2375,8 @@ int args_verify(char ***pargs, int *pargc,
Tom Callaway da615e
         flags |= X509_V_FLAG_PARTIAL_CHAIN;
Tom Callaway da615e
     else if (!strcmp(arg, "-no_alt_chains"))
Tom Callaway da615e
         flags |= X509_V_FLAG_NO_ALT_CHAINS;
Tom Callaway da615e
+    else if (!strcmp(arg, "-no_check_time"))
Tom Callaway da615e
+        flags |= X509_V_FLAG_NO_CHECK_TIME;
b17819
     else if (!strcmp(arg, "-allow_proxy_certs"))
b17819
         flags |= X509_V_FLAG_ALLOW_PROXY_CERTS;
Tom Callaway da615e
     else
Tom Callaway da615e
diff --git a/crypto/asn1/a_strex.c b/crypto/asn1/a_strex.c
b17819
index 2d562f9..91203b7 100644
Tom Callaway da615e
--- a/crypto/asn1/a_strex.c
Tom Callaway da615e
+++ b/crypto/asn1/a_strex.c
Tom Callaway da615e
@@ -104,6 +104,7 @@ static int send_bio_chars(void *arg, const void *buf, int len)
Tom Callaway da615e
     return 1;
Tom Callaway da615e
 }
Tom Callaway da615e
 
Tom Callaway da615e
+#ifndef OPENSSL_NO_FP_API
Tom Callaway da615e
 static int send_fp_chars(void *arg, const void *buf, int len)
Tom Callaway da615e
 {
Tom Callaway da615e
     if (!arg)
Tom Callaway da615e
@@ -112,6 +113,7 @@ static int send_fp_chars(void *arg, const void *buf, int len)
Tom Callaway da615e
         return 0;
Tom Callaway da615e
     return 1;
Tom Callaway da615e
 }
Tom Callaway da615e
+#endif
Tom Callaway da615e
 
Tom Callaway da615e
 typedef int char_io (void *arg, const void *buf, int len);
Tom Callaway da615e
 
Tom Callaway da615e
diff --git a/crypto/asn1/asn1_mac.h b/crypto/asn1/asn1_mac.h
Tom Callaway da615e
index abc6dc3..3a672e9 100644
Tom Callaway da615e
--- a/crypto/asn1/asn1_mac.h
Tom Callaway da615e
+++ b/crypto/asn1/asn1_mac.h
Tom Callaway da615e
@@ -70,7 +70,7 @@ extern "C" {
Tom Callaway da615e
 # endif
Tom Callaway da615e
 
Tom Callaway da615e
 # define ASN1_MAC_H_err(f,r,line) \
Tom Callaway da615e
-        ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),__FILE__,(line))
Tom Callaway da615e
+        ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),OPENSSL_FILE,(line))
Tom Callaway da615e
 
Tom Callaway da615e
 # define M_ASN1_D2I_vars(a,type,func) \
Tom Callaway da615e
         ASN1_const_CTX c; \
Tom Callaway da615e
@@ -81,7 +81,7 @@ extern "C" {
Tom Callaway da615e
         c.error=ERR_R_NESTED_ASN1_ERROR; \
Tom Callaway da615e
         if ((a == NULL) || ((*a) == NULL)) \
Tom Callaway da615e
                 { if ((ret=(type)func()) == NULL) \
Tom Callaway da615e
-                        { c.line=__LINE__; goto err; } } \
Tom Callaway da615e
+                        { c.line=OPENSSL_LINE; goto err; } } \
Tom Callaway da615e
         else    ret=(*a);
Tom Callaway da615e
 
Tom Callaway da615e
 # define M_ASN1_D2I_Init() \
Tom Callaway da615e
@@ -90,7 +90,7 @@ extern "C" {
Tom Callaway da615e
 
Tom Callaway da615e
 # define M_ASN1_D2I_Finish_2(a) \
Tom Callaway da615e
         if (!asn1_const_Finish(&c)) \
Tom Callaway da615e
-                { c.line=__LINE__; goto err; } \
Tom Callaway da615e
+                { c.line=OPENSSL_LINE; goto err; } \
Tom Callaway da615e
         *(const unsigned char **)pp=c.p; \
Tom Callaway da615e
         if (a != NULL) (*a)=ret; \
Tom Callaway da615e
         return(ret);
Tom Callaway da615e
@@ -105,7 +105,7 @@ err:\
Tom Callaway da615e
 
Tom Callaway da615e
 # define M_ASN1_D2I_start_sequence() \
Tom Callaway da615e
         if (!asn1_GetSequence(&c,&length)) \
Tom Callaway da615e
-                { c.line=__LINE__; goto err; }
Tom Callaway da615e
+                { c.line=OPENSSL_LINE; goto err; }
Tom Callaway da615e
 /* Begin reading ASN1 without a surrounding sequence */
Tom Callaway da615e
 # define M_ASN1_D2I_begin() \
Tom Callaway da615e
         c.slen = length;
Tom Callaway da615e
@@ -129,21 +129,21 @@ err:\
Tom Callaway da615e
 # define M_ASN1_D2I_get(b, func) \
Tom Callaway da615e
         c.q=c.p; \
Tom Callaway da615e
         if (func(&(b),&c.p,c.slen) == NULL) \
Tom Callaway da615e
-                {c.line=__LINE__; goto err; } \
Tom Callaway da615e
+                {c.line=OPENSSL_LINE; goto err; } \
Tom Callaway da615e
         c.slen-=(c.p-c.q);
Tom Callaway da615e
 
Tom Callaway da615e
 /* Don't use this with d2i_ASN1_BOOLEAN() */
Tom Callaway da615e
 # define M_ASN1_D2I_get_x(type,b,func) \
Tom Callaway da615e
         c.q=c.p; \
Tom Callaway da615e
         if (((D2I_OF(type))func)(&(b),&c.p,c.slen) == NULL) \
Tom Callaway da615e
-                {c.line=__LINE__; goto err; } \
Tom Callaway da615e
+                {c.line=OPENSSL_LINE; goto err; } \
Tom Callaway da615e
         c.slen-=(c.p-c.q);
Tom Callaway da615e
 
Tom Callaway da615e
 /* use this instead () */
Tom Callaway da615e
 # define M_ASN1_D2I_get_int(b,func) \
Tom Callaway da615e
         c.q=c.p; \
Tom Callaway da615e
         if (func(&(b),&c.p,c.slen) < 0) \
Tom Callaway da615e
-                {c.line=__LINE__; goto err; } \
Tom Callaway da615e
+                {c.line=OPENSSL_LINE; goto err; } \
Tom Callaway da615e
         c.slen-=(c.p-c.q);
Tom Callaway da615e
 
Tom Callaway da615e
 # define M_ASN1_D2I_get_opt(b,func,type) \
Tom Callaway da615e
@@ -164,7 +164,7 @@ err:\
Tom Callaway da615e
         M_ASN1_next=(_tmp& V_ASN1_CONSTRUCTED)|type; \
Tom Callaway da615e
         c.q=c.p; \
Tom Callaway da615e
         if (func(&(b),&c.p,c.slen) == NULL) \
Tom Callaway da615e
-                {c.line=__LINE__; M_ASN1_next_prev = _tmp; goto err; } \
Tom Callaway da615e
+                {c.line=OPENSSL_LINE; M_ASN1_next_prev = _tmp; goto err; } \
Tom Callaway da615e
         c.slen-=(c.p-c.q);\
Tom Callaway da615e
         M_ASN1_next_prev=_tmp;
Tom Callaway da615e
 
Tom Callaway da615e
@@ -258,20 +258,20 @@ err:\
Tom Callaway da615e
         c.q=c.p; \
Tom Callaway da615e
         if (d2i_ASN1_SET(&(r),&c.p,c.slen,(char *(*)())func,\
Tom Callaway da615e
                 (void (*)())free_func,a,b) == NULL) \
Tom Callaway da615e
-                { c.line=__LINE__; goto err; } \
Tom Callaway da615e
+                { c.line=OPENSSL_LINE; goto err; } \
Tom Callaway da615e
         c.slen-=(c.p-c.q);
Tom Callaway da615e
 
Tom Callaway da615e
 # define M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,a,b) \
Tom Callaway da615e
         c.q=c.p; \
Tom Callaway da615e
         if (d2i_ASN1_SET_OF_##type(&(r),&c.p,c.slen,func,\
Tom Callaway da615e
                                    free_func,a,b) == NULL) \
Tom Callaway da615e
-                { c.line=__LINE__; goto err; } \
Tom Callaway da615e
+                { c.line=OPENSSL_LINE; goto err; } \
Tom Callaway da615e
         c.slen-=(c.p-c.q);
Tom Callaway da615e
 
Tom Callaway da615e
 # define M_ASN1_D2I_get_set_strings(r,func,a,b) \
Tom Callaway da615e
         c.q=c.p; \
Tom Callaway da615e
         if (d2i_ASN1_STRING_SET(&(r),&c.p,c.slen,a,b) == NULL) \
Tom Callaway da615e
-                { c.line=__LINE__; goto err; } \
Tom Callaway da615e
+                { c.line=OPENSSL_LINE; goto err; } \
Tom Callaway da615e
         c.slen-=(c.p-c.q);
Tom Callaway da615e
 
Tom Callaway da615e
 # define M_ASN1_D2I_get_EXP_opt(r,func,tag) \
Tom Callaway da615e
@@ -285,16 +285,16 @@ err:\
Tom Callaway da615e
                 Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
Tom Callaway da615e
                 if (Tinf & 0x80) \
Tom Callaway da615e
                         { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
Tom Callaway da615e
-                        c.line=__LINE__; goto err; } \
Tom Callaway da615e
+                        c.line=OPENSSL_LINE; goto err; } \
Tom Callaway da615e
                 if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
Tom Callaway da615e
                                         Tlen = c.slen - (c.p - c.q) - 2; \
Tom Callaway da615e
                 if (func(&(r),&c.p,Tlen) == NULL) \
Tom Callaway da615e
-                        { c.line=__LINE__; goto err; } \
Tom Callaway da615e
+                        { c.line=OPENSSL_LINE; goto err; } \
Tom Callaway da615e
                 if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
Tom Callaway da615e
                         Tlen = c.slen - (c.p - c.q); \
Tom Callaway da615e
                         if(!ASN1_const_check_infinite_end(&c.p, Tlen)) \
Tom Callaway da615e
                                 { c.error=ERR_R_MISSING_ASN1_EOS; \
Tom Callaway da615e
-                                c.line=__LINE__; goto err; } \
Tom Callaway da615e
+                                c.line=OPENSSL_LINE; goto err; } \
Tom Callaway da615e
                 }\
Tom Callaway da615e
                 c.slen-=(c.p-c.q); \
Tom Callaway da615e
                 }
Tom Callaway da615e
@@ -310,18 +310,18 @@ err:\
Tom Callaway da615e
                 Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
Tom Callaway da615e
                 if (Tinf & 0x80) \
Tom Callaway da615e
                         { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
Tom Callaway da615e
-                        c.line=__LINE__; goto err; } \
Tom Callaway da615e
+                        c.line=OPENSSL_LINE; goto err; } \
Tom Callaway da615e
                 if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
Tom Callaway da615e
                                         Tlen = c.slen - (c.p - c.q) - 2; \
Tom Callaway da615e
                 if (d2i_ASN1_SET(&(r),&c.p,Tlen,(char *(*)())func, \
Tom Callaway da615e
                         (void (*)())free_func, \
Tom Callaway da615e
                         b,V_ASN1_UNIVERSAL) == NULL) \
Tom Callaway da615e
-                        { c.line=__LINE__; goto err; } \
Tom Callaway da615e
+                        { c.line=OPENSSL_LINE; goto err; } \
Tom Callaway da615e
                 if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
Tom Callaway da615e
                         Tlen = c.slen - (c.p - c.q); \
Tom Callaway da615e
                         if(!ASN1_check_infinite_end(&c.p, Tlen)) \
Tom Callaway da615e
                                 { c.error=ERR_R_MISSING_ASN1_EOS; \
Tom Callaway da615e
-                                c.line=__LINE__; goto err; } \
Tom Callaway da615e
+                                c.line=OPENSSL_LINE; goto err; } \
Tom Callaway da615e
                 }\
Tom Callaway da615e
                 c.slen-=(c.p-c.q); \
Tom Callaway da615e
                 }
Tom Callaway da615e
@@ -337,17 +337,17 @@ err:\
Tom Callaway da615e
                 Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
Tom Callaway da615e
                 if (Tinf & 0x80) \
Tom Callaway da615e
                         { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
Tom Callaway da615e
-                        c.line=__LINE__; goto err; } \
Tom Callaway da615e
+                        c.line=OPENSSL_LINE; goto err; } \
Tom Callaway da615e
                 if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
Tom Callaway da615e
                                         Tlen = c.slen - (c.p - c.q) - 2; \
Tom Callaway da615e
                 if (d2i_ASN1_SET_OF_##type(&(r),&c.p,Tlen,func, \
Tom Callaway da615e
                         free_func,b,V_ASN1_UNIVERSAL) == NULL) \
Tom Callaway da615e
-                        { c.line=__LINE__; goto err; } \
Tom Callaway da615e
+                        { c.line=OPENSSL_LINE; goto err; } \
Tom Callaway da615e
                 if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
Tom Callaway da615e
                         Tlen = c.slen - (c.p - c.q); \
Tom Callaway da615e
                         if(!ASN1_check_infinite_end(&c.p, Tlen)) \
Tom Callaway da615e
                                 { c.error=ERR_R_MISSING_ASN1_EOS; \
Tom Callaway da615e
-                                c.line=__LINE__; goto err; } \
Tom Callaway da615e
+                                c.line=OPENSSL_LINE; goto err; } \
Tom Callaway da615e
                 }\
Tom Callaway da615e
                 c.slen-=(c.p-c.q); \
Tom Callaway da615e
                 }
Tom Callaway da615e
@@ -355,7 +355,7 @@ err:\
Tom Callaway da615e
 /* New macros */
Tom Callaway da615e
 # define M_ASN1_New_Malloc(ret,type) \
Tom Callaway da615e
         if ((ret=(type *)OPENSSL_malloc(sizeof(type))) == NULL) \
Tom Callaway da615e
-                { c.line=__LINE__; goto err2; }
Tom Callaway da615e
+                { c.line=OPENSSL_LINE; goto err2; }
Tom Callaway da615e
 
Tom Callaway da615e
 # define M_ASN1_New(arg,func) \
Tom Callaway da615e
         if (((arg)=func()) == NULL) return(NULL)
Tom Callaway da615e
diff --git a/crypto/asn1/n_pkey.c b/crypto/asn1/n_pkey.c
Tom Callaway da615e
index d5a5514..bede55c 100644
Tom Callaway da615e
--- a/crypto/asn1/n_pkey.c
Tom Callaway da615e
+++ b/crypto/asn1/n_pkey.c
Tom Callaway da615e
@@ -193,7 +193,12 @@ int i2d_RSA_NET(const RSA *a, unsigned char **pp,
Tom Callaway da615e
     OPENSSL_cleanse(pkey->private_key->data, rsalen);
Tom Callaway da615e
 
Tom Callaway da615e
     if (cb == NULL)
Tom Callaway da615e
+#ifndef OPENSSL_NO_UI
Tom Callaway da615e
         cb = EVP_read_pw_string;
Tom Callaway da615e
+#else
Tom Callaway da615e
+        i = 1;
Tom Callaway da615e
+    else
Tom Callaway da615e
+#endif
Tom Callaway da615e
     i = cb((char *)buf, 256, "Enter Private Key password:", 1);
Tom Callaway da615e
     if (i != 0) {
Tom Callaway da615e
         ASN1err(ASN1_F_I2D_RSA_NET, ASN1_R_BAD_PASSWORD_READ);
Tom Callaway da615e
@@ -264,7 +269,11 @@ RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length,
Tom Callaway da615e
         goto err;
Tom Callaway da615e
     }
Tom Callaway da615e
     if (cb == NULL)
Tom Callaway da615e
+#ifndef OPENSSL_NO_UI
Tom Callaway da615e
         cb = EVP_read_pw_string;
Tom Callaway da615e
+#else
Tom Callaway da615e
+        goto err;
Tom Callaway da615e
+#endif
Tom Callaway da615e
     if ((ret = d2i_RSA_NET_2(a, enckey->enckey->digest, cb, sgckey)) == NULL)
Tom Callaway da615e
         goto err;
Tom Callaway da615e
 
Tom Callaway da615e
diff --git a/crypto/bn/bn_prime.c b/crypto/bn/bn_prime.c
b17819
index 1d25687..ad641c3 100644
Tom Callaway da615e
--- a/crypto/bn/bn_prime.c
Tom Callaway da615e
+++ b/crypto/bn/bn_prime.c
Tom Callaway da615e
@@ -131,7 +131,7 @@
Tom Callaway da615e
 static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1,
Tom Callaway da615e
                    const BIGNUM *a1_odd, int k, BN_CTX *ctx,
Tom Callaway da615e
                    BN_MONT_CTX *mont);
Tom Callaway da615e
-static int probable_prime(BIGNUM *rnd, int bits);
Tom Callaway da615e
+static int probable_prime(BIGNUM *rnd, int bits, prime_t *mods);
Tom Callaway da615e
 static int probable_prime_dh(BIGNUM *rnd, int bits,
Tom Callaway da615e
                              const BIGNUM *add, const BIGNUM *rem,
Tom Callaway da615e
                              BN_CTX *ctx);
Tom Callaway da615e
@@ -166,9 +166,13 @@ int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe,
Tom Callaway da615e
     BIGNUM *t;
Tom Callaway da615e
     int found = 0;
Tom Callaway da615e
     int i, j, c1 = 0;
Tom Callaway da615e
-    BN_CTX *ctx;
Tom Callaway da615e
+    BN_CTX *ctx = NULL;
Tom Callaway da615e
+    prime_t *mods = NULL;
Tom Callaway da615e
     int checks = BN_prime_checks_for_size(bits);
Tom Callaway da615e
 
Tom Callaway da615e
+    mods = OPENSSL_malloc(sizeof(*mods) * NUMPRIMES);
Tom Callaway da615e
+    if (mods == NULL)
b17819
+        goto err;
Tom Callaway da615e
     ctx = BN_CTX_new();
Tom Callaway da615e
     if (ctx == NULL)
Tom Callaway da615e
         goto err;
Tom Callaway da615e
@@ -179,7 +183,7 @@ int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe,
Tom Callaway da615e
  loop:
Tom Callaway da615e
     /* make a random number and set the top and bottom bits */
Tom Callaway da615e
     if (add == NULL) {
Tom Callaway da615e
-        if (!probable_prime(ret, bits))
Tom Callaway da615e
+        if (!probable_prime(ret, bits, mods))
Tom Callaway da615e
             goto err;
Tom Callaway da615e
     } else {
Tom Callaway da615e
         if (safe) {
Tom Callaway da615e
@@ -230,6 +234,7 @@ int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe,
Tom Callaway da615e
     /* we have a prime :-) */
Tom Callaway da615e
     found = 1;
Tom Callaway da615e
  err:
Tom Callaway da615e
+    OPENSSL_free(mods);
Tom Callaway da615e
     if (ctx != NULL) {
Tom Callaway da615e
         BN_CTX_end(ctx);
Tom Callaway da615e
         BN_CTX_free(ctx);
Tom Callaway da615e
@@ -375,10 +380,9 @@ static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1,
Tom Callaway da615e
     return 1;
Tom Callaway da615e
 }
Tom Callaway da615e
 
Tom Callaway da615e
-static int probable_prime(BIGNUM *rnd, int bits)
Tom Callaway da615e
+static int probable_prime(BIGNUM *rnd, int bits, prime_t *mods)
Tom Callaway da615e
 {
Tom Callaway da615e
     int i;
Tom Callaway da615e
-    prime_t mods[NUMPRIMES];
Tom Callaway da615e
     BN_ULONG delta, maxdelta;
Tom Callaway da615e
 
Tom Callaway da615e
  again:
Tom Callaway da615e
diff --git a/crypto/conf/conf.h b/crypto/conf/conf.h
b17819
index 8d926d5..c29e97d 100644
Tom Callaway da615e
--- a/crypto/conf/conf.h
Tom Callaway da615e
+++ b/crypto/conf/conf.h
Tom Callaway da615e
@@ -118,8 +118,10 @@ typedef void conf_finish_func (CONF_IMODULE *md);
Tom Callaway da615e
 
Tom Callaway da615e
 int CONF_set_default_method(CONF_METHOD *meth);
Tom Callaway da615e
 void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash);
Tom Callaway da615e
+# ifndef OPENSSL_NO_STDIO
Tom Callaway da615e
 LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file,
Tom Callaway da615e
                                 long *eline);
Tom Callaway da615e
+# endif
Tom Callaway da615e
 # ifndef OPENSSL_NO_FP_API
Tom Callaway da615e
 LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp,
Tom Callaway da615e
                                    long *eline);
Tom Callaway da615e
@@ -133,7 +135,9 @@ char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group,
Tom Callaway da615e
 long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group,
Tom Callaway da615e
                      const char *name);
Tom Callaway da615e
 void CONF_free(LHASH_OF(CONF_VALUE) *conf);
b17819
+# ifndef OPENSSL_NO_FP_API
Tom Callaway da615e
 int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out);
b17819
+# endif
Tom Callaway da615e
 int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out);
Tom Callaway da615e
 
Tom Callaway da615e
 void OPENSSL_config(const char *config_name);
Tom Callaway da615e
@@ -160,7 +164,9 @@ CONF_METHOD *NCONF_XML(void);
Tom Callaway da615e
 void NCONF_free(CONF *conf);
Tom Callaway da615e
 void NCONF_free_data(CONF *conf);
Tom Callaway da615e
 
Tom Callaway da615e
+# ifndef OPENSSL_NO_STDIO
Tom Callaway da615e
 int NCONF_load(CONF *conf, const char *file, long *eline);
Tom Callaway da615e
+# endif
Tom Callaway da615e
 # ifndef OPENSSL_NO_FP_API
Tom Callaway da615e
 int NCONF_load_fp(CONF *conf, FILE *fp, long *eline);
Tom Callaway da615e
 # endif
Tom Callaway da615e
@@ -170,7 +176,9 @@ STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,
Tom Callaway da615e
 char *NCONF_get_string(const CONF *conf, const char *group, const char *name);
Tom Callaway da615e
 int NCONF_get_number_e(const CONF *conf, const char *group, const char *name,
Tom Callaway da615e
                        long *result);
b17819
+# ifndef OPENSSL_NO_FP_API
Tom Callaway da615e
 int NCONF_dump_fp(const CONF *conf, FILE *out);
b17819
+# endif
Tom Callaway da615e
 int NCONF_dump_bio(const CONF *conf, BIO *out);
Tom Callaway da615e
 
Tom Callaway da615e
 # if 0                          /* The following function has no error
Tom Callaway da615e
@@ -184,8 +192,10 @@ long NCONF_get_number(CONF *conf, char *group, char *name);
Tom Callaway da615e
 
Tom Callaway da615e
 int CONF_modules_load(const CONF *cnf, const char *appname,
Tom Callaway da615e
                       unsigned long flags);
b17819
+# ifndef OPENSSL_NO_STDIO
Tom Callaway da615e
 int CONF_modules_load_file(const char *filename, const char *appname,
Tom Callaway da615e
                            unsigned long flags);
b17819
+# endif
Tom Callaway da615e
 void CONF_modules_unload(int all);
Tom Callaway da615e
 void CONF_modules_finish(void);
Tom Callaway da615e
 void CONF_modules_free(void);
Tom Callaway da615e
diff --git a/crypto/conf/conf_def.c b/crypto/conf/conf_def.c
Tom Callaway da615e
index 68c77ce..3d308c7 100644
Tom Callaway da615e
--- a/crypto/conf/conf_def.c
Tom Callaway da615e
+++ b/crypto/conf/conf_def.c
Tom Callaway da615e
@@ -182,6 +182,10 @@ static int def_destroy_data(CONF *conf)
Tom Callaway da615e
 
Tom Callaway da615e
 static int def_load(CONF *conf, const char *name, long *line)
Tom Callaway da615e
 {
Tom Callaway da615e
+#ifdef OPENSSL_NO_STDIO
Tom Callaway da615e
+    CONFerr(CONF_F_DEF_LOAD, ERR_R_SYS_LIB);
Tom Callaway da615e
+    return 0;
Tom Callaway da615e
+#else
Tom Callaway da615e
     int ret;
Tom Callaway da615e
     BIO *in = NULL;
Tom Callaway da615e
 
Tom Callaway da615e
@@ -202,6 +206,7 @@ static int def_load(CONF *conf, const char *name, long *line)
Tom Callaway da615e
     BIO_free(in);
Tom Callaway da615e
 
Tom Callaway da615e
     return ret;
Tom Callaway da615e
+#endif
Tom Callaway da615e
 }
Tom Callaway da615e
 
Tom Callaway da615e
 static int def_load_bio(CONF *conf, BIO *in, long *line)
Tom Callaway da615e
diff --git a/crypto/conf/conf_lib.c b/crypto/conf/conf_lib.c
Tom Callaway da615e
index 5281384..952b545 100644
Tom Callaway da615e
--- a/crypto/conf/conf_lib.c
Tom Callaway da615e
+++ b/crypto/conf/conf_lib.c
Tom Callaway da615e
@@ -90,6 +90,7 @@ int CONF_set_default_method(CONF_METHOD *meth)
Tom Callaway da615e
     return 1;
Tom Callaway da615e
 }
Tom Callaway da615e
 
Tom Callaway da615e
+#ifndef OPENSSL_NO_STDIO
Tom Callaway da615e
 LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file,
Tom Callaway da615e
                                 long *eline)
Tom Callaway da615e
 {
Tom Callaway da615e
@@ -111,6 +112,7 @@ LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file,
Tom Callaway da615e
 
Tom Callaway da615e
     return ltmp;
Tom Callaway da615e
 }
Tom Callaway da615e
+#endif
Tom Callaway da615e
 
Tom Callaway da615e
 #ifndef OPENSSL_NO_FP_API
Tom Callaway da615e
 LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp,
Tom Callaway da615e
@@ -255,6 +257,7 @@ void NCONF_free_data(CONF *conf)
Tom Callaway da615e
     conf->meth->destroy_data(conf);
Tom Callaway da615e
 }
Tom Callaway da615e
 
Tom Callaway da615e
+#ifndef OPENSSL_NO_STDIO
Tom Callaway da615e
 int NCONF_load(CONF *conf, const char *file, long *eline)
Tom Callaway da615e
 {
Tom Callaway da615e
     if (conf == NULL) {
Tom Callaway da615e
@@ -264,6 +267,7 @@ int NCONF_load(CONF *conf, const char *file, long *eline)
Tom Callaway da615e
 
Tom Callaway da615e
     return conf->meth->load(conf, file, eline);
Tom Callaway da615e
 }
Tom Callaway da615e
+#endif
Tom Callaway da615e
 
Tom Callaway da615e
 #ifndef OPENSSL_NO_FP_API
Tom Callaway da615e
 int NCONF_load_fp(CONF *conf, FILE *fp, long *eline)
Tom Callaway da615e
diff --git a/crypto/conf/conf_mod.c b/crypto/conf/conf_mod.c
b17819
index e0c9a67..13d93ea 100644
Tom Callaway da615e
--- a/crypto/conf/conf_mod.c
Tom Callaway da615e
+++ b/crypto/conf/conf_mod.c
Tom Callaway da615e
@@ -159,6 +159,7 @@ int CONF_modules_load(const CONF *cnf, const char *appname,
Tom Callaway da615e
 
Tom Callaway da615e
 }
Tom Callaway da615e
 
Tom Callaway da615e
+#ifndef OPENSSL_NO_STDIO
Tom Callaway da615e
 int CONF_modules_load_file(const char *filename, const char *appname,
Tom Callaway da615e
                            unsigned long flags)
Tom Callaway da615e
 {
Tom Callaway da615e
@@ -194,6 +195,7 @@ int CONF_modules_load_file(const char *filename, const char *appname,
Tom Callaway da615e
 
Tom Callaway da615e
     return ret;
Tom Callaway da615e
 }
Tom Callaway da615e
+#endif
Tom Callaway da615e
 
Tom Callaway da615e
 static int module_run(const CONF *cnf, char *name, char *value,
Tom Callaway da615e
                       unsigned long flags)
Tom Callaway da615e
diff --git a/crypto/conf/conf_sap.c b/crypto/conf/conf_sap.c
Tom Callaway da615e
index c042cf2..a25b636 100644
Tom Callaway da615e
--- a/crypto/conf/conf_sap.c
Tom Callaway da615e
+++ b/crypto/conf/conf_sap.c
Tom Callaway da615e
@@ -87,9 +87,11 @@ void OPENSSL_config(const char *config_name)
Tom Callaway da615e
     ENGINE_load_builtin_engines();
Tom Callaway da615e
 #endif
Tom Callaway da615e
     ERR_clear_error();
Tom Callaway da615e
+#ifndef OPENSSL_NO_STDIO
Tom Callaway da615e
     CONF_modules_load_file(NULL, config_name,
Tom Callaway da615e
                                CONF_MFLAGS_DEFAULT_SECTION |
Tom Callaway da615e
                                CONF_MFLAGS_IGNORE_MISSING_FILE);
Tom Callaway da615e
+#endif
Tom Callaway da615e
     openssl_configured = 1;
Tom Callaway da615e
 }
Tom Callaway da615e
 
Tom Callaway da615e
diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c
Tom Callaway da615e
index 1925428..da4b34d 100644
Tom Callaway da615e
--- a/crypto/cryptlib.c
Tom Callaway da615e
+++ b/crypto/cryptlib.c
Tom Callaway da615e
@@ -263,7 +263,7 @@ int CRYPTO_get_new_dynlockid(void)
Tom Callaway da615e
         return (0);
Tom Callaway da615e
     }
Tom Callaway da615e
     pointer->references = 1;
Tom Callaway da615e
-    pointer->data = dynlock_create_callback(__FILE__, __LINE__);
Tom Callaway da615e
+    pointer->data = dynlock_create_callback(OPENSSL_FILE, OPENSSL_LINE);
Tom Callaway da615e
     if (pointer->data == NULL) {
Tom Callaway da615e
         OPENSSL_free(pointer);
Tom Callaway da615e
         CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID, ERR_R_MALLOC_FAILURE);
Tom Callaway da615e
@@ -289,7 +289,7 @@ int CRYPTO_get_new_dynlockid(void)
Tom Callaway da615e
     CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
Tom Callaway da615e
 
Tom Callaway da615e
     if (i == -1) {
Tom Callaway da615e
-        dynlock_destroy_callback(pointer->data, __FILE__, __LINE__);
Tom Callaway da615e
+        dynlock_destroy_callback(pointer->data, OPENSSL_FILE, OPENSSL_LINE);
Tom Callaway da615e
         OPENSSL_free(pointer);
Tom Callaway da615e
     } else
Tom Callaway da615e
         i += 1;                 /* to avoid 0 */
Tom Callaway da615e
@@ -328,7 +328,7 @@ void CRYPTO_destroy_dynlockid(int i)
Tom Callaway da615e
     CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
Tom Callaway da615e
 
Tom Callaway da615e
     if (pointer) {
Tom Callaway da615e
-        dynlock_destroy_callback(pointer->data, __FILE__, __LINE__);
Tom Callaway da615e
+        dynlock_destroy_callback(pointer->data, OPENSSL_FILE, OPENSSL_LINE);
Tom Callaway da615e
         OPENSSL_free(pointer);
Tom Callaway da615e
     }
Tom Callaway da615e
 }
Tom Callaway da615e
@@ -670,6 +670,7 @@ unsigned long *OPENSSL_ia32cap_loc(void)
Tom Callaway da615e
 }
Tom Callaway da615e
 
Tom Callaway da615e
 # if defined(OPENSSL_CPUID_OBJ) && !defined(OPENSSL_NO_ASM) && !defined(I386_ONLY)
Tom Callaway da615e
+#include <stdio.h>
Tom Callaway da615e
 #  define OPENSSL_CPUID_SETUP
Tom Callaway da615e
 #  if defined(_WIN32)
Tom Callaway da615e
 typedef unsigned __int64 IA32CAP;
Tom Callaway da615e
@@ -980,11 +981,13 @@ void OPENSSL_showfatal(const char *fmta, ...)
Tom Callaway da615e
 #else
Tom Callaway da615e
 void OPENSSL_showfatal(const char *fmta, ...)
Tom Callaway da615e
 {
Tom Callaway da615e
+#ifndef OPENSSL_NO_STDIO
Tom Callaway da615e
     va_list ap;
Tom Callaway da615e
 
Tom Callaway da615e
     va_start(ap, fmta);
Tom Callaway da615e
     vfprintf(stderr, fmta, ap);
Tom Callaway da615e
     va_end(ap);
Tom Callaway da615e
+#endif
Tom Callaway da615e
 }
Tom Callaway da615e
 
Tom Callaway da615e
 int OPENSSL_isservice(void)
Tom Callaway da615e
@@ -1011,10 +1014,12 @@ void OpenSSLDie(const char *file, int line, const char *assertion)
Tom Callaway da615e
 #endif
Tom Callaway da615e
 }
Tom Callaway da615e
 
Tom Callaway da615e
+#ifndef OPENSSL_NO_STDIO
Tom Callaway da615e
 void *OPENSSL_stderr(void)
Tom Callaway da615e
 {
Tom Callaway da615e
     return stderr;
Tom Callaway da615e
 }
Tom Callaway da615e
+#endif
Tom Callaway da615e
 
Tom Callaway da615e
 int CRYPTO_memcmp(const volatile void *in_a, const volatile void *in_b, size_t len)
Tom Callaway da615e
 {
Tom Callaway da615e
diff --git a/crypto/cryptlib.h b/crypto/cryptlib.h
Tom Callaway da615e
index fba180a..3e3ea5e 100644
Tom Callaway da615e
--- a/crypto/cryptlib.h
Tom Callaway da615e
+++ b/crypto/cryptlib.h
Tom Callaway da615e
@@ -101,7 +101,9 @@ extern "C" {
Tom Callaway da615e
 void OPENSSL_cpuid_setup(void);
Tom Callaway da615e
 extern unsigned int OPENSSL_ia32cap_P[];
Tom Callaway da615e
 void OPENSSL_showfatal(const char *fmta, ...);
Tom Callaway da615e
+#ifndef OPENSSL_NO_STDIO
Tom Callaway da615e
 void *OPENSSL_stderr(void);
Tom Callaway da615e
+#endif
Tom Callaway da615e
 extern int OPENSSL_NONPIC_relocated;
Tom Callaway da615e
 
Tom Callaway da615e
 #ifdef  __cplusplus
Tom Callaway da615e
diff --git a/crypto/crypto.h b/crypto/crypto.h
Tom Callaway da615e
index 6c644ce..bea4ca1 100644
Tom Callaway da615e
--- a/crypto/crypto.h
Tom Callaway da615e
+++ b/crypto/crypto.h
Tom Callaway da615e
@@ -235,15 +235,15 @@ typedef struct openssl_item_st {
Tom Callaway da615e
 # ifndef OPENSSL_NO_LOCKING
Tom Callaway da615e
 #  ifndef CRYPTO_w_lock
Tom Callaway da615e
 #   define CRYPTO_w_lock(type)     \
Tom Callaway da615e
-        CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
Tom Callaway da615e
+        CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 #   define CRYPTO_w_unlock(type)   \
Tom Callaway da615e
-        CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
Tom Callaway da615e
+        CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 #   define CRYPTO_r_lock(type)     \
Tom Callaway da615e
-        CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__)
Tom Callaway da615e
+        CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 #   define CRYPTO_r_unlock(type)   \
Tom Callaway da615e
-        CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__)
Tom Callaway da615e
+        CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 #   define CRYPTO_add(addr,amount,type)    \
Tom Callaway da615e
-        CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__)
Tom Callaway da615e
+        CRYPTO_add_lock(addr,amount,type,OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 #  endif
Tom Callaway da615e
 # else
Tom Callaway da615e
 #  define CRYPTO_w_lock(a)
Tom Callaway da615e
@@ -378,19 +378,19 @@ int CRYPTO_is_mem_check_on(void);
Tom Callaway da615e
 # define MemCheck_off()  CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE)
Tom Callaway da615e
 # define is_MemCheck_on() CRYPTO_is_mem_check_on()
Tom Callaway da615e
 
Tom Callaway da615e
-# define OPENSSL_malloc(num)     CRYPTO_malloc((int)num,__FILE__,__LINE__)
Tom Callaway da615e
-# define OPENSSL_strdup(str)     CRYPTO_strdup((str),__FILE__,__LINE__)
Tom Callaway da615e
+# define OPENSSL_malloc(num)     CRYPTO_malloc((int)num,OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define OPENSSL_strdup(str)     CRYPTO_strdup((str),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 # define OPENSSL_realloc(addr,num) \
Tom Callaway da615e
-        CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__)
Tom Callaway da615e
+        CRYPTO_realloc((char *)addr,(int)num,OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 # define OPENSSL_realloc_clean(addr,old_num,num) \
Tom Callaway da615e
-        CRYPTO_realloc_clean(addr,old_num,num,__FILE__,__LINE__)
Tom Callaway da615e
+        CRYPTO_realloc_clean(addr,old_num,num,OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 # define OPENSSL_remalloc(addr,num) \
Tom Callaway da615e
-        CRYPTO_remalloc((char **)addr,(int)num,__FILE__,__LINE__)
Tom Callaway da615e
+        CRYPTO_remalloc((char **)addr,(int)num,OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 # define OPENSSL_freeFunc        CRYPTO_free
Tom Callaway da615e
 # define OPENSSL_free(addr)      CRYPTO_free(addr)
Tom Callaway da615e
 
Tom Callaway da615e
 # define OPENSSL_malloc_locked(num) \
Tom Callaway da615e
-        CRYPTO_malloc_locked((int)num,__FILE__,__LINE__)
Tom Callaway da615e
+        CRYPTO_malloc_locked((int)num,OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 # define OPENSSL_free_locked(addr) CRYPTO_free_locked(addr)
Tom Callaway da615e
 
Tom Callaway da615e
 const char *SSLeay_version(int type);
Tom Callaway da615e
@@ -545,7 +545,7 @@ void CRYPTO_set_mem_debug_options(long bits);
Tom Callaway da615e
 long CRYPTO_get_mem_debug_options(void);
Tom Callaway da615e
 
Tom Callaway da615e
 # define CRYPTO_push_info(info) \
Tom Callaway da615e
-        CRYPTO_push_info_(info, __FILE__, __LINE__);
Tom Callaway da615e
+        CRYPTO_push_info_(info, OPENSSL_FILE, OPENSSL_LINE);
Tom Callaway da615e
 int CRYPTO_push_info_(const char *info, const char *file, int line);
Tom Callaway da615e
 int CRYPTO_pop_info(void);
Tom Callaway da615e
 int CRYPTO_remove_all_info(void);
Tom Callaway da615e
@@ -588,7 +588,7 @@ void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb);
Tom Callaway da615e
 
Tom Callaway da615e
 /* die if we have to */
Tom Callaway da615e
 void OpenSSLDie(const char *file, int line, const char *assertion);
Tom Callaway da615e
-# define OPENSSL_assert(e)       (void)((e) ? 0 : (OpenSSLDie(__FILE__, __LINE__, #e),1))
Tom Callaway da615e
+# define OPENSSL_assert(e)       (void)((e) ? 0 : (OpenSSLDie(OPENSSL_FILE, OPENSSL_LINE, #e),1))
Tom Callaway da615e
 
Tom Callaway da615e
 unsigned long *OPENSSL_ia32cap_loc(void);
Tom Callaway da615e
 # define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc()))
Tom Callaway da615e
@@ -605,14 +605,14 @@ void OPENSSL_init(void);
Tom Callaway da615e
 #  define fips_md_init_ctx(alg, cx) \
Tom Callaway da615e
         int alg##_Init(cx##_CTX *c) \
Tom Callaway da615e
         { \
Tom Callaway da615e
-        if (FIPS_mode()) OpenSSLDie(__FILE__, __LINE__, \
Tom Callaway da615e
+        if (FIPS_mode()) OpenSSLDie(OPENSSL_FILE, OPENSSL_LINE, \
Tom Callaway da615e
                 "Low level API call to digest " #alg " forbidden in FIPS mode!"); \
Tom Callaway da615e
         return private_##alg##_Init(c); \
Tom Callaway da615e
         } \
Tom Callaway da615e
         int private_##alg##_Init(cx##_CTX *c)
Tom Callaway da615e
 
Tom Callaway da615e
 #  define fips_cipher_abort(alg) \
Tom Callaway da615e
-        if (FIPS_mode()) OpenSSLDie(__FILE__, __LINE__, \
Tom Callaway da615e
+        if (FIPS_mode()) OpenSSLDie(OPENSSL_FILE, OPENSSL_LINE, \
Tom Callaway da615e
                 "Low level API call to cipher " #alg " forbidden in FIPS mode!")
Tom Callaway da615e
 
Tom Callaway da615e
 # else
Tom Callaway da615e
diff --git a/crypto/des/read2pwd.c b/crypto/des/read2pwd.c
Tom Callaway da615e
index 01e275f..7633139 100644
Tom Callaway da615e
--- a/crypto/des/read2pwd.c
Tom Callaway da615e
+++ b/crypto/des/read2pwd.c
Tom Callaway da615e
@@ -114,6 +114,10 @@
Tom Callaway da615e
 #include <openssl/ui.h>
Tom Callaway da615e
 #include <openssl/crypto.h>
Tom Callaway da615e
 
Tom Callaway da615e
+#ifndef BUFSIZ
Tom Callaway da615e
+#define BUFSIZ 256
Tom Callaway da615e
+#endif
Tom Callaway da615e
+
Tom Callaway da615e
 int DES_read_password(DES_cblock *key, const char *prompt, int verify)
Tom Callaway da615e
 {
Tom Callaway da615e
     int ok;
Tom Callaway da615e
diff --git a/crypto/dh/Makefile b/crypto/dh/Makefile
Tom Callaway da615e
index 46fa5ac..cc366ec 100644
Tom Callaway da615e
--- a/crypto/dh/Makefile
Tom Callaway da615e
+++ b/crypto/dh/Makefile
Tom Callaway da615e
@@ -134,7 +134,7 @@ dh_gen.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
Tom Callaway da615e
 dh_gen.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
Tom Callaway da615e
 dh_gen.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
Tom Callaway da615e
 dh_gen.o: ../cryptlib.h dh_gen.c
Tom Callaway da615e
-dh_kdf.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
Tom Callaway da615e
+dh_kdf.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
Tom Callaway da615e
 dh_kdf.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
Tom Callaway da615e
 dh_kdf.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
Tom Callaway da615e
 dh_kdf.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
Tom Callaway da615e
diff --git a/crypto/dh/dh.h b/crypto/dh/dh.h
Tom Callaway da615e
index a5bd901..6488879 100644
Tom Callaway da615e
--- a/crypto/dh/dh.h
Tom Callaway da615e
+++ b/crypto/dh/dh.h
Tom Callaway da615e
@@ -240,11 +240,13 @@ DH *DH_get_1024_160(void);
Tom Callaway da615e
 DH *DH_get_2048_224(void);
Tom Callaway da615e
 DH *DH_get_2048_256(void);
Tom Callaway da615e
 
Tom Callaway da615e
+# ifndef OPENSSL_NO_CMS
Tom Callaway da615e
 /* RFC2631 KDF */
Tom Callaway da615e
 int DH_KDF_X9_42(unsigned char *out, size_t outlen,
Tom Callaway da615e
                  const unsigned char *Z, size_t Zlen,
Tom Callaway da615e
                  ASN1_OBJECT *key_oid,
Tom Callaway da615e
                  const unsigned char *ukm, size_t ukmlen, const EVP_MD *md);
Tom Callaway da615e
+# endif
Tom Callaway da615e
 
Tom Callaway da615e
 # define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \
Tom Callaway da615e
         EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \
Tom Callaway da615e
@@ -337,7 +339,9 @@ int DH_KDF_X9_42(unsigned char *out, size_t outlen,
Tom Callaway da615e
 
Tom Callaway da615e
 /* KDF types */
Tom Callaway da615e
 # define EVP_PKEY_DH_KDF_NONE                            1
Tom Callaway da615e
+# ifndef OPENSSL_NO_CMS
Tom Callaway da615e
 # define EVP_PKEY_DH_KDF_X9_42                           2
Tom Callaway da615e
+# endif
Tom Callaway da615e
 
Tom Callaway da615e
 /* BEGIN ERROR CODES */
Tom Callaway da615e
 /*
Tom Callaway da615e
diff --git a/crypto/dh/dh_kdf.c b/crypto/dh/dh_kdf.c
b17819
index a882cb2..aace5fb 100644
Tom Callaway da615e
--- a/crypto/dh/dh_kdf.c
Tom Callaway da615e
+++ b/crypto/dh/dh_kdf.c
b17819
@@ -51,6 +51,9 @@
Tom Callaway da615e
  * ====================================================================
Tom Callaway da615e
  */
Tom Callaway da615e
 
Tom Callaway da615e
+#include <e_os.h>
Tom Callaway da615e
+
Tom Callaway da615e
+#ifndef OPENSSL_NO_CMS
Tom Callaway da615e
 #include <string.h>
Tom Callaway da615e
 #include <openssl/dh.h>
Tom Callaway da615e
 #include <openssl/evp.h>
b17819
@@ -58,6 +61,7 @@
Tom Callaway da615e
 #include <openssl/cms.h>
Tom Callaway da615e
 
Tom Callaway da615e
 /* Key derivation from X9.42/RFC2631 */
Tom Callaway da615e
+/* Uses CMS functions, hence the #ifdef wrapper. */
Tom Callaway da615e
 
Tom Callaway da615e
 #define DH_KDF_MAX      (1L << 30)
Tom Callaway da615e
 
b17819
@@ -185,3 +189,4 @@ int DH_KDF_X9_42(unsigned char *out, size_t outlen,
Tom Callaway da615e
     EVP_MD_CTX_cleanup(&mctx);
Tom Callaway da615e
     return rv;
Tom Callaway da615e
 }
Tom Callaway da615e
+#endif
Tom Callaway da615e
diff --git a/crypto/dh/dh_pmeth.c b/crypto/dh/dh_pmeth.c
b17819
index b58e3fa..926be98 100644
Tom Callaway da615e
--- a/crypto/dh/dh_pmeth.c
Tom Callaway da615e
+++ b/crypto/dh/dh_pmeth.c
Tom Callaway da615e
@@ -207,7 +207,11 @@ static int pkey_dh_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
Tom Callaway da615e
     case EVP_PKEY_CTRL_DH_KDF_TYPE:
Tom Callaway da615e
         if (p1 == -2)
Tom Callaway da615e
             return dctx->kdf_type;
Tom Callaway da615e
+#ifdef OPENSSL_NO_CMS
Tom Callaway da615e
+        if (p1 != EVP_PKEY_DH_KDF_NONE)
Tom Callaway da615e
+#else
Tom Callaway da615e
         if (p1 != EVP_PKEY_DH_KDF_NONE && p1 != EVP_PKEY_DH_KDF_X9_42)
Tom Callaway da615e
+#endif
Tom Callaway da615e
             return -2;
Tom Callaway da615e
         dctx->kdf_type = p1;
Tom Callaway da615e
         return 1;
b17819
@@ -448,7 +452,9 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned char *key,
Tom Callaway da615e
             return ret;
Tom Callaway da615e
         *keylen = ret;
Tom Callaway da615e
         return 1;
Tom Callaway da615e
-    } else if (dctx->kdf_type == EVP_PKEY_DH_KDF_X9_42) {
Tom Callaway da615e
+    }
Tom Callaway da615e
+#ifndef OPENSSL_NO_CMS
Tom Callaway da615e
+    else if (dctx->kdf_type == EVP_PKEY_DH_KDF_X9_42) {
Tom Callaway da615e
         unsigned char *Z = NULL;
Tom Callaway da615e
         size_t Zlen = 0;
Tom Callaway da615e
         if (!dctx->kdf_outlen || !dctx->kdf_oid)
b17819
@@ -479,7 +485,8 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned char *key,
Tom Callaway da615e
         }
Tom Callaway da615e
         return ret;
Tom Callaway da615e
     }
Tom Callaway da615e
-    return 1;
Tom Callaway da615e
+#endif
Tom Callaway da615e
+    return 0;
Tom Callaway da615e
 }
Tom Callaway da615e
 
Tom Callaway da615e
 const EVP_PKEY_METHOD dh_pkey_meth = {
Tom Callaway da615e
diff --git a/crypto/engine/eng_int.h b/crypto/engine/eng_int.h
Tom Callaway da615e
index 46f163b..b4a72a0 100644
Tom Callaway da615e
--- a/crypto/engine/eng_int.h
Tom Callaway da615e
+++ b/crypto/engine/eng_int.h
Tom Callaway da615e
@@ -88,7 +88,7 @@ extern "C" {
Tom Callaway da615e
                 (unsigned int)(e), (isfunct ? "funct" : "struct"), \
Tom Callaway da615e
                 ((isfunct) ? ((e)->funct_ref - (diff)) : ((e)->struct_ref - (diff))), \
Tom Callaway da615e
                 ((isfunct) ? (e)->funct_ref : (e)->struct_ref), \
Tom Callaway da615e
-                (__FILE__), (__LINE__));
Tom Callaway da615e
+                (OPENSSL_FILE), (OPENSSL_LINE));
Tom Callaway da615e
 
Tom Callaway da615e
 # else
Tom Callaway da615e
 
Tom Callaway da615e
@@ -136,7 +136,7 @@ ENGINE *engine_table_select(ENGINE_TABLE **table, int nid);
Tom Callaway da615e
 # else
Tom Callaway da615e
 ENGINE *engine_table_select_tmp(ENGINE_TABLE **table, int nid, const char *f,
Tom Callaway da615e
                                 int l);
Tom Callaway da615e
-#  define engine_table_select(t,n) engine_table_select_tmp(t,n,__FILE__,__LINE__)
Tom Callaway da615e
+#  define engine_table_select(t,n) engine_table_select_tmp(t,n,OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 # endif
Tom Callaway da615e
 typedef void (engine_table_doall_cb) (int nid, STACK_OF(ENGINE) *sk,
Tom Callaway da615e
                                       ENGINE *def, void *arg);
Tom Callaway da615e
diff --git a/crypto/engine/eng_openssl.c b/crypto/engine/eng_openssl.c
Tom Callaway da615e
index 34b0029..cf622bb 100644
Tom Callaway da615e
--- a/crypto/engine/eng_openssl.c
Tom Callaway da615e
+++ b/crypto/engine/eng_openssl.c
Tom Callaway da615e
@@ -86,7 +86,9 @@
Tom Callaway da615e
  * this is no longer automatic in ENGINE_load_builtin_engines().
Tom Callaway da615e
  */
Tom Callaway da615e
 #define TEST_ENG_OPENSSL_RC4
Tom Callaway da615e
+#ifndef OPENSSL_NO_FP_API
Tom Callaway da615e
 #define TEST_ENG_OPENSSL_PKEY
Tom Callaway da615e
+#endif
Tom Callaway da615e
 /* #define TEST_ENG_OPENSSL_RC4_OTHERS */
Tom Callaway da615e
 #define TEST_ENG_OPENSSL_RC4_P_INIT
Tom Callaway da615e
 /* #define TEST_ENG_OPENSSL_RC4_P_CIPHER */
Tom Callaway da615e
diff --git a/crypto/err/err.h b/crypto/err/err.h
Tom Callaway da615e
index 585aa8b..04c6cfc 100644
Tom Callaway da615e
--- a/crypto/err/err.h
Tom Callaway da615e
+++ b/crypto/err/err.h
Tom Callaway da615e
@@ -200,39 +200,39 @@ typedef struct err_state_st {
Tom Callaway da615e
 
Tom Callaway da615e
 # define ERR_LIB_USER            128
Tom Callaway da615e
 
Tom Callaway da615e
-# define SYSerr(f,r)  ERR_PUT_error(ERR_LIB_SYS,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define BNerr(f,r)   ERR_PUT_error(ERR_LIB_BN,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define RSAerr(f,r)  ERR_PUT_error(ERR_LIB_RSA,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define DHerr(f,r)   ERR_PUT_error(ERR_LIB_DH,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define EVPerr(f,r)  ERR_PUT_error(ERR_LIB_EVP,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define BUFerr(f,r)  ERR_PUT_error(ERR_LIB_BUF,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define OBJerr(f,r)  ERR_PUT_error(ERR_LIB_OBJ,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define PEMerr(f,r)  ERR_PUT_error(ERR_LIB_PEM,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define DSAerr(f,r)  ERR_PUT_error(ERR_LIB_DSA,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define ECerr(f,r)   ERR_PUT_error(ERR_LIB_EC,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define SSLerr(f,r)  ERR_PUT_error(ERR_LIB_SSL,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define BIOerr(f,r)  ERR_PUT_error(ERR_LIB_BIO,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define ECDSAerr(f,r)  ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define ECDHerr(f,r)  ERR_PUT_error(ERR_LIB_ECDH,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
-# define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),__FILE__,__LINE__)
Tom Callaway da615e
+# define SYSerr(f,r)  ERR_PUT_error(ERR_LIB_SYS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define BNerr(f,r)   ERR_PUT_error(ERR_LIB_BN,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define RSAerr(f,r)  ERR_PUT_error(ERR_LIB_RSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define DHerr(f,r)   ERR_PUT_error(ERR_LIB_DH,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define EVPerr(f,r)  ERR_PUT_error(ERR_LIB_EVP,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define BUFerr(f,r)  ERR_PUT_error(ERR_LIB_BUF,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define OBJerr(f,r)  ERR_PUT_error(ERR_LIB_OBJ,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define PEMerr(f,r)  ERR_PUT_error(ERR_LIB_PEM,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define DSAerr(f,r)  ERR_PUT_error(ERR_LIB_DSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define ECerr(f,r)   ERR_PUT_error(ERR_LIB_EC,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define SSLerr(f,r)  ERR_PUT_error(ERR_LIB_SSL,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define BIOerr(f,r)  ERR_PUT_error(ERR_LIB_BIO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define ECDSAerr(f,r)  ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define ECDHerr(f,r)  ERR_PUT_error(ERR_LIB_ECDH,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
+# define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 
Tom Callaway da615e
 /*
Tom Callaway da615e
  * Borland C seems too stupid to be able to shift and do longs in the
Tom Callaway da615e
diff --git a/crypto/evp/evp.h b/crypto/evp/evp.h
Tom Callaway da615e
index 39ab793..ad1e350 100644
Tom Callaway da615e
--- a/crypto/evp/evp.h
Tom Callaway da615e
+++ b/crypto/evp/evp.h
Tom Callaway da615e
@@ -602,11 +602,13 @@ int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in);
Tom Callaway da615e
 int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type);
Tom Callaway da615e
 int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s);
Tom Callaway da615e
 
Tom Callaway da615e
+#ifndef OPENSSL_NO_UI
Tom Callaway da615e
 int EVP_read_pw_string(char *buf, int length, const char *prompt, int verify);
Tom Callaway da615e
 int EVP_read_pw_string_min(char *buf, int minlen, int maxlen,
Tom Callaway da615e
                            const char *prompt, int verify);
Tom Callaway da615e
 void EVP_set_pw_prompt(const char *prompt);
Tom Callaway da615e
 char *EVP_get_pw_prompt(void);
Tom Callaway da615e
+#endif
Tom Callaway da615e
 
Tom Callaway da615e
 int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md,
Tom Callaway da615e
                    const unsigned char *salt, const unsigned char *data,
Tom Callaway da615e
diff --git a/crypto/evp/evp_key.c b/crypto/evp/evp_key.c
Tom Callaway da615e
index 5be9e33..63c8866 100644
Tom Callaway da615e
--- a/crypto/evp/evp_key.c
Tom Callaway da615e
+++ b/crypto/evp/evp_key.c
Tom Callaway da615e
@@ -63,6 +63,7 @@
Tom Callaway da615e
 #include <openssl/evp.h>
Tom Callaway da615e
 #include <openssl/ui.h>
Tom Callaway da615e
 
Tom Callaway da615e
+#ifndef OPENSSL_NO_UI
Tom Callaway da615e
 /* should be init to zeros. */
Tom Callaway da615e
 static char prompt_string[80];
Tom Callaway da615e
 
Tom Callaway da615e
@@ -117,6 +118,7 @@ int EVP_read_pw_string_min(char *buf, int min, int len, const char *prompt,
Tom Callaway da615e
     OPENSSL_cleanse(buff, BUFSIZ);
Tom Callaway da615e
     return ret;
Tom Callaway da615e
 }
Tom Callaway da615e
+#endif /* OPENSSL_NO_UI */
Tom Callaway da615e
 
Tom Callaway da615e
 int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md,
Tom Callaway da615e
                    const unsigned char *salt, const unsigned char *data,
Tom Callaway da615e
diff --git a/crypto/opensslconf.h.in b/crypto/opensslconf.h.in
Tom Callaway da615e
index 7a1c85d..7162c0f 100644
Tom Callaway da615e
--- a/crypto/opensslconf.h.in
Tom Callaway da615e
+++ b/crypto/opensslconf.h.in
Tom Callaway da615e
@@ -1,5 +1,15 @@
Tom Callaway da615e
 /* crypto/opensslconf.h.in */
Tom Callaway da615e
 
Tom Callaway da615e
+#ifndef OPENSSL_FILE
Tom Callaway da615e
+#ifdef OPENSSL_NO_FILENAMES
Tom Callaway da615e
+#define OPENSSL_FILE ""
Tom Callaway da615e
+#define OPENSSL_LINE 0
Tom Callaway da615e
+#else
Tom Callaway da615e
+#define OPENSSL_FILE __FILE__
Tom Callaway da615e
+#define OPENSSL_LINE __LINE__
Tom Callaway da615e
+#endif
Tom Callaway da615e
+#endif
Tom Callaway da615e
+
Tom Callaway da615e
 /* Generate 80386 code? */
Tom Callaway da615e
 #undef I386_ONLY
Tom Callaway da615e
 
Tom Callaway da615e
@@ -56,7 +66,7 @@
Tom Callaway da615e
 #endif
Tom Callaway da615e
 #endif
Tom Callaway da615e
 
Tom Callaway da615e
-#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
Tom Callaway da615e
+#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) && !defined(OPENSSL_SYSNAME_UEFI)
Tom Callaway da615e
 #define CONFIG_HEADER_BN_H
Tom Callaway da615e
 #undef BN_LLONG
Tom Callaway da615e
 
Tom Callaway da615e
diff --git a/crypto/pem/pem.h b/crypto/pem/pem.h
b17819
index aac72fb..d271ec8 100644
Tom Callaway da615e
--- a/crypto/pem/pem.h
Tom Callaway da615e
+++ b/crypto/pem/pem.h
Tom Callaway da615e
@@ -324,6 +324,7 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
Tom Callaway da615e
 
Tom Callaway da615e
 #  define DECLARE_PEM_read_fp(name, type) /**/
Tom Callaway da615e
 #  define DECLARE_PEM_write_fp(name, type) /**/
Tom Callaway da615e
+#  define DECLARE_PEM_write_fp_const(name, type) /**/
Tom Callaway da615e
 #  define DECLARE_PEM_write_cb_fp(name, type) /**/
Tom Callaway da615e
 # else
Tom Callaway da615e
 
Tom Callaway da615e
@@ -417,6 +418,7 @@ int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc,
Tom Callaway da615e
                             pem_password_cb *cd, void *u);
Tom Callaway da615e
 # endif
Tom Callaway da615e
 
Tom Callaway da615e
+#ifndef OPENSSL_NO_FP_API
Tom Callaway da615e
 int PEM_read(FILE *fp, char **name, char **header,
Tom Callaway da615e
              unsigned char **data, long *len);
Tom Callaway da615e
 int PEM_write(FILE *fp, const char *name, const char *hdr,
Tom Callaway da615e
@@ -428,6 +430,7 @@ int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp,
Tom Callaway da615e
                    int klen, pem_password_cb *callback, void *u);
Tom Callaway da615e
 STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk,
Tom Callaway da615e
                                         pem_password_cb *cb, void *u);
Tom Callaway da615e
+#endif
Tom Callaway da615e
 
Tom Callaway da615e
 int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type,
Tom Callaway da615e
                  EVP_MD *md_type, unsigned char **ek, int *ekl,
Tom Callaway da615e
@@ -494,6 +497,7 @@ int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid,
Tom Callaway da615e
 EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb,
Tom Callaway da615e
                                   void *u);
Tom Callaway da615e
 
Tom Callaway da615e
+#ifndef OPENSSL_NO_FP_API
Tom Callaway da615e
 int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
Tom Callaway da615e
                            char *kstr, int klen,
Tom Callaway da615e
                            pem_password_cb *cb, void *u);
b17819
@@ -510,6 +514,7 @@ EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb,
Tom Callaway da615e
 int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
Tom Callaway da615e
                               char *kstr, int klen, pem_password_cb *cd,
Tom Callaway da615e
                               void *u);
Tom Callaway da615e
+#endif
b17819
 
Tom Callaway da615e
 EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x);
Tom Callaway da615e
 int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x);
Tom Callaway da615e
diff --git a/crypto/pem/pem_lib.c b/crypto/pem/pem_lib.c
b17819
index c82b3c0..56c77b1 100644
Tom Callaway da615e
--- a/crypto/pem/pem_lib.c
Tom Callaway da615e
+++ b/crypto/pem/pem_lib.c
Tom Callaway da615e
@@ -84,7 +84,7 @@ int pem_check_suffix(const char *pem_str, const char *suffix);
Tom Callaway da615e
 
Tom Callaway da615e
 int PEM_def_callback(char *buf, int num, int w, void *key)
Tom Callaway da615e
 {
Tom Callaway da615e
-#ifdef OPENSSL_NO_FP_API
Tom Callaway da615e
+#if defined(OPENSSL_NO_FP_API) || defined(OPENSSL_NO_UI)
Tom Callaway da615e
     /*
Tom Callaway da615e
      * We should not ever call the default callback routine from windows.
Tom Callaway da615e
      */
Tom Callaway da615e
diff --git a/crypto/pem/pem_pk8.c b/crypto/pem/pem_pk8.c
b17819
index 5747c73..9edca4d 100644
Tom Callaway da615e
--- a/crypto/pem/pem_pk8.c
Tom Callaway da615e
+++ b/crypto/pem/pem_pk8.c
b17819
@@ -69,9 +69,11 @@
Tom Callaway da615e
 static int do_pk8pkey(BIO *bp, EVP_PKEY *x, int isder,
Tom Callaway da615e
                       int nid, const EVP_CIPHER *enc,
Tom Callaway da615e
                       char *kstr, int klen, pem_password_cb *cb, void *u);
Tom Callaway da615e
+#ifndef OPENSSL_NO_FP_API
Tom Callaway da615e
 static int do_pk8pkey_fp(FILE *bp, EVP_PKEY *x, int isder,
Tom Callaway da615e
                          int nid, const EVP_CIPHER *enc,
Tom Callaway da615e
                          char *kstr, int klen, pem_password_cb *cb, void *u);
Tom Callaway da615e
+#endif
b17819
 
Tom Callaway da615e
 /*
Tom Callaway da615e
  * These functions write a private key in PKCS#8 format: it is a "drop in"
Tom Callaway da615e
diff --git a/crypto/pkcs7/pk7_smime.c b/crypto/pkcs7/pk7_smime.c
b17819
index dc9b484..e75c4b2 100644
Tom Callaway da615e
--- a/crypto/pkcs7/pk7_smime.c
Tom Callaway da615e
+++ b/crypto/pkcs7/pk7_smime.c
b17819
@@ -64,6 +64,8 @@
Tom Callaway da615e
 #include <openssl/x509.h>
Tom Callaway da615e
 #include <openssl/x509v3.h>
Tom Callaway da615e
 
Tom Callaway da615e
+#define BUFFERSIZE 4096
Tom Callaway da615e
+
Tom Callaway da615e
 static int pkcs7_copy_existing_digest(PKCS7 *p7, PKCS7_SIGNER_INFO *si);
Tom Callaway da615e
 
Tom Callaway da615e
 PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
b17819
@@ -254,7 +256,7 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
Tom Callaway da615e
     STACK_OF(PKCS7_SIGNER_INFO) *sinfos;
Tom Callaway da615e
     PKCS7_SIGNER_INFO *si;
Tom Callaway da615e
     X509_STORE_CTX cert_ctx;
Tom Callaway da615e
-    char buf[4096];
Tom Callaway da615e
+    char *buf = NULL;
Tom Callaway da615e
     int i, j = 0, k, ret = 0;
Tom Callaway da615e
     BIO *p7bio = NULL;
Tom Callaway da615e
     BIO *tmpin = NULL, *tmpout = NULL;
b17819
@@ -373,8 +375,12 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
Tom Callaway da615e
         tmpout = out;
Tom Callaway da615e
 
Tom Callaway da615e
     /* We now have to 'read' from p7bio to calculate digests etc. */
Tom Callaway da615e
+    if ((buf = OPENSSL_malloc(BUFFERSIZE)) == NULL) {
Tom Callaway da615e
+        PKCS7err(PKCS7_F_PKCS7_VERIFY, ERR_R_MALLOC_FAILURE);
Tom Callaway da615e
+        goto err;
Tom Callaway da615e
+    }
Tom Callaway da615e
     for (;;) {
Tom Callaway da615e
-        i = BIO_read(p7bio, buf, sizeof(buf));
Tom Callaway da615e
+        i = BIO_read(p7bio, buf, BUFFERSIZE);
Tom Callaway da615e
         if (i <= 0)
Tom Callaway da615e
             break;
Tom Callaway da615e
         if (tmpout)
b17819
@@ -405,6 +411,7 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
Tom Callaway da615e
     ret = 1;
Tom Callaway da615e
 
Tom Callaway da615e
  err:
Tom Callaway da615e
+    OPENSSL_free(buf);
Tom Callaway da615e
     if (tmpin == indata) {
Tom Callaway da615e
         if (indata)
Tom Callaway da615e
             BIO_pop(p7bio);
b17819
@@ -523,7 +530,7 @@ int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags)
Tom Callaway da615e
 {
Tom Callaway da615e
     BIO *tmpmem;
Tom Callaway da615e
     int ret, i;
Tom Callaway da615e
-    char buf[4096];
Tom Callaway da615e
+    char *buf = NULL;
Tom Callaway da615e
 
Tom Callaway da615e
     if (!p7) {
Tom Callaway da615e
         PKCS7err(PKCS7_F_PKCS7_DECRYPT, PKCS7_R_INVALID_NULL_POINTER);
b17819
@@ -567,24 +574,30 @@ int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags)
Tom Callaway da615e
         }
Tom Callaway da615e
         BIO_free_all(bread);
Tom Callaway da615e
         return ret;
Tom Callaway da615e
-    } else {
Tom Callaway da615e
-        for (;;) {
Tom Callaway da615e
-            i = BIO_read(tmpmem, buf, sizeof(buf));
Tom Callaway da615e
-            if (i <= 0) {
Tom Callaway da615e
-                ret = 1;
Tom Callaway da615e
-                if (BIO_method_type(tmpmem) == BIO_TYPE_CIPHER) {
Tom Callaway da615e
-                    if (!BIO_get_cipher_status(tmpmem))
Tom Callaway da615e
-                        ret = 0;
Tom Callaway da615e
-                }
Tom Callaway da615e
-
Tom Callaway da615e
-                break;
Tom Callaway da615e
-            }
Tom Callaway da615e
-            if (BIO_write(data, buf, i) != i) {
Tom Callaway da615e
-                ret = 0;
Tom Callaway da615e
-                break;
Tom Callaway da615e
+    }
Tom Callaway da615e
+    if ((buf = OPENSSL_malloc(BUFFERSIZE)) == NULL) {
Tom Callaway da615e
+        PKCS7err(PKCS7_F_PKCS7_DECRYPT, ERR_R_MALLOC_FAILURE);
Tom Callaway da615e
+        goto err;
Tom Callaway da615e
+    }
Tom Callaway da615e
+    for (;;) {
Tom Callaway da615e
+        i = BIO_read(tmpmem, buf, BUFFERSIZE);
Tom Callaway da615e
+        if (i <= 0) {
Tom Callaway da615e
+            ret = 1;
Tom Callaway da615e
+            if (BIO_method_type(tmpmem) == BIO_TYPE_CIPHER) {
Tom Callaway da615e
+                if (!BIO_get_cipher_status(tmpmem))
Tom Callaway da615e
+                    ret = 0;
Tom Callaway da615e
             }
Tom Callaway da615e
+
Tom Callaway da615e
+            break;
Tom Callaway da615e
+        }
Tom Callaway da615e
+        if (BIO_write(data, buf, i) != i) {
Tom Callaway da615e
+            ret = 0;
Tom Callaway da615e
+            break;
Tom Callaway da615e
         }
Tom Callaway da615e
-        BIO_free_all(tmpmem);
Tom Callaway da615e
-        return ret;
Tom Callaway da615e
     }
b17819
+
Tom Callaway da615e
+err:
Tom Callaway da615e
+    OPENSSL_free(buf);
Tom Callaway da615e
+    BIO_free_all(tmpmem);
Tom Callaway da615e
+    return ret;
Tom Callaway da615e
 }
Tom Callaway da615e
diff --git a/crypto/rand/rand_egd.c b/crypto/rand/rand_egd.c
Tom Callaway da615e
index 737aebf..f23f348 100644
Tom Callaway da615e
--- a/crypto/rand/rand_egd.c
Tom Callaway da615e
+++ b/crypto/rand/rand_egd.c
Tom Callaway da615e
@@ -95,7 +95,7 @@
Tom Callaway da615e
  *   RAND_egd() is a wrapper for RAND_egd_bytes() with numbytes=255.
Tom Callaway da615e
  */
Tom Callaway da615e
 
Tom Callaway da615e
-#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_VOS) || defined(OPENSSL_SYS_BEOS)
Tom Callaway da615e
+#if defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_MSDOS) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_VOS) || defined(OPENSSL_SYS_BEOS) || defined(OPENSSL_SYS_UEFI)
Tom Callaway da615e
 int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
Tom Callaway da615e
 {
Tom Callaway da615e
     return (-1);
Tom Callaway da615e
diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c
b17819
index 6c5b65d..11ee152 100644
Tom Callaway da615e
--- a/crypto/rand/rand_unix.c
Tom Callaway da615e
+++ b/crypto/rand/rand_unix.c
Tom Callaway da615e
@@ -116,7 +116,7 @@
Tom Callaway da615e
 #include <openssl/rand.h>
Tom Callaway da615e
 #include "rand_lcl.h"
Tom Callaway da615e
 
Tom Callaway da615e
-#if !(defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE))
Tom Callaway da615e
+#if !(defined(OPENSSL_SYS_WINDOWS) || defined(OPENSSL_SYS_WIN32) || defined(OPENSSL_SYS_VMS) || defined(OPENSSL_SYS_OS2) || defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_NETWARE) || defined(OPENSSL_SYS_UEFI))
Tom Callaway da615e
 
Tom Callaway da615e
 # include <sys/types.h>
Tom Callaway da615e
 # include <sys/time.h>
Tom Callaway da615e
@@ -439,7 +439,7 @@ int RAND_poll(void)
Tom Callaway da615e
                                  * defined(OPENSSL_SYS_VXWORKS) ||
Tom Callaway da615e
                                  * defined(OPENSSL_SYS_NETWARE)) */
Tom Callaway da615e
 
Tom Callaway da615e
-#if defined(OPENSSL_SYS_VXWORKS)
Tom Callaway da615e
+#if defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_UEFI)
Tom Callaway da615e
 int RAND_poll(void)
Tom Callaway da615e
 {
Tom Callaway da615e
     return 0;
Tom Callaway da615e
diff --git a/crypto/ts/ts.h b/crypto/ts/ts.h
b17819
index 2daa1b2..5205bc5 100644
Tom Callaway da615e
--- a/crypto/ts/ts.h
Tom Callaway da615e
+++ b/crypto/ts/ts.h
Tom Callaway da615e
@@ -281,8 +281,10 @@ TS_REQ *d2i_TS_REQ(TS_REQ **a, const unsigned char **pp, long length);
Tom Callaway da615e
 
Tom Callaway da615e
 TS_REQ *TS_REQ_dup(TS_REQ *a);
Tom Callaway da615e
 
Tom Callaway da615e
+#ifndef OPENSSL_NO_FP_API
Tom Callaway da615e
 TS_REQ *d2i_TS_REQ_fp(FILE *fp, TS_REQ **a);
Tom Callaway da615e
 int i2d_TS_REQ_fp(FILE *fp, TS_REQ *a);
Tom Callaway da615e
+#endif
Tom Callaway da615e
 TS_REQ *d2i_TS_REQ_bio(BIO *fp, TS_REQ **a);
Tom Callaway da615e
 int i2d_TS_REQ_bio(BIO *fp, TS_REQ *a);
Tom Callaway da615e
 
Tom Callaway da615e
@@ -294,10 +296,12 @@ TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a,
Tom Callaway da615e
 
Tom Callaway da615e
 TS_MSG_IMPRINT *TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT *a);
Tom Callaway da615e
 
Tom Callaway da615e
+#ifndef OPENSSL_NO_FP_API
Tom Callaway da615e
 TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT **a);
Tom Callaway da615e
 int i2d_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT *a);
Tom Callaway da615e
-TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *fp, TS_MSG_IMPRINT **a);
Tom Callaway da615e
-int i2d_TS_MSG_IMPRINT_bio(BIO *fp, TS_MSG_IMPRINT *a);
Tom Callaway da615e
+#endif
Tom Callaway da615e
+TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT **a);
Tom Callaway da615e
+int i2d_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT *a);
Tom Callaway da615e
 
Tom Callaway da615e
 TS_RESP *TS_RESP_new(void);
Tom Callaway da615e
 void TS_RESP_free(TS_RESP *a);
Tom Callaway da615e
@@ -306,10 +310,12 @@ TS_RESP *d2i_TS_RESP(TS_RESP **a, const unsigned char **pp, long length);
Tom Callaway da615e
 TS_TST_INFO *PKCS7_to_TS_TST_INFO(PKCS7 *token);
Tom Callaway da615e
 TS_RESP *TS_RESP_dup(TS_RESP *a);
Tom Callaway da615e
 
Tom Callaway da615e
+#ifndef OPENSSL_NO_FP_API
Tom Callaway da615e
 TS_RESP *d2i_TS_RESP_fp(FILE *fp, TS_RESP **a);
Tom Callaway da615e
 int i2d_TS_RESP_fp(FILE *fp, TS_RESP *a);
Tom Callaway da615e
-TS_RESP *d2i_TS_RESP_bio(BIO *fp, TS_RESP **a);
Tom Callaway da615e
-int i2d_TS_RESP_bio(BIO *fp, TS_RESP *a);
Tom Callaway da615e
+#endif
Tom Callaway da615e
+TS_RESP *d2i_TS_RESP_bio(BIO *bio, TS_RESP **a);
Tom Callaway da615e
+int i2d_TS_RESP_bio(BIO *bio, TS_RESP *a);
Tom Callaway da615e
 
Tom Callaway da615e
 TS_STATUS_INFO *TS_STATUS_INFO_new(void);
Tom Callaway da615e
 void TS_STATUS_INFO_free(TS_STATUS_INFO *a);
Tom Callaway da615e
@@ -325,10 +331,12 @@ TS_TST_INFO *d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **pp,
Tom Callaway da615e
                              long length);
Tom Callaway da615e
 TS_TST_INFO *TS_TST_INFO_dup(TS_TST_INFO *a);
Tom Callaway da615e
 
Tom Callaway da615e
+#ifndef OPENSSL_NO_FP_API
Tom Callaway da615e
 TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a);
Tom Callaway da615e
 int i2d_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO *a);
Tom Callaway da615e
-TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *fp, TS_TST_INFO **a);
Tom Callaway da615e
-int i2d_TS_TST_INFO_bio(BIO *fp, TS_TST_INFO *a);
Tom Callaway da615e
+#endif
Tom Callaway da615e
+TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO **a);
Tom Callaway da615e
+int i2d_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO *a);
Tom Callaway da615e
 
Tom Callaway da615e
 TS_ACCURACY *TS_ACCURACY_new(void);
Tom Callaway da615e
 void TS_ACCURACY_free(TS_ACCURACY *a);
b17819
@@ -731,15 +739,18 @@ int TS_MSG_IMPRINT_print_bio(BIO *bio, TS_MSG_IMPRINT *msg);
Tom Callaway da615e
  * ts/ts_conf.c
Tom Callaway da615e
  */
Tom Callaway da615e
 
Tom Callaway da615e
+#ifndef OPENSSL_NO_STDIO
Tom Callaway da615e
 X509 *TS_CONF_load_cert(const char *file);
Tom Callaway da615e
 STACK_OF(X509) *TS_CONF_load_certs(const char *file);
Tom Callaway da615e
 EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass);
Tom Callaway da615e
+#endif
Tom Callaway da615e
 const char *TS_CONF_get_tsa_section(CONF *conf, const char *section);
Tom Callaway da615e
 int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb,
Tom Callaway da615e
                        TS_RESP_CTX *ctx);
Tom Callaway da615e
 int TS_CONF_set_crypto_device(CONF *conf, const char *section,
Tom Callaway da615e
                               const char *device);
Tom Callaway da615e
 int TS_CONF_set_default_engine(const char *name);
Tom Callaway da615e
+#ifndef OPENSSL_NO_STDIO
Tom Callaway da615e
 int TS_CONF_set_signer_cert(CONF *conf, const char *section,
Tom Callaway da615e
                             const char *cert, TS_RESP_CTX *ctx);
Tom Callaway da615e
 int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs,
b17819
@@ -747,6 +758,7 @@ int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs,
Tom Callaway da615e
 int TS_CONF_set_signer_key(CONF *conf, const char *section,
Tom Callaway da615e
                            const char *key, const char *pass,
Tom Callaway da615e
                            TS_RESP_CTX *ctx);
Tom Callaway da615e
+#endif
Tom Callaway da615e
 int TS_CONF_set_def_policy(CONF *conf, const char *section,
Tom Callaway da615e
                            const char *policy, TS_RESP_CTX *ctx);
Tom Callaway da615e
 int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx);
b17819
@@ -787,6 +799,11 @@ void ERR_load_TS_strings(void);
Tom Callaway da615e
 # define TS_F_TS_CHECK_SIGNING_CERTS                      103
Tom Callaway da615e
 # define TS_F_TS_CHECK_STATUS_INFO                        104
Tom Callaway da615e
 # define TS_F_TS_COMPUTE_IMPRINT                          145
Tom Callaway da615e
+# define TS_F_TS_CONF_INVALID                             151
Tom Callaway da615e
+# define TS_F_TS_CONF_LOAD_CERT                           153
Tom Callaway da615e
+# define TS_F_TS_CONF_LOAD_CERTS                          154
Tom Callaway da615e
+# define TS_F_TS_CONF_LOAD_KEY                            155
Tom Callaway da615e
+# define TS_F_TS_CONF_LOOKUP_FAIL                         152
Tom Callaway da615e
 # define TS_F_TS_CONF_SET_DEFAULT_ENGINE                  146
Tom Callaway da615e
 # define TS_F_TS_GET_STATUS_TEXT                          105
Tom Callaway da615e
 # define TS_F_TS_MSG_IMPRINT_SET_ALGO                     118
b17819
@@ -825,6 +842,8 @@ void ERR_load_TS_strings(void);
Tom Callaway da615e
 /* Reason codes. */
Tom Callaway da615e
 # define TS_R_BAD_PKCS7_TYPE                              132
Tom Callaway da615e
 # define TS_R_BAD_TYPE                                    133
Tom Callaway da615e
+# define TS_R_CANNOT_LOAD_CERT                            137
Tom Callaway da615e
+# define TS_R_CANNOT_LOAD_KEY                             138
Tom Callaway da615e
 # define TS_R_CERTIFICATE_VERIFY_ERROR                    100
Tom Callaway da615e
 # define TS_R_COULD_NOT_SET_ENGINE                        127
Tom Callaway da615e
 # define TS_R_COULD_NOT_SET_TIME                          115
b17819
@@ -857,6 +876,8 @@ void ERR_load_TS_strings(void);
Tom Callaway da615e
 # define TS_R_UNACCEPTABLE_POLICY                         125
Tom Callaway da615e
 # define TS_R_UNSUPPORTED_MD_ALGORITHM                    126
Tom Callaway da615e
 # define TS_R_UNSUPPORTED_VERSION                         113
Tom Callaway da615e
+# define TS_R_VAR_BAD_VALUE                               135
Tom Callaway da615e
+# define TS_R_VAR_LOOKUP_FAILURE                          136
Tom Callaway da615e
 # define TS_R_WRONG_CONTENT_TYPE                          114
Tom Callaway da615e
 
Tom Callaway da615e
 #ifdef  __cplusplus
Tom Callaway da615e
diff --git a/crypto/ts/ts_conf.c b/crypto/ts/ts_conf.c
Tom Callaway da615e
index 4716b23..c4416ba 100644
Tom Callaway da615e
--- a/crypto/ts/ts_conf.c
Tom Callaway da615e
+++ b/crypto/ts/ts_conf.c
Tom Callaway da615e
@@ -92,6 +92,7 @@
Tom Callaway da615e
 
Tom Callaway da615e
 /* Function definitions for certificate and key loading. */
Tom Callaway da615e
 
Tom Callaway da615e
+#ifndef OPENSSL_NO_STDIO
Tom Callaway da615e
 X509 *TS_CONF_load_cert(const char *file)
Tom Callaway da615e
 {
Tom Callaway da615e
     BIO *cert = NULL;
Tom Callaway da615e
@@ -102,7 +103,7 @@ X509 *TS_CONF_load_cert(const char *file)
Tom Callaway da615e
     x = PEM_read_bio_X509_AUX(cert, NULL, NULL, NULL);
Tom Callaway da615e
  end:
Tom Callaway da615e
     if (x == NULL)
Tom Callaway da615e
-        fprintf(stderr, "unable to load certificate: %s\n", file);
Tom Callaway da615e
+        TSerr(TS_F_TS_CONF_LOAD_CERT, TS_R_CANNOT_LOAD_CERT);
Tom Callaway da615e
     BIO_free(cert);
Tom Callaway da615e
     return x;
Tom Callaway da615e
 }
Tom Callaway da615e
@@ -129,7 +130,7 @@ STACK_OF(X509) *TS_CONF_load_certs(const char *file)
Tom Callaway da615e
     }
Tom Callaway da615e
  end:
Tom Callaway da615e
     if (othercerts == NULL)
Tom Callaway da615e
-        fprintf(stderr, "unable to load certificates: %s\n", file);
Tom Callaway da615e
+        TSerr(TS_F_TS_CONF_LOAD_CERTS, TS_R_CANNOT_LOAD_CERT);
Tom Callaway da615e
     sk_X509_INFO_pop_free(allcerts, X509_INFO_free);
Tom Callaway da615e
     BIO_free(certs);
Tom Callaway da615e
     return othercerts;
Tom Callaway da615e
@@ -145,21 +146,24 @@ EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass)
Tom Callaway da615e
     pkey = PEM_read_bio_PrivateKey(key, NULL, NULL, (char *)pass);
Tom Callaway da615e
  end:
Tom Callaway da615e
     if (pkey == NULL)
Tom Callaway da615e
-        fprintf(stderr, "unable to load private key: %s\n", file);
Tom Callaway da615e
+        TSerr(TS_F_TS_CONF_LOAD_KEY, TS_R_CANNOT_LOAD_KEY);
Tom Callaway da615e
     BIO_free(key);
Tom Callaway da615e
     return pkey;
Tom Callaway da615e
 }
Tom Callaway da615e
+#endif /* !OPENSSL_NO_STDIO */
Tom Callaway da615e
 
Tom Callaway da615e
 /* Function definitions for handling configuration options. */
Tom Callaway da615e
 
Tom Callaway da615e
 static void TS_CONF_lookup_fail(const char *name, const char *tag)
Tom Callaway da615e
 {
Tom Callaway da615e
-    fprintf(stderr, "variable lookup failed for %s::%s\n", name, tag);
Tom Callaway da615e
+    TSerr(TS_F_TS_CONF_LOOKUP_FAIL, TS_R_VAR_LOOKUP_FAILURE);
Tom Callaway da615e
+    ERR_add_error_data(3, name, "::", tag);
Tom Callaway da615e
 }
Tom Callaway da615e
 
Tom Callaway da615e
 static void TS_CONF_invalid(const char *name, const char *tag)
Tom Callaway da615e
 {
Tom Callaway da615e
-    fprintf(stderr, "invalid variable value for %s::%s\n", name, tag);
Tom Callaway da615e
+    TSerr(TS_F_TS_CONF_INVALID, TS_R_VAR_BAD_VALUE);
Tom Callaway da615e
+    ERR_add_error_data(3, name, "::", tag);
Tom Callaway da615e
 }
Tom Callaway da615e
 
Tom Callaway da615e
 const char *TS_CONF_get_tsa_section(CONF *conf, const char *section)
Tom Callaway da615e
@@ -237,6 +241,7 @@ int TS_CONF_set_default_engine(const char *name)
Tom Callaway da615e
 
Tom Callaway da615e
 #endif
Tom Callaway da615e
 
Tom Callaway da615e
+#ifndef OPENSSL_NO_STDIO
Tom Callaway da615e
 int TS_CONF_set_signer_cert(CONF *conf, const char *section,
Tom Callaway da615e
                             const char *cert, TS_RESP_CTX *ctx)
Tom Callaway da615e
 {
Tom Callaway da615e
@@ -302,6 +307,7 @@ int TS_CONF_set_signer_key(CONF *conf, const char *section,
Tom Callaway da615e
     EVP_PKEY_free(key_obj);
Tom Callaway da615e
     return ret;
Tom Callaway da615e
 }
Tom Callaway da615e
+#endif /* !OPENSSL_NO_STDIO */
Tom Callaway da615e
 
Tom Callaway da615e
 int TS_CONF_set_def_policy(CONF *conf, const char *section,
Tom Callaway da615e
                            const char *policy, TS_RESP_CTX *ctx)
Tom Callaway da615e
diff --git a/crypto/ts/ts_err.c b/crypto/ts/ts_err.c
Tom Callaway da615e
index ff1abf4..3f5b78f 100644
Tom Callaway da615e
--- a/crypto/ts/ts_err.c
Tom Callaway da615e
+++ b/crypto/ts/ts_err.c
Tom Callaway da615e
@@ -1,6 +1,6 @@
Tom Callaway da615e
 /* crypto/ts/ts_err.c */
Tom Callaway da615e
 /* ====================================================================
Tom Callaway da615e
- * Copyright (c) 1999-2007 The OpenSSL Project.  All rights reserved.
Tom Callaway da615e
+ * Copyright (c) 1999-2015 The OpenSSL Project.  All rights reserved.
Tom Callaway da615e
  *
Tom Callaway da615e
  * Redistribution and use in source and binary forms, with or without
Tom Callaway da615e
  * modification, are permitted provided that the following conditions
Tom Callaway da615e
@@ -87,6 +87,11 @@ static ERR_STRING_DATA TS_str_functs[] = {
Tom Callaway da615e
     {ERR_FUNC(TS_F_TS_CHECK_SIGNING_CERTS), "TS_CHECK_SIGNING_CERTS"},
Tom Callaway da615e
     {ERR_FUNC(TS_F_TS_CHECK_STATUS_INFO), "TS_CHECK_STATUS_INFO"},
Tom Callaway da615e
     {ERR_FUNC(TS_F_TS_COMPUTE_IMPRINT), "TS_COMPUTE_IMPRINT"},
Tom Callaway da615e
+    {ERR_FUNC(TS_F_TS_CONF_INVALID), "ts_CONF_invalid"},
Tom Callaway da615e
+    {ERR_FUNC(TS_F_TS_CONF_LOAD_CERT), "TS_CONF_load_cert"},
Tom Callaway da615e
+    {ERR_FUNC(TS_F_TS_CONF_LOAD_CERTS), "TS_CONF_load_certs"},
Tom Callaway da615e
+    {ERR_FUNC(TS_F_TS_CONF_LOAD_KEY), "TS_CONF_load_key"},
Tom Callaway da615e
+    {ERR_FUNC(TS_F_TS_CONF_LOOKUP_FAIL), "ts_CONF_lookup_fail"},
Tom Callaway da615e
     {ERR_FUNC(TS_F_TS_CONF_SET_DEFAULT_ENGINE), "TS_CONF_set_default_engine"},
Tom Callaway da615e
     {ERR_FUNC(TS_F_TS_GET_STATUS_TEXT), "TS_GET_STATUS_TEXT"},
Tom Callaway da615e
     {ERR_FUNC(TS_F_TS_MSG_IMPRINT_SET_ALGO), "TS_MSG_IMPRINT_set_algo"},
Tom Callaway da615e
@@ -132,6 +137,8 @@ static ERR_STRING_DATA TS_str_functs[] = {
Tom Callaway da615e
 static ERR_STRING_DATA TS_str_reasons[] = {
Tom Callaway da615e
     {ERR_REASON(TS_R_BAD_PKCS7_TYPE), "bad pkcs7 type"},
Tom Callaway da615e
     {ERR_REASON(TS_R_BAD_TYPE), "bad type"},
Tom Callaway da615e
+    {ERR_REASON(TS_R_CANNOT_LOAD_CERT), "cannot load certificate"},
Tom Callaway da615e
+    {ERR_REASON(TS_R_CANNOT_LOAD_KEY), "cannot load private key"},
Tom Callaway da615e
     {ERR_REASON(TS_R_CERTIFICATE_VERIFY_ERROR), "certificate verify error"},
Tom Callaway da615e
     {ERR_REASON(TS_R_COULD_NOT_SET_ENGINE), "could not set engine"},
Tom Callaway da615e
     {ERR_REASON(TS_R_COULD_NOT_SET_TIME), "could not set time"},
Tom Callaway da615e
@@ -170,6 +177,8 @@ static ERR_STRING_DATA TS_str_reasons[] = {
Tom Callaway da615e
     {ERR_REASON(TS_R_UNACCEPTABLE_POLICY), "unacceptable policy"},
Tom Callaway da615e
     {ERR_REASON(TS_R_UNSUPPORTED_MD_ALGORITHM), "unsupported md algorithm"},
Tom Callaway da615e
     {ERR_REASON(TS_R_UNSUPPORTED_VERSION), "unsupported version"},
Tom Callaway da615e
+    {ERR_REASON(TS_R_VAR_BAD_VALUE), "var bad value"},
Tom Callaway da615e
+    {ERR_REASON(TS_R_VAR_LOOKUP_FAILURE), "cannot find config variable"},
Tom Callaway da615e
     {ERR_REASON(TS_R_WRONG_CONTENT_TYPE), "wrong content type"},
Tom Callaway da615e
     {0, NULL}
Tom Callaway da615e
 };
Tom Callaway da615e
diff --git a/crypto/ui/ui_util.c b/crypto/ui/ui_util.c
Tom Callaway da615e
index 0f29011..80dd40e 100644
Tom Callaway da615e
--- a/crypto/ui/ui_util.c
Tom Callaway da615e
+++ b/crypto/ui/ui_util.c
Tom Callaway da615e
@@ -56,6 +56,10 @@
Tom Callaway da615e
 #include <string.h>
Tom Callaway da615e
 #include "ui_locl.h"
Tom Callaway da615e
 
Tom Callaway da615e
+#ifndef BUFSIZ
Tom Callaway da615e
+#define BUFSIZ 256
Tom Callaway da615e
+#endif
Tom Callaway da615e
+
Tom Callaway da615e
 int UI_UTIL_read_pw_string(char *buf, int length, const char *prompt,
Tom Callaway da615e
                            int verify)
Tom Callaway da615e
 {
Tom Callaway da615e
diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c
b17819
index bbc3189..29695f9 100644
Tom Callaway da615e
--- a/crypto/x509/by_dir.c
Tom Callaway da615e
+++ b/crypto/x509/by_dir.c
Tom Callaway da615e
@@ -69,6 +69,8 @@
Tom Callaway da615e
 # include <sys/stat.h>
Tom Callaway da615e
 #endif
Tom Callaway da615e
 
Tom Callaway da615e
+#ifndef OPENSSL_NO_STDIO
Tom Callaway da615e
+
Tom Callaway da615e
 #include <openssl/lhash.h>
Tom Callaway da615e
 #include <openssl/x509.h>
Tom Callaway da615e
 
b17819
@@ -438,3 +440,5 @@ static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
Tom Callaway da615e
         BUF_MEM_free(b);
Tom Callaway da615e
     return (ok);
Tom Callaway da615e
 }
Tom Callaway da615e
+
Tom Callaway da615e
+#endif /* OPENSSL_NO_STDIO */
Tom Callaway da615e
diff --git a/crypto/x509/x509_vfy.c b/crypto/x509/x509_vfy.c
b17819
index 8334b3f..d075f66 100644
Tom Callaway da615e
--- a/crypto/x509/x509_vfy.c
Tom Callaway da615e
+++ b/crypto/x509/x509_vfy.c
b17819
@@ -1064,6 +1064,8 @@ static int check_crl_time(X509_STORE_CTX *ctx, X509_CRL *crl, int notify)
Tom Callaway da615e
         ctx->current_crl = crl;
Tom Callaway da615e
     if (ctx->param->flags & X509_V_FLAG_USE_CHECK_TIME)
Tom Callaway da615e
         ptime = &ctx->param->check_time;
Tom Callaway da615e
+    else if (ctx->param->flags & X509_V_FLAG_NO_CHECK_TIME)
Tom Callaway da615e
+        return 1;
Tom Callaway da615e
     else
Tom Callaway da615e
         ptime = NULL;
Tom Callaway da615e
 
b17819
@@ -1805,6 +1807,8 @@ static int check_cert_time(X509_STORE_CTX *ctx, X509 *x)
Tom Callaway da615e
 
Tom Callaway da615e
     if (ctx->param->flags & X509_V_FLAG_USE_CHECK_TIME)
Tom Callaway da615e
         ptime = &ctx->param->check_time;
Tom Callaway da615e
+    else if (ctx->param->flags & X509_V_FLAG_NO_CHECK_TIME)
Tom Callaway da615e
+        return 1;
Tom Callaway da615e
     else
Tom Callaway da615e
         ptime = NULL;
Tom Callaway da615e
 
Tom Callaway da615e
diff --git a/crypto/x509/x509_vfy.h b/crypto/x509/x509_vfy.h
b17819
index 5062682..e90d931 100644
Tom Callaway da615e
--- a/crypto/x509/x509_vfy.h
Tom Callaway da615e
+++ b/crypto/x509/x509_vfy.h
b17819
@@ -443,6 +443,8 @@ void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth);
Tom Callaway da615e
  * will force the behaviour to match that of previous versions.
Tom Callaway da615e
  */
Tom Callaway da615e
 # define X509_V_FLAG_NO_ALT_CHAINS               0x100000
Tom Callaway da615e
+/* Do not check certificate/CRL validity against current time */
Tom Callaway da615e
+# define X509_V_FLAG_NO_CHECK_TIME               0x200000
Tom Callaway da615e
 
Tom Callaway da615e
 # define X509_VP_FLAG_DEFAULT                    0x1
Tom Callaway da615e
 # define X509_VP_FLAG_OVERWRITE                  0x2
b17819
@@ -496,8 +498,10 @@ X509_STORE *X509_STORE_CTX_get0_store(X509_STORE_CTX *ctx);
Tom Callaway da615e
 
Tom Callaway da615e
 X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m);
b17819
 
Tom Callaway da615e
+#ifndef OPENSSL_NO_STDIO
Tom Callaway da615e
 X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void);
Tom Callaway da615e
 X509_LOOKUP_METHOD *X509_LOOKUP_file(void);
Tom Callaway da615e
+#endif
Tom Callaway da615e
 
Tom Callaway da615e
 int X509_STORE_add_cert(X509_STORE *ctx, X509 *x);
Tom Callaway da615e
 int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x);
Tom Callaway da615e
diff --git a/crypto/x509v3/ext_dat.h b/crypto/x509v3/ext_dat.h
Tom Callaway da615e
index c3a6fce..09ebbca 100644
Tom Callaway da615e
--- a/crypto/x509v3/ext_dat.h
Tom Callaway da615e
+++ b/crypto/x509v3/ext_dat.h
Tom Callaway da615e
@@ -127,8 +127,10 @@ static const X509V3_EXT_METHOD *standard_exts[] = {
Tom Callaway da615e
     &v3_idp,
Tom Callaway da615e
     &v3_alt[2],
Tom Callaway da615e
     &v3_freshest_crl,
Tom Callaway da615e
+#ifndef OPENSSL_NO_SCT
Tom Callaway da615e
     &v3_ct_scts[0],
Tom Callaway da615e
     &v3_ct_scts[1],
Tom Callaway da615e
+#endif
Tom Callaway da615e
 };
Tom Callaway da615e
 
Tom Callaway da615e
 /* Number of standard extensions */
Tom Callaway da615e
diff --git a/crypto/x509v3/v3_pci.c b/crypto/x509v3/v3_pci.c
Tom Callaway da615e
index 34cad53..12f12a7 100644
Tom Callaway da615e
--- a/crypto/x509v3/v3_pci.c
Tom Callaway da615e
+++ b/crypto/x509v3/v3_pci.c
Tom Callaway da615e
@@ -149,6 +149,7 @@ static int process_pci_value(CONF_VALUE *val,
Tom Callaway da615e
                 goto err;
Tom Callaway da615e
             }
Tom Callaway da615e
             OPENSSL_free(tmp_data2);
Tom Callaway da615e
+#ifndef OPENSSL_NO_STDIO
Tom Callaway da615e
         } else if (strncmp(val->value, "file:", 5) == 0) {
Tom Callaway da615e
             unsigned char buf[2048];
Tom Callaway da615e
             int n;
Tom Callaway da615e
@@ -181,6 +182,7 @@ static int process_pci_value(CONF_VALUE *val,
Tom Callaway da615e
                 X509V3_conf_err(val);
Tom Callaway da615e
                 goto err;
Tom Callaway da615e
             }
Tom Callaway da615e
+#endif /* !OPENSSL_NO_STDIO */
Tom Callaway da615e
         } else if (strncmp(val->value, "text:", 5) == 0) {
Tom Callaway da615e
             val_len = strlen(val->value + 5);
Tom Callaway da615e
             tmp_data = OPENSSL_realloc((*policy)->data,
Tom Callaway da615e
diff --git a/crypto/x509v3/v3_scts.c b/crypto/x509v3/v3_scts.c
Tom Callaway da615e
index 0b7c681..1895b8f 100644
Tom Callaway da615e
--- a/crypto/x509v3/v3_scts.c
Tom Callaway da615e
+++ b/crypto/x509v3/v3_scts.c
Tom Callaway da615e
@@ -61,6 +61,7 @@
Tom Callaway da615e
 #include <openssl/asn1.h>
Tom Callaway da615e
 #include <openssl/x509v3.h>
Tom Callaway da615e
 
Tom Callaway da615e
+#ifndef OPENSSL_NO_SCT
Tom Callaway da615e
 /* Signature and hash algorithms from RFC 5246 */
Tom Callaway da615e
 #define TLSEXT_hash_sha256                              4
Tom Callaway da615e
 
Tom Callaway da615e
@@ -332,3 +333,4 @@ static int i2r_SCT_LIST(X509V3_EXT_METHOD *method, STACK_OF(SCT) *sct_list,
Tom Callaway da615e
 
Tom Callaway da615e
     return 1;
Tom Callaway da615e
 }
Tom Callaway da615e
+#endif
Tom Callaway da615e
diff --git a/crypto/x509v3/x509v3.h b/crypto/x509v3/x509v3.h
Tom Callaway da615e
index f5c6156..a2e78aa 100644
Tom Callaway da615e
--- a/crypto/x509v3/x509v3.h
Tom Callaway da615e
+++ b/crypto/x509v3/x509v3.h
Tom Callaway da615e
@@ -688,8 +688,9 @@ void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent,
Tom Callaway da615e
                         int ml);
Tom Callaway da615e
 int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag,
Tom Callaway da615e
                      int indent);
Tom Callaway da615e
+#ifndef OPENSSL_NO_FP_API
Tom Callaway da615e
 int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent);
Tom Callaway da615e
-
Tom Callaway da615e
+#endif
Tom Callaway da615e
 int X509V3_extensions_print(BIO *out, char *title,
Tom Callaway da615e
                             STACK_OF(X509_EXTENSION) *exts,
Tom Callaway da615e
                             unsigned long flag, int indent);
Tom Callaway da615e
diff --git a/demos/engines/cluster_labs/hw_cluster_labs_err.h b/demos/engines/cluster_labs/hw_cluster_labs_err.h
Tom Callaway da615e
index 3300e11..e9e58d5 100644
Tom Callaway da615e
--- a/demos/engines/cluster_labs/hw_cluster_labs_err.h
Tom Callaway da615e
+++ b/demos/engines/cluster_labs/hw_cluster_labs_err.h
Tom Callaway da615e
@@ -67,7 +67,7 @@ extern "C" {
Tom Callaway da615e
 static void ERR_load_CL_strings(void);
Tom Callaway da615e
 static void ERR_unload_CL_strings(void);
Tom Callaway da615e
 static void ERR_CL_error(int function, int reason, char *file, int line);
Tom Callaway da615e
-# define CLerr(f,r) ERR_CL_error((f),(r),__FILE__,__LINE__)
Tom Callaway da615e
+# define CLerr(f,r) ERR_CL_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 
Tom Callaway da615e
 /* Error codes for the CL functions. */
Tom Callaway da615e
 
Tom Callaway da615e
diff --git a/demos/engines/ibmca/hw_ibmca_err.h b/demos/engines/ibmca/hw_ibmca_err.h
Tom Callaway da615e
index c17e0c9..10d0212 100644
Tom Callaway da615e
--- a/demos/engines/ibmca/hw_ibmca_err.h
Tom Callaway da615e
+++ b/demos/engines/ibmca/hw_ibmca_err.h
Tom Callaway da615e
@@ -67,7 +67,7 @@ extern "C" {
Tom Callaway da615e
 static void ERR_load_IBMCA_strings(void);
Tom Callaway da615e
 static void ERR_unload_IBMCA_strings(void);
Tom Callaway da615e
 static void ERR_IBMCA_error(int function, int reason, char *file, int line);
Tom Callaway da615e
-# define IBMCAerr(f,r) ERR_IBMCA_error((f),(r),__FILE__,__LINE__)
Tom Callaway da615e
+# define IBMCAerr(f,r) ERR_IBMCA_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 
Tom Callaway da615e
 /* Error codes for the IBMCA functions. */
Tom Callaway da615e
 
Tom Callaway da615e
diff --git a/demos/engines/rsaref/rsaref_err.h b/demos/engines/rsaref/rsaref_err.h
Tom Callaway da615e
index 4356815..598836f 100644
Tom Callaway da615e
--- a/demos/engines/rsaref/rsaref_err.h
Tom Callaway da615e
+++ b/demos/engines/rsaref/rsaref_err.h
Tom Callaway da615e
@@ -68,7 +68,7 @@ extern "C" {
Tom Callaway da615e
 static void ERR_load_RSAREF_strings(void);
Tom Callaway da615e
 static void ERR_unload_RSAREF_strings(void);
Tom Callaway da615e
 static void ERR_RSAREF_error(int function, int reason, char *file, int line);
Tom Callaway da615e
-# define RSAREFerr(f,r) ERR_RSAREF_error((f),(r),__FILE__,__LINE__)
Tom Callaway da615e
+# define RSAREFerr(f,r) ERR_RSAREF_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 /* Error codes for the RSAREF functions. */
Tom Callaway da615e
 
Tom Callaway da615e
 /* Function codes. */
Tom Callaway da615e
diff --git a/demos/engines/zencod/hw_zencod_err.h b/demos/engines/zencod/hw_zencod_err.h
Tom Callaway da615e
index f4a8358..94d3293 100644
Tom Callaway da615e
--- a/demos/engines/zencod/hw_zencod_err.h
Tom Callaway da615e
+++ b/demos/engines/zencod/hw_zencod_err.h
Tom Callaway da615e
@@ -67,7 +67,7 @@ extern "C" {
Tom Callaway da615e
 static void ERR_load_ZENCOD_strings(void);
Tom Callaway da615e
 static void ERR_unload_ZENCOD_strings(void);
Tom Callaway da615e
 static void ERR_ZENCOD_error(int function, int reason, char *file, int line);
Tom Callaway da615e
-# define ZENCODerr(f,r) ERR_ZENCOD_error((f),(r),__FILE__,__LINE__)
Tom Callaway da615e
+# define ZENCODerr(f,r) ERR_ZENCOD_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 
Tom Callaway da615e
 /* Error codes for the ZENCOD functions. */
Tom Callaway da615e
 
Tom Callaway da615e
diff --git a/doc/crypto/X509_VERIFY_PARAM_set_flags.pod b/doc/crypto/X509_VERIFY_PARAM_set_flags.pod
Tom Callaway da615e
index 44792f9..7f95d58 100644
Tom Callaway da615e
--- a/doc/crypto/X509_VERIFY_PARAM_set_flags.pod
Tom Callaway da615e
+++ b/doc/crypto/X509_VERIFY_PARAM_set_flags.pod
Tom Callaway da615e
@@ -203,6 +203,10 @@ chain found is not trusted, then OpenSSL will continue to check to see if an
Tom Callaway da615e
 alternative chain can be found that is trusted. With this flag set the behaviour
Tom Callaway da615e
 will match that of OpenSSL versions prior to 1.0.2b.
Tom Callaway da615e
 
Tom Callaway da615e
+The B<X509_V_FLAG_NO_CHECK_TIME> flag suppresses checking the validity period
Tom Callaway da615e
+of certificates and CRLs against the current time. If X509_VERIFY_PARAM_set_time()
Tom Callaway da615e
+is used to specify a verification time, the check is not suppressed.
Tom Callaway da615e
+
Tom Callaway da615e
 =head1 NOTES
Tom Callaway da615e
 
Tom Callaway da615e
 The above functions should be used to manipulate verification parameters
Tom Callaway da615e
diff --git a/doc/crypto/threads.pod b/doc/crypto/threads.pod
Tom Callaway da615e
index dc0e939..fe123bb 100644
Tom Callaway da615e
--- a/doc/crypto/threads.pod
Tom Callaway da615e
+++ b/doc/crypto/threads.pod
Tom Callaway da615e
@@ -51,15 +51,15 @@ CRYPTO_destroy_dynlockid, CRYPTO_lock - OpenSSL thread support
Tom Callaway da615e
  void CRYPTO_lock(int mode, int n, const char *file, int line);
Tom Callaway da615e
 
Tom Callaway da615e
  #define CRYPTO_w_lock(type)	\
Tom Callaway da615e
-	CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
Tom Callaway da615e
+	CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
  #define CRYPTO_w_unlock(type)	\
Tom Callaway da615e
-	CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
Tom Callaway da615e
+	CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
  #define CRYPTO_r_lock(type)	\
Tom Callaway da615e
-	CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__)
Tom Callaway da615e
+	CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
  #define CRYPTO_r_unlock(type)	\
Tom Callaway da615e
-	CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__)
Tom Callaway da615e
+	CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
  #define CRYPTO_add(addr,amount,type)	\
Tom Callaway da615e
-	CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__)
Tom Callaway da615e
+	CRYPTO_add_lock(addr,amount,type,OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 
Tom Callaway da615e
 =head1 DESCRIPTION
Tom Callaway da615e
 
Tom Callaway da615e
diff --git a/e_os.h b/e_os.h
Tom Callaway da615e
index 1fa36c1..3e9dae2 100644
Tom Callaway da615e
--- a/e_os.h
Tom Callaway da615e
+++ b/e_os.h
Tom Callaway da615e
@@ -136,7 +136,7 @@ extern "C" {
Tom Callaway da615e
 #  define MSDOS
Tom Callaway da615e
 # endif
Tom Callaway da615e
 
Tom Callaway da615e
-# if defined(MSDOS) && !defined(GETPID_IS_MEANINGLESS)
Tom Callaway da615e
+# if (defined(MSDOS) || defined(OPENSSL_SYS_UEFI)) && !defined(GETPID_IS_MEANINGLESS)
Tom Callaway da615e
 #  define GETPID_IS_MEANINGLESS
Tom Callaway da615e
 # endif
Tom Callaway da615e
 
Tom Callaway da615e
diff --git a/e_os2.h b/e_os2.h
Tom Callaway da615e
index 7be9989..909e22f 100644
Tom Callaway da615e
--- a/e_os2.h
Tom Callaway da615e
+++ b/e_os2.h
Tom Callaway da615e
@@ -97,7 +97,14 @@ extern "C" {
Tom Callaway da615e
  * For 32 bit environment, there seems to be the CygWin environment and then
Tom Callaway da615e
  * all the others that try to do the same thing Microsoft does...
Tom Callaway da615e
  */
Tom Callaway da615e
-# if defined(OPENSSL_SYSNAME_UWIN)
Tom Callaway da615e
+/*
Tom Callaway da615e
+ * UEFI lives here because it might be built with a Microsoft toolchain and
Tom Callaway da615e
+ * we need to avoid the false positive match on Windows.
Tom Callaway da615e
+ */
Tom Callaway da615e
+# if defined(OPENSSL_SYSNAME_UEFI)
Tom Callaway da615e
+#  undef OPENSSL_SYS_UNIX
Tom Callaway da615e
+#  define OPENSSL_SYS_UEFI
Tom Callaway da615e
+# elif defined(OPENSSL_SYSNAME_UWIN)
Tom Callaway da615e
 #  undef OPENSSL_SYS_UNIX
Tom Callaway da615e
 #  define OPENSSL_SYS_WIN32_UWIN
Tom Callaway da615e
 # else
Tom Callaway da615e
diff --git a/engines/ccgost/e_gost_err.h b/engines/ccgost/e_gost_err.h
Tom Callaway da615e
index a2018ec..9eacdcf 100644
Tom Callaway da615e
--- a/engines/ccgost/e_gost_err.h
Tom Callaway da615e
+++ b/engines/ccgost/e_gost_err.h
Tom Callaway da615e
@@ -67,7 +67,7 @@ extern "C" {
Tom Callaway da615e
 void ERR_load_GOST_strings(void);
Tom Callaway da615e
 void ERR_unload_GOST_strings(void);
Tom Callaway da615e
 void ERR_GOST_error(int function, int reason, char *file, int line);
Tom Callaway da615e
-# define GOSTerr(f,r) ERR_GOST_error((f),(r),__FILE__,__LINE__)
Tom Callaway da615e
+# define GOSTerr(f,r) ERR_GOST_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 
Tom Callaway da615e
 /* Error codes for the GOST functions. */
Tom Callaway da615e
 
Tom Callaway da615e
diff --git a/engines/e_4758cca_err.h b/engines/e_4758cca_err.h
Tom Callaway da615e
index 2f29d96..47a2635 100644
Tom Callaway da615e
--- a/engines/e_4758cca_err.h
Tom Callaway da615e
+++ b/engines/e_4758cca_err.h
Tom Callaway da615e
@@ -67,7 +67,7 @@ extern "C" {
Tom Callaway da615e
 static void ERR_load_CCA4758_strings(void);
Tom Callaway da615e
 static void ERR_unload_CCA4758_strings(void);
Tom Callaway da615e
 static void ERR_CCA4758_error(int function, int reason, char *file, int line);
Tom Callaway da615e
-# define CCA4758err(f,r) ERR_CCA4758_error((f),(r),__FILE__,__LINE__)
Tom Callaway da615e
+# define CCA4758err(f,r) ERR_CCA4758_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 
Tom Callaway da615e
 /* Error codes for the CCA4758 functions. */
Tom Callaway da615e
 
Tom Callaway da615e
diff --git a/engines/e_aep_err.h b/engines/e_aep_err.h
Tom Callaway da615e
index 2ed0114..1f8fa5b 100644
Tom Callaway da615e
--- a/engines/e_aep_err.h
Tom Callaway da615e
+++ b/engines/e_aep_err.h
Tom Callaway da615e
@@ -67,7 +67,7 @@ extern "C" {
Tom Callaway da615e
 static void ERR_load_AEPHK_strings(void);
Tom Callaway da615e
 static void ERR_unload_AEPHK_strings(void);
Tom Callaway da615e
 static void ERR_AEPHK_error(int function, int reason, char *file, int line);
Tom Callaway da615e
-# define AEPHKerr(f,r) ERR_AEPHK_error((f),(r),__FILE__,__LINE__)
Tom Callaway da615e
+# define AEPHKerr(f,r) ERR_AEPHK_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 
Tom Callaway da615e
 /* Error codes for the AEPHK functions. */
Tom Callaway da615e
 
Tom Callaway da615e
diff --git a/engines/e_atalla_err.h b/engines/e_atalla_err.h
Tom Callaway da615e
index 7b71eff..d958496 100644
Tom Callaway da615e
--- a/engines/e_atalla_err.h
Tom Callaway da615e
+++ b/engines/e_atalla_err.h
Tom Callaway da615e
@@ -67,7 +67,7 @@ extern "C" {
Tom Callaway da615e
 static void ERR_load_ATALLA_strings(void);
Tom Callaway da615e
 static void ERR_unload_ATALLA_strings(void);
Tom Callaway da615e
 static void ERR_ATALLA_error(int function, int reason, char *file, int line);
Tom Callaway da615e
-# define ATALLAerr(f,r) ERR_ATALLA_error((f),(r),__FILE__,__LINE__)
Tom Callaway da615e
+# define ATALLAerr(f,r) ERR_ATALLA_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 
Tom Callaway da615e
 /* Error codes for the ATALLA functions. */
Tom Callaway da615e
 
Tom Callaway da615e
diff --git a/engines/e_capi_err.h b/engines/e_capi_err.h
Tom Callaway da615e
index b5d06dc..cfe46b1 100644
Tom Callaway da615e
--- a/engines/e_capi_err.h
Tom Callaway da615e
+++ b/engines/e_capi_err.h
Tom Callaway da615e
@@ -67,7 +67,7 @@ extern "C" {
Tom Callaway da615e
 static void ERR_load_CAPI_strings(void);
Tom Callaway da615e
 static void ERR_unload_CAPI_strings(void);
Tom Callaway da615e
 static void ERR_CAPI_error(int function, int reason, char *file, int line);
Tom Callaway da615e
-# define CAPIerr(f,r) ERR_CAPI_error((f),(r),__FILE__,__LINE__)
Tom Callaway da615e
+# define CAPIerr(f,r) ERR_CAPI_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 
Tom Callaway da615e
 /* Error codes for the CAPI functions. */
Tom Callaway da615e
 
Tom Callaway da615e
diff --git a/engines/e_chil_err.h b/engines/e_chil_err.h
Tom Callaway da615e
index d86a4ce..3d961b9 100644
Tom Callaway da615e
--- a/engines/e_chil_err.h
Tom Callaway da615e
+++ b/engines/e_chil_err.h
Tom Callaway da615e
@@ -67,7 +67,7 @@ extern "C" {
Tom Callaway da615e
 static void ERR_load_HWCRHK_strings(void);
Tom Callaway da615e
 static void ERR_unload_HWCRHK_strings(void);
Tom Callaway da615e
 static void ERR_HWCRHK_error(int function, int reason, char *file, int line);
Tom Callaway da615e
-# define HWCRHKerr(f,r) ERR_HWCRHK_error((f),(r),__FILE__,__LINE__)
Tom Callaway da615e
+# define HWCRHKerr(f,r) ERR_HWCRHK_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 
Tom Callaway da615e
 /* Error codes for the HWCRHK functions. */
Tom Callaway da615e
 
Tom Callaway da615e
diff --git a/engines/e_cswift_err.h b/engines/e_cswift_err.h
Tom Callaway da615e
index fde3a82..7c20691 100644
Tom Callaway da615e
--- a/engines/e_cswift_err.h
Tom Callaway da615e
+++ b/engines/e_cswift_err.h
Tom Callaway da615e
@@ -67,7 +67,7 @@ extern "C" {
Tom Callaway da615e
 static void ERR_load_CSWIFT_strings(void);
Tom Callaway da615e
 static void ERR_unload_CSWIFT_strings(void);
Tom Callaway da615e
 static void ERR_CSWIFT_error(int function, int reason, char *file, int line);
Tom Callaway da615e
-# define CSWIFTerr(f,r) ERR_CSWIFT_error((f),(r),__FILE__,__LINE__)
Tom Callaway da615e
+# define CSWIFTerr(f,r) ERR_CSWIFT_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 
Tom Callaway da615e
 /* Error codes for the CSWIFT functions. */
Tom Callaway da615e
 
Tom Callaway da615e
diff --git a/engines/e_gmp_err.h b/engines/e_gmp_err.h
Tom Callaway da615e
index 637abbc..ccaf3da 100644
Tom Callaway da615e
--- a/engines/e_gmp_err.h
Tom Callaway da615e
+++ b/engines/e_gmp_err.h
Tom Callaway da615e
@@ -67,7 +67,7 @@ extern "C" {
Tom Callaway da615e
 static void ERR_load_GMP_strings(void);
Tom Callaway da615e
 static void ERR_unload_GMP_strings(void);
Tom Callaway da615e
 static void ERR_GMP_error(int function, int reason, char *file, int line);
Tom Callaway da615e
-# define GMPerr(f,r) ERR_GMP_error((f),(r),__FILE__,__LINE__)
Tom Callaway da615e
+# define GMPerr(f,r) ERR_GMP_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 
Tom Callaway da615e
 /* Error codes for the GMP functions. */
Tom Callaway da615e
 
Tom Callaway da615e
diff --git a/engines/e_nuron_err.h b/engines/e_nuron_err.h
Tom Callaway da615e
index aa7849c..e607d3e 100644
Tom Callaway da615e
--- a/engines/e_nuron_err.h
Tom Callaway da615e
+++ b/engines/e_nuron_err.h
Tom Callaway da615e
@@ -67,7 +67,7 @@ extern "C" {
Tom Callaway da615e
 static void ERR_load_NURON_strings(void);
Tom Callaway da615e
 static void ERR_unload_NURON_strings(void);
Tom Callaway da615e
 static void ERR_NURON_error(int function, int reason, char *file, int line);
Tom Callaway da615e
-# define NURONerr(f,r) ERR_NURON_error((f),(r),__FILE__,__LINE__)
Tom Callaway da615e
+# define NURONerr(f,r) ERR_NURON_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 
Tom Callaway da615e
 /* Error codes for the NURON functions. */
Tom Callaway da615e
 
Tom Callaway da615e
diff --git a/engines/e_sureware_err.h b/engines/e_sureware_err.h
Tom Callaway da615e
index bef8623..54f2848 100644
Tom Callaway da615e
--- a/engines/e_sureware_err.h
Tom Callaway da615e
+++ b/engines/e_sureware_err.h
Tom Callaway da615e
@@ -68,7 +68,7 @@ static void ERR_load_SUREWARE_strings(void);
Tom Callaway da615e
 static void ERR_unload_SUREWARE_strings(void);
Tom Callaway da615e
 static void ERR_SUREWARE_error(int function, int reason, char *file,
Tom Callaway da615e
                                int line);
Tom Callaway da615e
-# define SUREWAREerr(f,r) ERR_SUREWARE_error((f),(r),__FILE__,__LINE__)
Tom Callaway da615e
+# define SUREWAREerr(f,r) ERR_SUREWARE_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 
Tom Callaway da615e
 /* Error codes for the SUREWARE functions. */
Tom Callaway da615e
 
Tom Callaway da615e
diff --git a/engines/e_ubsec_err.h b/engines/e_ubsec_err.h
Tom Callaway da615e
index c8aec7c..67110ed 100644
Tom Callaway da615e
--- a/engines/e_ubsec_err.h
Tom Callaway da615e
+++ b/engines/e_ubsec_err.h
Tom Callaway da615e
@@ -67,7 +67,7 @@ extern "C" {
Tom Callaway da615e
 static void ERR_load_UBSEC_strings(void);
Tom Callaway da615e
 static void ERR_unload_UBSEC_strings(void);
Tom Callaway da615e
 static void ERR_UBSEC_error(int function, int reason, char *file, int line);
Tom Callaway da615e
-# define UBSECerr(f,r) ERR_UBSEC_error((f),(r),__FILE__,__LINE__)
Tom Callaway da615e
+# define UBSECerr(f,r) ERR_UBSEC_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 
Tom Callaway da615e
 /* Error codes for the UBSEC functions. */
Tom Callaway da615e
 
Tom Callaway da615e
diff --git a/makevms.com b/makevms.com
Tom Callaway da615e
index f6b3ff2..1dcbe36 100755
Tom Callaway da615e
--- a/makevms.com
Tom Callaway da615e
+++ b/makevms.com
Tom Callaway da615e
@@ -293,6 +293,7 @@ $ CONFIG_LOGICALS := AES,-
Tom Callaway da615e
 		     RFC3779,-
Tom Callaway da615e
 		     RIPEMD,-
Tom Callaway da615e
 		     RSA,-
Tom Callaway da615e
+		     SCT,-
Tom Callaway da615e
 		     SCTP,-
Tom Callaway da615e
 		     SEED,-
Tom Callaway da615e
 		     SHA,-
Tom Callaway da615e
diff --git a/ssl/d1_both.c b/ssl/d1_both.c
b17819
index 9bc6153..b5648eb 100644
Tom Callaway da615e
--- a/ssl/d1_both.c
Tom Callaway da615e
+++ b/ssl/d1_both.c
b17819
@@ -1068,7 +1068,7 @@ int dtls1_send_change_cipher_spec(SSL *s, int a, int b)
Tom Callaway da615e
 int dtls1_read_failed(SSL *s, int code)
Tom Callaway da615e
 {
Tom Callaway da615e
     if (code > 0) {
Tom Callaway da615e
-        fprintf(stderr, "invalid state reached %s:%d", __FILE__, __LINE__);
Tom Callaway da615e
+        fprintf(stderr, "dtls1_read_failed(); invalid state reached\n");
Tom Callaway da615e
         return 1;
Tom Callaway da615e
     }
Tom Callaway da615e
 
Tom Callaway da615e
diff --git a/ssl/ssl_asn1.c b/ssl/ssl_asn1.c
b17819
index 499f0e8..5672f99 100644
Tom Callaway da615e
--- a/ssl/ssl_asn1.c
Tom Callaway da615e
+++ b/ssl/ssl_asn1.c
Tom Callaway da615e
@@ -418,7 +418,7 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,
Tom Callaway da615e
     if (ssl_version == SSL2_VERSION) {
Tom Callaway da615e
         if (os.length != 3) {
Tom Callaway da615e
             c.error = SSL_R_CIPHER_CODE_WRONG_LENGTH;
Tom Callaway da615e
-            c.line = __LINE__;
Tom Callaway da615e
+            c.line = OPENSSL_LINE;
Tom Callaway da615e
             goto err;
Tom Callaway da615e
         }
Tom Callaway da615e
         id = 0x02000000L |
Tom Callaway da615e
@@ -429,14 +429,14 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,
Tom Callaway da615e
         || ssl_version == DTLS1_BAD_VER) {
Tom Callaway da615e
         if (os.length != 2) {
Tom Callaway da615e
             c.error = SSL_R_CIPHER_CODE_WRONG_LENGTH;
Tom Callaway da615e
-            c.line = __LINE__;
Tom Callaway da615e
+            c.line = OPENSSL_LINE;
Tom Callaway da615e
             goto err;
Tom Callaway da615e
         }
Tom Callaway da615e
         id = 0x03000000L |
Tom Callaway da615e
             ((unsigned long)os.data[0] << 8L) | (unsigned long)os.data[1];
Tom Callaway da615e
     } else {
Tom Callaway da615e
         c.error = SSL_R_UNKNOWN_SSL_VERSION;
Tom Callaway da615e
-        c.line = __LINE__;
Tom Callaway da615e
+        c.line = OPENSSL_LINE;
Tom Callaway da615e
         goto err;
Tom Callaway da615e
     }
Tom Callaway da615e
 
Tom Callaway da615e
@@ -526,7 +526,7 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,
Tom Callaway da615e
     if (os.data != NULL) {
Tom Callaway da615e
         if (os.length > SSL_MAX_SID_CTX_LENGTH) {
Tom Callaway da615e
             c.error = SSL_R_BAD_LENGTH;
Tom Callaway da615e
-            c.line = __LINE__;
Tom Callaway da615e
+            c.line = OPENSSL_LINE;
b17819
             OPENSSL_free(os.data);
b17819
             os.data = NULL;
b17819
             os.length = 0;
Tom Callaway da615e
diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c
b17819
index f48ebae..ac4f08c 100644
Tom Callaway da615e
--- a/ssl/ssl_cert.c
Tom Callaway da615e
+++ b/ssl/ssl_cert.c
b17819
@@ -857,12 +857,12 @@ int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x)
Tom Callaway da615e
     return (add_client_CA(&(ctx->client_CA), x));
Tom Callaway da615e
 }
Tom Callaway da615e
 
Tom Callaway da615e
+#ifndef OPENSSL_NO_STDIO
Tom Callaway da615e
 static int xname_cmp(const X509_NAME *const *a, const X509_NAME *const *b)
Tom Callaway da615e
 {
Tom Callaway da615e
     return (X509_NAME_cmp(*a, *b));
Tom Callaway da615e
 }
Tom Callaway da615e
 
Tom Callaway da615e
-#ifndef OPENSSL_NO_STDIO
Tom Callaway da615e
 /**
Tom Callaway da615e
  * Load CA certs from a file into a ::STACK. Note that it is somewhat misnamed;
Tom Callaway da615e
  * it doesn't really have anything to do with clients (except that a common use
b17819
@@ -930,7 +930,6 @@ STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file)
Tom Callaway da615e
         ERR_clear_error();
Tom Callaway da615e
     return (ret);
Tom Callaway da615e
 }
Tom Callaway da615e
-#endif
Tom Callaway da615e
 
Tom Callaway da615e
 /**
Tom Callaway da615e
  * Add a file of certs to a stack.
b17819
@@ -1050,6 +1049,7 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
Tom Callaway da615e
     CRYPTO_w_unlock(CRYPTO_LOCK_READDIR);
Tom Callaway da615e
     return ret;
Tom Callaway da615e
 }
Tom Callaway da615e
+#endif /* !OPENSSL_NO_STDIO */
Tom Callaway da615e
 
Tom Callaway da615e
 /* Add a certificate to a BUF_MEM structure */
Tom Callaway da615e
 
Tom Callaway da615e
diff --git a/ssl/ssl_conf.c b/ssl/ssl_conf.c
Tom Callaway da615e
index 8d3709d..2bb403b 100644
Tom Callaway da615e
--- a/ssl/ssl_conf.c
Tom Callaway da615e
+++ b/ssl/ssl_conf.c
Tom Callaway da615e
@@ -370,6 +370,7 @@ static int cmd_Options(SSL_CONF_CTX *cctx, const char *value)
Tom Callaway da615e
     return CONF_parse_list(value, ',', 1, ssl_set_option_list, cctx);
Tom Callaway da615e
 }
Tom Callaway da615e
 
Tom Callaway da615e
+#ifndef OPENSSL_NO_STDIO
Tom Callaway da615e
 static int cmd_Certificate(SSL_CONF_CTX *cctx, const char *value)
Tom Callaway da615e
 {
Tom Callaway da615e
     int rv = 1;
Tom Callaway da615e
@@ -436,7 +437,9 @@ static int cmd_DHParameters(SSL_CONF_CTX *cctx, const char *value)
Tom Callaway da615e
         BIO_free(in);
Tom Callaway da615e
     return rv > 0;
Tom Callaway da615e
 }
Tom Callaway da615e
-#endif
Tom Callaway da615e
+#endif /* !OPENSSL_NO_DH */
Tom Callaway da615e
+#endif /* !OPENSSL_NO_STDIO */
Tom Callaway da615e
+
Tom Callaway da615e
 typedef struct {
Tom Callaway da615e
     int (*cmd) (SSL_CONF_CTX *cctx, const char *value);
Tom Callaway da615e
     const char *str_file;
Tom Callaway da615e
@@ -462,12 +465,14 @@ static const ssl_conf_cmd_tbl ssl_conf_cmds[] = {
Tom Callaway da615e
     SSL_CONF_CMD_STRING(CipherString, "cipher"),
Tom Callaway da615e
     SSL_CONF_CMD_STRING(Protocol, NULL),
Tom Callaway da615e
     SSL_CONF_CMD_STRING(Options, NULL),
Tom Callaway da615e
+#ifndef OPENSSL_NO_STDIO
Tom Callaway da615e
     SSL_CONF_CMD(Certificate, "cert", SSL_CONF_TYPE_FILE),
Tom Callaway da615e
     SSL_CONF_CMD(PrivateKey, "key", SSL_CONF_TYPE_FILE),
Tom Callaway da615e
     SSL_CONF_CMD(ServerInfoFile, NULL, SSL_CONF_TYPE_FILE),
Tom Callaway da615e
 #ifndef OPENSSL_NO_DH
Tom Callaway da615e
     SSL_CONF_CMD(DHParameters, "dhparam", SSL_CONF_TYPE_FILE)
Tom Callaway da615e
 #endif
Tom Callaway da615e
+#endif
Tom Callaway da615e
 };
Tom Callaway da615e
 
Tom Callaway da615e
 static int ssl_conf_cmd_skip_prefix(SSL_CONF_CTX *cctx, const char **pcmd)
Tom Callaway da615e
diff --git a/ssl/t1_enc.c b/ssl/t1_enc.c
b17819
index b6d1ee9..75f38cd 100644
Tom Callaway da615e
--- a/ssl/t1_enc.c
Tom Callaway da615e
+++ b/ssl/t1_enc.c
b17819
@@ -779,9 +779,7 @@ int tls1_enc(SSL *s, int send)
Tom Callaway da615e
                      * we can't write into the input stream: Can this ever
Tom Callaway da615e
                      * happen?? (steve)
Tom Callaway da615e
                      */
Tom Callaway da615e
-                    fprintf(stderr,
Tom Callaway da615e
-                            "%s:%d: rec->data != rec->input\n",
Tom Callaway da615e
-                            __FILE__, __LINE__);
Tom Callaway da615e
+                    fprintf(stderr, "tls1_enc: rec->data != rec->input\n");
Tom Callaway da615e
                 else if (RAND_bytes(rec->input, ivlen) <= 0)
Tom Callaway da615e
                     return -1;
Tom Callaway da615e
             }
Tom Callaway da615e
diff --git a/test/cms-test.pl b/test/cms-test.pl
Tom Callaway da615e
index baa3b59..1ee3f02 100644
Tom Callaway da615e
--- a/test/cms-test.pl
Tom Callaway da615e
+++ b/test/cms-test.pl
Tom Callaway da615e
@@ -100,6 +100,13 @@ my $no_ec2m;
Tom Callaway da615e
 my $no_ecdh;
Tom Callaway da615e
 my $ossl8 = `$ossl_path version -v` =~ /0\.9\.8/;
Tom Callaway da615e
 
Tom Callaway da615e
+system ("$ossl_path no-cms > $null_path");
Tom Callaway da615e
+if ($? == 0)
Tom Callaway da615e
+        {
Tom Callaway da615e
+        print "CMS disabled\n";
Tom Callaway da615e
+        exit 0;
Tom Callaway da615e
+        }
Tom Callaway da615e
+
Tom Callaway da615e
 system ("$ossl_path no-ec > $null_path");
Tom Callaway da615e
 if ($? == 0)
Tom Callaway da615e
 	{
Tom Callaway da615e
diff --git a/util/libeay.num b/util/libeay.num
b17819
index 2094ab3..992abb2 100755
Tom Callaway da615e
--- a/util/libeay.num
Tom Callaway da615e
+++ b/util/libeay.num
Tom Callaway da615e
@@ -4370,7 +4370,7 @@ DH_compute_key_padded                   4732	EXIST::FUNCTION:DH
Tom Callaway da615e
 ECDSA_METHOD_set_sign                   4733	EXIST::FUNCTION:ECDSA
Tom Callaway da615e
 CMS_RecipientEncryptedKey_cert_cmp      4734	EXIST:!VMS:FUNCTION:CMS
Tom Callaway da615e
 CMS_RecipEncryptedKey_cert_cmp          4734	EXIST:VMS:FUNCTION:CMS
Tom Callaway da615e
-DH_KDF_X9_42                            4735	EXIST::FUNCTION:DH
Tom Callaway da615e
+DH_KDF_X9_42                            4735	EXIST::FUNCTION:CMS,DH
Tom Callaway da615e
 RSA_OAEP_PARAMS_free                    4736	EXIST::FUNCTION:RSA
Tom Callaway da615e
 EVP_des_ede3_wrap                       4737	EXIST::FUNCTION:DES
Tom Callaway da615e
 RSA_OAEP_PARAMS_it                      4738	EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RSA
Tom Callaway da615e
diff --git a/util/mkdef.pl b/util/mkdef.pl
b17819
index b9b159a..9841498 100755
Tom Callaway da615e
--- a/util/mkdef.pl
Tom Callaway da615e
+++ b/util/mkdef.pl
Tom Callaway da615e
@@ -97,6 +97,8 @@ my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF",
Tom Callaway da615e
 			 "FP_API", "STDIO", "SOCK", "KRB5", "DGRAM",
Tom Callaway da615e
 			 # Engines
Tom Callaway da615e
 			 "STATIC_ENGINE", "ENGINE", "HW", "GMP",
Tom Callaway da615e
+			 # X.509v3 Signed Certificate Timestamps
Tom Callaway da615e
+			 "SCT",
Tom Callaway da615e
 			 # RFC3779
Tom Callaway da615e
 			 "RFC3779",
Tom Callaway da615e
 			 # TLS
b17819
@@ -144,7 +146,7 @@ my $no_md2; my $no_md4; my $no_md5; my $no_sha; my $no_ripemd; my $no_mdc2;
Tom Callaway da615e
 my $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=0; my $no_aes; my $no_krb5;
Tom Callaway da615e
 my $no_ec; my $no_ecdsa; my $no_ecdh; my $no_engine; my $no_hw;
Tom Callaway da615e
 my $no_fp_api; my $no_static_engine=1; my $no_gmp; my $no_deprecated;
Tom Callaway da615e
-my $no_rfc3779; my $no_psk; my $no_tlsext; my $no_cms; my $no_capieng;
Tom Callaway da615e
+my $no_sct; my $no_rfc3779; my $no_psk; my $no_tlsext; my $no_cms; my $no_capieng;
Tom Callaway da615e
 my $no_jpake; my $no_srp; my $no_ssl2; my $no_ec2m; my $no_nistp_gcc; 
Tom Callaway da615e
 my $no_nextprotoneg; my $no_sctp; my $no_srtp; my $no_ssl_trace;
b17819
 my $no_unit_test; my $no_ssl3_method; my $no_ssl2_method;
b17819
@@ -235,6 +237,7 @@ foreach (@ARGV, split(/ /, $options))
Tom Callaway da615e
 	elsif (/^no-engine$/)	{ $no_engine=1; }
Tom Callaway da615e
 	elsif (/^no-hw$/)	{ $no_hw=1; }
Tom Callaway da615e
 	elsif (/^no-gmp$/)	{ $no_gmp=1; }
Tom Callaway da615e
+	elsif (/^no-sct$/)	{ $no_sct=1; }
Tom Callaway da615e
 	elsif (/^no-rfc3779$/)	{ $no_rfc3779=1; }
Tom Callaway da615e
 	elsif (/^no-tlsext$/)	{ $no_tlsext=1; }
Tom Callaway da615e
 	elsif (/^no-cms$/)	{ $no_cms=1; }
b17819
@@ -1209,6 +1212,7 @@ sub is_valid
Tom Callaway da615e
 			if ($keyword eq "FP_API" && $no_fp_api) { return 0; }
Tom Callaway da615e
 			if ($keyword eq "STATIC_ENGINE" && $no_static_engine) { return 0; }
Tom Callaway da615e
 			if ($keyword eq "GMP" && $no_gmp) { return 0; }
Tom Callaway da615e
+			if ($keyword eq "SCT" && $no_sct) { return 0; }
Tom Callaway da615e
 			if ($keyword eq "RFC3779" && $no_rfc3779) { return 0; }
Tom Callaway da615e
 			if ($keyword eq "TLSEXT" && $no_tlsext) { return 0; }
Tom Callaway da615e
 			if ($keyword eq "PSK" && $no_psk) { return 0; }
Tom Callaway da615e
diff --git a/util/mkerr.pl b/util/mkerr.pl
b17819
index c197f3a..97b295c 100644
Tom Callaway da615e
--- a/util/mkerr.pl
Tom Callaway da615e
+++ b/util/mkerr.pl
Tom Callaway da615e
@@ -89,7 +89,7 @@ Options:
Tom Callaway da615e
                   void ERR_load_<LIB>_strings(void);
Tom Callaway da615e
                   void ERR_unload_<LIB>_strings(void);
Tom Callaway da615e
                   void ERR_<LIB>_error(int f, int r, char *fn, int ln);
Tom Callaway da615e
-                  #define <LIB>err(f,r) ERR_<LIB>_error(f,r,__FILE__,__LINE__)
Tom Callaway da615e
+                  #define <LIB>err(f,r) ERR_<LIB>_error(f,r,OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
                 while the code facilitates the use of these in an environment
Tom Callaway da615e
                 where the error support routines are dynamically loaded at 
Tom Callaway da615e
                 runtime.
b17819
@@ -482,7 +482,7 @@ EOF
Tom Callaway da615e
 ${staticloader}void ERR_load_${lib}_strings(void);
Tom Callaway da615e
 ${staticloader}void ERR_unload_${lib}_strings(void);
Tom Callaway da615e
 ${staticloader}void ERR_${lib}_error(int function, int reason, char *file, int line);
Tom Callaway da615e
-# define ${lib}err(f,r) ERR_${lib}_error((f),(r),__FILE__,__LINE__)
Tom Callaway da615e
+# define ${lib}err(f,r) ERR_${lib}_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
Tom Callaway da615e
 
Tom Callaway da615e
 EOF
Tom Callaway da615e
 	}