1 diff --git a/Configure b/Configure
2 index 4a715dc..eb61eda 100755
5 @@ -1082,7 +1082,7 @@ if (defined($disabled{"tls1"}))
8 if (defined($disabled{"ec"}) || defined($disabled{"dsa"})
9 - || defined($disabled{"dh"}))
10 + || defined($disabled{"dh"}) || defined($disabled{"stdio"}))
12 $disabled{"gost"} = "forced";
14 diff --git a/crypto/asn1/a_strex.c b/crypto/asn1/a_strex.c
15 index 35fd44c..9f39bff 100644
16 --- a/crypto/asn1/a_strex.c
17 +++ b/crypto/asn1/a_strex.c
18 @@ -104,6 +104,7 @@ static int send_bio_chars(void *arg, const void *buf, int len)
22 +#ifndef OPENSSL_NO_FP_API
23 static int send_fp_chars(void *arg, const void *buf, int len)
26 @@ -112,6 +113,7 @@ static int send_fp_chars(void *arg, const void *buf, int len)
32 typedef int char_io (void *arg, const void *buf, int len);
34 diff --git a/crypto/conf/conf.h b/crypto/conf/conf.h
35 index 8d926d5..41cf38e 100644
36 --- a/crypto/conf/conf.h
37 +++ b/crypto/conf/conf.h
38 @@ -118,8 +118,10 @@ typedef void conf_finish_func (CONF_IMODULE *md);
40 int CONF_set_default_method(CONF_METHOD *meth);
41 void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash);
42 +# ifndef OPENSSL_NO_STDIO
43 LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file,
46 # ifndef OPENSSL_NO_FP_API
47 LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp,
49 @@ -133,7 +135,9 @@ char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group,
50 long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group,
52 void CONF_free(LHASH_OF(CONF_VALUE) *conf);
53 +#ifndef OPENSSL_NO_FP_API
54 int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out);
56 int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out);
58 void OPENSSL_config(const char *config_name);
59 @@ -160,7 +164,9 @@ CONF_METHOD *NCONF_XML(void);
60 void NCONF_free(CONF *conf);
61 void NCONF_free_data(CONF *conf);
63 +# ifndef OPENSSL_NO_STDIO
64 int NCONF_load(CONF *conf, const char *file, long *eline);
66 # ifndef OPENSSL_NO_FP_API
67 int NCONF_load_fp(CONF *conf, FILE *fp, long *eline);
69 @@ -170,7 +176,9 @@ STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,
70 char *NCONF_get_string(const CONF *conf, const char *group, const char *name);
71 int NCONF_get_number_e(const CONF *conf, const char *group, const char *name,
73 +#ifndef OPENSSL_NO_FP_API
74 int NCONF_dump_fp(const CONF *conf, FILE *out);
76 int NCONF_dump_bio(const CONF *conf, BIO *out);
78 # if 0 /* The following function has no error
79 @@ -184,8 +192,10 @@ long NCONF_get_number(CONF *conf, char *group, char *name);
81 int CONF_modules_load(const CONF *cnf, const char *appname,
83 +#ifndef OPENSSL_NO_STDIO
84 int CONF_modules_load_file(const char *filename, const char *appname,
87 void CONF_modules_unload(int all);
88 void CONF_modules_finish(void);
89 void CONF_modules_free(void);
90 diff --git a/crypto/conf/conf_def.c b/crypto/conf/conf_def.c
91 index 68c77ce..3d308c7 100644
92 --- a/crypto/conf/conf_def.c
93 +++ b/crypto/conf/conf_def.c
94 @@ -182,6 +182,10 @@ static int def_destroy_data(CONF *conf)
96 static int def_load(CONF *conf, const char *name, long *line)
98 +#ifdef OPENSSL_NO_STDIO
99 + CONFerr(CONF_F_DEF_LOAD, ERR_R_SYS_LIB);
105 @@ -202,6 +206,7 @@ static int def_load(CONF *conf, const char *name, long *line)
112 static int def_load_bio(CONF *conf, BIO *in, long *line)
113 diff --git a/crypto/conf/conf_lib.c b/crypto/conf/conf_lib.c
114 index 5281384..952b545 100644
115 --- a/crypto/conf/conf_lib.c
116 +++ b/crypto/conf/conf_lib.c
117 @@ -90,6 +90,7 @@ int CONF_set_default_method(CONF_METHOD *meth)
121 +#ifndef OPENSSL_NO_STDIO
122 LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file,
125 @@ -111,6 +112,7 @@ LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file,
131 #ifndef OPENSSL_NO_FP_API
132 LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp,
133 @@ -255,6 +257,7 @@ void NCONF_free_data(CONF *conf)
134 conf->meth->destroy_data(conf);
137 +#ifndef OPENSSL_NO_STDIO
138 int NCONF_load(CONF *conf, const char *file, long *eline)
141 @@ -264,6 +267,7 @@ int NCONF_load(CONF *conf, const char *file, long *eline)
143 return conf->meth->load(conf, file, eline);
147 #ifndef OPENSSL_NO_FP_API
148 int NCONF_load_fp(CONF *conf, FILE *fp, long *eline)
149 diff --git a/crypto/conf/conf_mod.c b/crypto/conf/conf_mod.c
150 index 9acfca4..5e0a482 100644
151 --- a/crypto/conf/conf_mod.c
152 +++ b/crypto/conf/conf_mod.c
153 @@ -159,6 +159,7 @@ int CONF_modules_load(const CONF *cnf, const char *appname,
157 +#ifndef OPENSSL_NO_STDIO
158 int CONF_modules_load_file(const char *filename, const char *appname,
161 @@ -194,6 +195,7 @@ int CONF_modules_load_file(const char *filename, const char *appname,
167 static int module_run(const CONF *cnf, char *name, char *value,
169 diff --git a/crypto/conf/conf_sap.c b/crypto/conf/conf_sap.c
170 index c042cf2..a25b636 100644
171 --- a/crypto/conf/conf_sap.c
172 +++ b/crypto/conf/conf_sap.c
173 @@ -87,9 +87,11 @@ void OPENSSL_config(const char *config_name)
174 ENGINE_load_builtin_engines();
177 +#ifndef OPENSSL_NO_STDIO
178 CONF_modules_load_file(NULL, config_name,
179 CONF_MFLAGS_DEFAULT_SECTION |
180 CONF_MFLAGS_IGNORE_MISSING_FILE);
182 openssl_configured = 1;
185 diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c
186 index c9f674b..e223118 100644
187 --- a/crypto/cryptlib.c
188 +++ b/crypto/cryptlib.c
189 @@ -670,6 +670,7 @@ unsigned long *OPENSSL_ia32cap_loc(void)
192 # if defined(OPENSSL_CPUID_OBJ) && !defined(OPENSSL_NO_ASM) && !defined(I386_ONLY)
194 # define OPENSSL_CPUID_SETUP
196 typedef unsigned __int64 IA32CAP;
197 @@ -980,11 +981,13 @@ void OPENSSL_showfatal(const char *fmta, ...)
199 void OPENSSL_showfatal(const char *fmta, ...)
201 +#ifndef OPENSSL_NO_STDIO
205 vfprintf(stderr, fmta, ap);
210 int OPENSSL_isservice(void)
211 @@ -1011,10 +1014,12 @@ void OpenSSLDie(const char *file, int line, const char *assertion)
215 +#ifndef OPENSSL_NO_STDIO
216 void *OPENSSL_stderr(void)
222 int CRYPTO_memcmp(const void *in_a, const void *in_b, size_t len)
224 diff --git a/crypto/cryptlib.h b/crypto/cryptlib.h
225 index fba180a..3e3ea5e 100644
226 --- a/crypto/cryptlib.h
227 +++ b/crypto/cryptlib.h
228 @@ -101,7 +101,9 @@ extern "C" {
229 void OPENSSL_cpuid_setup(void);
230 extern unsigned int OPENSSL_ia32cap_P[];
231 void OPENSSL_showfatal(const char *fmta, ...);
232 +#ifndef OPENSSL_NO_STDIO
233 void *OPENSSL_stderr(void);
235 extern int OPENSSL_NONPIC_relocated;
238 diff --git a/crypto/crypto.h b/crypto/crypto.h
239 index c450d7a..d6e804e 100644
240 --- a/crypto/crypto.h
241 +++ b/crypto/crypto.h
242 @@ -235,15 +235,15 @@ typedef struct openssl_item_st {
243 # ifndef OPENSSL_NO_LOCKING
244 # ifndef CRYPTO_w_lock
245 # define CRYPTO_w_lock(type) \
246 - CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
247 + CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,NULL,0)
248 # define CRYPTO_w_unlock(type) \
249 - CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
250 + CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,NULL,0)
251 # define CRYPTO_r_lock(type) \
252 - CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__)
253 + CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,NULL,0)
254 # define CRYPTO_r_unlock(type) \
255 - CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__)
256 + CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,NULL,0)
257 # define CRYPTO_add(addr,amount,type) \
258 - CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__)
259 + CRYPTO_add_lock(addr,amount,type,NULL,0)
262 # define CRYPTO_w_lock(a)
263 @@ -378,19 +378,19 @@ int CRYPTO_is_mem_check_on(void);
264 # define MemCheck_off() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE)
265 # define is_MemCheck_on() CRYPTO_is_mem_check_on()
267 -# define OPENSSL_malloc(num) CRYPTO_malloc((int)num,__FILE__,__LINE__)
268 -# define OPENSSL_strdup(str) CRYPTO_strdup((str),__FILE__,__LINE__)
269 +# define OPENSSL_malloc(num) CRYPTO_malloc((int)num,NULL,0)
270 +# define OPENSSL_strdup(str) CRYPTO_strdup((str),NULL,0)
271 # define OPENSSL_realloc(addr,num) \
272 - CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__)
273 + CRYPTO_realloc((char *)addr,(int)num,NULL,0)
274 # define OPENSSL_realloc_clean(addr,old_num,num) \
275 - CRYPTO_realloc_clean(addr,old_num,num,__FILE__,__LINE__)
276 + CRYPTO_realloc_clean(addr,old_num,num,NULL,0)
277 # define OPENSSL_remalloc(addr,num) \
278 - CRYPTO_remalloc((char **)addr,(int)num,__FILE__,__LINE__)
279 + CRYPTO_remalloc((char **)addr,(int)num,NULL,0)
280 # define OPENSSL_freeFunc CRYPTO_free
281 # define OPENSSL_free(addr) CRYPTO_free(addr)
283 # define OPENSSL_malloc_locked(num) \
284 - CRYPTO_malloc_locked((int)num,__FILE__,__LINE__)
285 + CRYPTO_malloc_locked((int)num,NULL,0)
286 # define OPENSSL_free_locked(addr) CRYPTO_free_locked(addr)
288 const char *SSLeay_version(int type);
289 @@ -545,7 +545,7 @@ void CRYPTO_set_mem_debug_options(long bits);
290 long CRYPTO_get_mem_debug_options(void);
292 # define CRYPTO_push_info(info) \
293 - CRYPTO_push_info_(info, __FILE__, __LINE__);
294 + CRYPTO_push_info_(info, NULL, 0);
295 int CRYPTO_push_info_(const char *info, const char *file, int line);
296 int CRYPTO_pop_info(void);
297 int CRYPTO_remove_all_info(void);
298 @@ -588,7 +588,7 @@ void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb);
300 /* die if we have to */
301 void OpenSSLDie(const char *file, int line, const char *assertion);
302 -# define OPENSSL_assert(e) (void)((e) ? 0 : (OpenSSLDie(__FILE__, __LINE__, #e),1))
303 +# define OPENSSL_assert(e) (void)((e) ? 0 : (OpenSSLDie(NULL, 0, #e),1))
305 unsigned long *OPENSSL_ia32cap_loc(void);
306 # define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc()))
307 @@ -605,14 +605,14 @@ void OPENSSL_init(void);
308 # define fips_md_init_ctx(alg, cx) \
309 int alg##_Init(cx##_CTX *c) \
311 - if (FIPS_mode()) OpenSSLDie(__FILE__, __LINE__, \
312 + if (FIPS_mode()) OpenSSLDie(NULL, 0, \
313 "Low level API call to digest " #alg " forbidden in FIPS mode!"); \
314 return private_##alg##_Init(c); \
316 int private_##alg##_Init(cx##_CTX *c)
318 # define fips_cipher_abort(alg) \
319 - if (FIPS_mode()) OpenSSLDie(__FILE__, __LINE__, \
320 + if (FIPS_mode()) OpenSSLDie(NULL, 0, \
321 "Low level API call to cipher " #alg " forbidden in FIPS mode!")
324 diff --git a/crypto/des/read2pwd.c b/crypto/des/read2pwd.c
325 index 01e275f..7633139 100644
326 --- a/crypto/des/read2pwd.c
327 +++ b/crypto/des/read2pwd.c
329 #include <openssl/ui.h>
330 #include <openssl/crypto.h>
336 int DES_read_password(DES_cblock *key, const char *prompt, int verify)
339 diff --git a/crypto/dh/dh_pmeth.c b/crypto/dh/dh_pmeth.c
340 index b58e3fa..e5f345a 100644
341 --- a/crypto/dh/dh_pmeth.c
342 +++ b/crypto/dh/dh_pmeth.c
343 @@ -449,6 +449,9 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned char *key,
346 } else if (dctx->kdf_type == EVP_PKEY_DH_KDF_X9_42) {
347 +#ifdef OPENSSL_NO_CMS
350 unsigned char *Z = NULL;
352 if (!dctx->kdf_outlen || !dctx->kdf_oid)
353 @@ -478,6 +481,7 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned char *key,
361 diff --git a/crypto/engine/eng_openssl.c b/crypto/engine/eng_openssl.c
362 index 34b0029..cf622bb 100644
363 --- a/crypto/engine/eng_openssl.c
364 +++ b/crypto/engine/eng_openssl.c
366 * this is no longer automatic in ENGINE_load_builtin_engines().
368 #define TEST_ENG_OPENSSL_RC4
369 +#ifndef OPENSSL_NO_FP_API
370 #define TEST_ENG_OPENSSL_PKEY
372 /* #define TEST_ENG_OPENSSL_RC4_OTHERS */
373 #define TEST_ENG_OPENSSL_RC4_P_INIT
374 /* #define TEST_ENG_OPENSSL_RC4_P_CIPHER */
375 diff --git a/crypto/pem/pem.h b/crypto/pem/pem.h
376 index d3b23fc..87b0b6a 100644
377 --- a/crypto/pem/pem.h
378 +++ b/crypto/pem/pem.h
379 @@ -324,6 +324,7 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
381 # define DECLARE_PEM_read_fp(name, type) /**/
382 # define DECLARE_PEM_write_fp(name, type) /**/
383 +# define DECLARE_PEM_write_fp_const(name, type) /**/
384 # define DECLARE_PEM_write_cb_fp(name, type) /**/
387 @@ -417,6 +418,7 @@ int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc,
388 pem_password_cb *cd, void *u);
391 +#ifndef OPENSSL_NO_FP_API
392 int PEM_read(FILE *fp, char **name, char **header,
393 unsigned char **data, long *len);
394 int PEM_write(FILE *fp, const char *name, const char *hdr,
395 @@ -428,6 +430,7 @@ int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp,
396 int klen, pem_password_cb *callback, void *u);
397 STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk,
398 pem_password_cb *cb, void *u);
401 int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type,
402 EVP_MD *md_type, unsigned char **ek, int *ekl,
403 @@ -494,6 +497,7 @@ int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid,
404 EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb,
407 +#ifndef OPENSSL_NO_FP_API
408 int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
409 char *kstr, int klen,
410 pem_password_cb *cb, void *u);
411 @@ -510,7 +514,7 @@ EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb,
412 int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
413 char *kstr, int klen, pem_password_cb *cd,
417 EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x);
418 int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x);
420 diff --git a/crypto/pem/pem_pk8.c b/crypto/pem/pem_pk8.c
421 index 5747c73..fe465cc 100644
422 --- a/crypto/pem/pem_pk8.c
423 +++ b/crypto/pem/pem_pk8.c
425 static int do_pk8pkey(BIO *bp, EVP_PKEY *x, int isder,
426 int nid, const EVP_CIPHER *enc,
427 char *kstr, int klen, pem_password_cb *cb, void *u);
429 +#ifndef OPENSSL_NO_FP_API
430 static int do_pk8pkey_fp(FILE *bp, EVP_PKEY *x, int isder,
431 int nid, const EVP_CIPHER *enc,
432 char *kstr, int klen, pem_password_cb *cb, void *u);
436 * These functions write a private key in PKCS#8 format: it is a "drop in"
437 * replacement for PEM_write_bio_PrivateKey() and friends. As usual if 'enc'
438 diff --git a/crypto/pkcs7/pk7_smime.c b/crypto/pkcs7/pk7_smime.c
439 index c4d3724..fd531c9 100644
440 --- a/crypto/pkcs7/pk7_smime.c
441 +++ b/crypto/pkcs7/pk7_smime.c
442 @@ -254,7 +254,8 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
443 STACK_OF(PKCS7_SIGNER_INFO) *sinfos;
444 PKCS7_SIGNER_INFO *si;
445 X509_STORE_CTX cert_ctx;
449 int i, j = 0, k, ret = 0;
451 BIO *tmpin = NULL, *tmpout = NULL;
452 @@ -274,12 +275,29 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
453 PKCS7err(PKCS7_F_PKCS7_VERIFY, PKCS7_R_NO_CONTENT);
458 + * NB: this test commented out because some versions of Netscape
459 + * illegally include zero length content when signing data. Also
460 + * Microsoft Authenticode includes a SpcIndirectDataContent data
461 + * structure which describes the content to be protected by the
462 + * signature, rather than directly embedding that content. So
463 + * Authenticode implementations are also expected to use
464 + * PKCS7_verify() with explicit external data, on non-detached
465 + * PKCS#7 signatures.
467 + * In OpenSSL 1.1 a new flag PKCS7_NO_DUAL_CONTENT has been
468 + * introduced to disable this sanity check. For the 1.0.2 branch
469 + * this change is not acceptable, so the check remains completely
470 + * commented out (as it has been for a long time).
473 /* Check for data and content: two sets of data */
474 if (!PKCS7_get_detached(p7) && indata) {
475 PKCS7err(PKCS7_F_PKCS7_VERIFY, PKCS7_R_CONTENT_AND_DATA_PRESENT);
480 sinfos = PKCS7_get_signer_info(p7);
482 @@ -355,9 +373,14 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
487 + buf = OPENSSL_malloc(bufsiz);
491 /* We now have to 'read' from p7bio to calculate digests etc. */
493 - i = BIO_read(p7bio, buf, sizeof(buf));
494 + i = BIO_read(p7bio, buf, bufsiz);
498 @@ -394,6 +417,9 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
501 sk_X509_free(signers);
508 diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c
509 index 266111e..f60fac6 100644
510 --- a/crypto/rand/rand_unix.c
511 +++ b/crypto/rand/rand_unix.c
513 #include <openssl/rand.h>
514 #include "rand_lcl.h"
516 -#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))
517 +#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))
519 # include <sys/types.h>
520 # include <sys/time.h>
521 @@ -439,7 +439,7 @@ int RAND_poll(void)
522 * defined(OPENSSL_SYS_VXWORKS) ||
523 * defined(OPENSSL_SYS_NETWARE)) */
525 -#if defined(OPENSSL_SYS_VXWORKS)
526 +#if defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_UEFI)
530 diff --git a/crypto/rsa/rsa_ameth.c b/crypto/rsa/rsa_ameth.c
531 index 4e06218..f591f0f 100644
532 --- a/crypto/rsa/rsa_ameth.c
533 +++ b/crypto/rsa/rsa_ameth.c
536 #include "asn1_locl.h"
538 +#ifndef OPENSSL_NO_CMS
539 static int rsa_cms_sign(CMS_SignerInfo *si);
540 static int rsa_cms_verify(CMS_SignerInfo *si);
541 static int rsa_cms_decrypt(CMS_RecipientInfo *ri);
542 static int rsa_cms_encrypt(CMS_RecipientInfo *ri);
545 static int rsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
547 @@ -665,6 +667,7 @@ static int rsa_pss_to_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pkctx,
551 +#ifndef OPENSSL_NO_CMS
552 static int rsa_cms_verify(CMS_SignerInfo *si)
555 @@ -683,6 +686,7 @@ static int rsa_cms_verify(CMS_SignerInfo *si)
562 * Customised RSA item verification routine. This is called when a signature
563 @@ -705,6 +709,7 @@ static int rsa_item_verify(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
567 +#ifndef OPENSSL_NO_CMS
568 static int rsa_cms_sign(CMS_SignerInfo *si)
570 int pad_mode = RSA_PKCS1_PADDING;
571 @@ -729,6 +734,7 @@ static int rsa_cms_sign(CMS_SignerInfo *si)
572 X509_ALGOR_set0(alg, OBJ_nid2obj(NID_rsassaPss), V_ASN1_SEQUENCE, os);
577 static int rsa_item_sign(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
578 X509_ALGOR *alg1, X509_ALGOR *alg2,
579 @@ -785,6 +791,7 @@ static RSA_OAEP_PARAMS *rsa_oaep_decode(const X509_ALGOR *alg,
583 +#ifndef OPENSSL_NO_CMS
584 static int rsa_cms_decrypt(CMS_RecipientInfo *ri)
587 @@ -857,7 +864,9 @@ static int rsa_cms_decrypt(CMS_RecipientInfo *ri)
588 X509_ALGOR_free(maskHash);
593 +#ifndef OPENSSL_NO_CMS
594 static int rsa_cms_encrypt(CMS_RecipientInfo *ri)
596 const EVP_MD *md, *mgf1md;
597 @@ -920,6 +929,7 @@ static int rsa_cms_encrypt(CMS_RecipientInfo *ri)
598 ASN1_STRING_free(os);
603 const EVP_PKEY_ASN1_METHOD rsa_asn1_meths[] = {
605 diff --git a/crypto/srp/srp.h b/crypto/srp/srp.h
606 index d072536..73b945f 100644
607 --- a/crypto/srp/srp.h
608 +++ b/crypto/srp/srp.h
609 @@ -114,7 +114,9 @@ DECLARE_STACK_OF(SRP_gN)
611 SRP_VBASE *SRP_VBASE_new(char *seed_key);
612 int SRP_VBASE_free(SRP_VBASE *vb);
613 +#ifndef OPENSSL_NO_STDIO
614 int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file);
616 SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username);
617 char *SRP_create_verifier(const char *user, const char *pass, char **salt,
618 char **verifier, const char *N, const char *g);
619 diff --git a/crypto/srp/srp_vfy.c b/crypto/srp/srp_vfy.c
620 index a3f1a8a..3fbb186 100644
621 --- a/crypto/srp/srp_vfy.c
622 +++ b/crypto/srp/srp_vfy.c
623 @@ -225,6 +225,7 @@ static int SRP_user_pwd_set_ids(SRP_user_pwd *vinfo, const char *id,
624 return (info == NULL || NULL != (vinfo->info = BUF_strdup(info)));
627 +#ifndef OPENSSL_NO_STDIO
628 static int SRP_user_pwd_set_sv(SRP_user_pwd *vinfo, const char *s,
631 @@ -239,6 +240,7 @@ static int SRP_user_pwd_set_sv(SRP_user_pwd *vinfo, const char *s,
632 len = t_fromb64(tmp, s);
633 return ((vinfo->s = BN_bin2bn(tmp, len, NULL)) != NULL);
637 static int SRP_user_pwd_set_sv_BN(SRP_user_pwd *vinfo, BIGNUM *s, BIGNUM *v)
639 @@ -279,6 +281,7 @@ int SRP_VBASE_free(SRP_VBASE *vb)
643 +#ifndef OPENSSL_NO_STDIO
644 static SRP_gN_cache *SRP_gN_new_init(const char *ch)
646 unsigned char tmp[MAX_LEN];
647 @@ -310,6 +313,7 @@ static void SRP_gN_free(SRP_gN_cache *gN_cache)
648 BN_free(gN_cache->bn);
649 OPENSSL_free(gN_cache);
653 static SRP_gN *SRP_get_gN_by_id(const char *id, STACK_OF(SRP_gN) *gN_tab)
655 @@ -326,6 +330,7 @@ static SRP_gN *SRP_get_gN_by_id(const char *id, STACK_OF(SRP_gN) *gN_tab)
656 return SRP_get_default_gN(id);
659 +#ifndef OPENSSL_NO_STDIO
660 static BIGNUM *SRP_gN_place_bn(STACK_OF(SRP_gN_cache) *gN_cache, char *ch)
663 @@ -467,6 +472,7 @@ int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file)
669 SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username)
671 diff --git a/crypto/ts/ts.h b/crypto/ts/ts.h
672 index 16eccbb..a9fe40e 100644
675 @@ -281,8 +281,10 @@ TS_REQ *d2i_TS_REQ(TS_REQ **a, const unsigned char **pp, long length);
677 TS_REQ *TS_REQ_dup(TS_REQ *a);
679 +#ifndef OPENSSL_NO_FP_API
680 TS_REQ *d2i_TS_REQ_fp(FILE *fp, TS_REQ **a);
681 int i2d_TS_REQ_fp(FILE *fp, TS_REQ *a);
683 TS_REQ *d2i_TS_REQ_bio(BIO *fp, TS_REQ **a);
684 int i2d_TS_REQ_bio(BIO *fp, TS_REQ *a);
686 @@ -294,10 +296,12 @@ TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a,
688 TS_MSG_IMPRINT *TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT *a);
690 +#ifndef OPENSSL_NO_FP_API
691 TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT **a);
692 int i2d_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT *a);
693 -TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *fp, TS_MSG_IMPRINT **a);
694 -int i2d_TS_MSG_IMPRINT_bio(BIO *fp, TS_MSG_IMPRINT *a);
696 +TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT **a);
697 +int i2d_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT *a);
699 TS_RESP *TS_RESP_new(void);
700 void TS_RESP_free(TS_RESP *a);
701 @@ -306,10 +310,12 @@ TS_RESP *d2i_TS_RESP(TS_RESP **a, const unsigned char **pp, long length);
702 TS_TST_INFO *PKCS7_to_TS_TST_INFO(PKCS7 *token);
703 TS_RESP *TS_RESP_dup(TS_RESP *a);
705 +#ifndef OPENSSL_NO_FP_API
706 TS_RESP *d2i_TS_RESP_fp(FILE *fp, TS_RESP **a);
707 int i2d_TS_RESP_fp(FILE *fp, TS_RESP *a);
708 -TS_RESP *d2i_TS_RESP_bio(BIO *fp, TS_RESP **a);
709 -int i2d_TS_RESP_bio(BIO *fp, TS_RESP *a);
711 +TS_RESP *d2i_TS_RESP_bio(BIO *bio, TS_RESP **a);
712 +int i2d_TS_RESP_bio(BIO *bio, TS_RESP *a);
714 TS_STATUS_INFO *TS_STATUS_INFO_new(void);
715 void TS_STATUS_INFO_free(TS_STATUS_INFO *a);
716 @@ -325,10 +331,12 @@ TS_TST_INFO *d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **pp,
718 TS_TST_INFO *TS_TST_INFO_dup(TS_TST_INFO *a);
720 +#ifndef OPENSSL_NO_FP_API
721 TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a);
722 int i2d_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO *a);
723 -TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *fp, TS_TST_INFO **a);
724 -int i2d_TS_TST_INFO_bio(BIO *fp, TS_TST_INFO *a);
726 +TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO **a);
727 +int i2d_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO *a);
729 TS_ACCURACY *TS_ACCURACY_new(void);
730 void TS_ACCURACY_free(TS_ACCURACY *a);
731 @@ -728,15 +736,18 @@ int TS_MSG_IMPRINT_print_bio(BIO *bio, TS_MSG_IMPRINT *msg);
735 +#ifndef OPENSSL_NO_STDIO
736 X509 *TS_CONF_load_cert(const char *file);
737 STACK_OF(X509) *TS_CONF_load_certs(const char *file);
738 EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass);
740 const char *TS_CONF_get_tsa_section(CONF *conf, const char *section);
741 int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb,
743 int TS_CONF_set_crypto_device(CONF *conf, const char *section,
745 int TS_CONF_set_default_engine(const char *name);
746 +#ifndef OPENSSL_NO_STDIO
747 int TS_CONF_set_signer_cert(CONF *conf, const char *section,
748 const char *cert, TS_RESP_CTX *ctx);
749 int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs,
750 @@ -744,6 +755,7 @@ int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs,
751 int TS_CONF_set_signer_key(CONF *conf, const char *section,
752 const char *key, const char *pass,
755 int TS_CONF_set_def_policy(CONF *conf, const char *section,
756 const char *policy, TS_RESP_CTX *ctx);
757 int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx);
758 @@ -784,6 +796,11 @@ void ERR_load_TS_strings(void);
759 # define TS_F_TS_CHECK_SIGNING_CERTS 103
760 # define TS_F_TS_CHECK_STATUS_INFO 104
761 # define TS_F_TS_COMPUTE_IMPRINT 145
762 +# define TS_F_TS_CONF_INVALID 151
763 +# define TS_F_TS_CONF_LOAD_CERT 153
764 +# define TS_F_TS_CONF_LOAD_CERTS 154
765 +# define TS_F_TS_CONF_LOAD_KEY 155
766 +# define TS_F_TS_CONF_LOOKUP_FAIL 152
767 # define TS_F_TS_CONF_SET_DEFAULT_ENGINE 146
768 # define TS_F_TS_GET_STATUS_TEXT 105
769 # define TS_F_TS_MSG_IMPRINT_SET_ALGO 118
770 @@ -822,6 +839,8 @@ void ERR_load_TS_strings(void);
772 # define TS_R_BAD_PKCS7_TYPE 132
773 # define TS_R_BAD_TYPE 133
774 +# define TS_R_CANNOT_LOAD_CERT 137
775 +# define TS_R_CANNOT_LOAD_KEY 138
776 # define TS_R_CERTIFICATE_VERIFY_ERROR 100
777 # define TS_R_COULD_NOT_SET_ENGINE 127
778 # define TS_R_COULD_NOT_SET_TIME 115
779 @@ -854,6 +873,8 @@ void ERR_load_TS_strings(void);
780 # define TS_R_UNACCEPTABLE_POLICY 125
781 # define TS_R_UNSUPPORTED_MD_ALGORITHM 126
782 # define TS_R_UNSUPPORTED_VERSION 113
783 +# define TS_R_VAR_BAD_VALUE 135
784 +# define TS_R_VAR_LOOKUP_FAILURE 136
785 # define TS_R_WRONG_CONTENT_TYPE 114
788 diff --git a/crypto/ts/ts_conf.c b/crypto/ts/ts_conf.c
789 index 4716b23..c4416ba 100644
790 --- a/crypto/ts/ts_conf.c
791 +++ b/crypto/ts/ts_conf.c
794 /* Function definitions for certificate and key loading. */
796 +#ifndef OPENSSL_NO_STDIO
797 X509 *TS_CONF_load_cert(const char *file)
800 @@ -102,7 +103,7 @@ X509 *TS_CONF_load_cert(const char *file)
801 x = PEM_read_bio_X509_AUX(cert, NULL, NULL, NULL);
804 - fprintf(stderr, "unable to load certificate: %s\n", file);
805 + TSerr(TS_F_TS_CONF_LOAD_CERT, TS_R_CANNOT_LOAD_CERT);
809 @@ -129,7 +130,7 @@ STACK_OF(X509) *TS_CONF_load_certs(const char *file)
812 if (othercerts == NULL)
813 - fprintf(stderr, "unable to load certificates: %s\n", file);
814 + TSerr(TS_F_TS_CONF_LOAD_CERTS, TS_R_CANNOT_LOAD_CERT);
815 sk_X509_INFO_pop_free(allcerts, X509_INFO_free);
818 @@ -145,21 +146,24 @@ EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass)
819 pkey = PEM_read_bio_PrivateKey(key, NULL, NULL, (char *)pass);
822 - fprintf(stderr, "unable to load private key: %s\n", file);
823 + TSerr(TS_F_TS_CONF_LOAD_KEY, TS_R_CANNOT_LOAD_KEY);
827 +#endif /* !OPENSSL_NO_STDIO */
829 /* Function definitions for handling configuration options. */
831 static void TS_CONF_lookup_fail(const char *name, const char *tag)
833 - fprintf(stderr, "variable lookup failed for %s::%s\n", name, tag);
834 + TSerr(TS_F_TS_CONF_LOOKUP_FAIL, TS_R_VAR_LOOKUP_FAILURE);
835 + ERR_add_error_data(3, name, "::", tag);
838 static void TS_CONF_invalid(const char *name, const char *tag)
840 - fprintf(stderr, "invalid variable value for %s::%s\n", name, tag);
841 + TSerr(TS_F_TS_CONF_INVALID, TS_R_VAR_BAD_VALUE);
842 + ERR_add_error_data(3, name, "::", tag);
845 const char *TS_CONF_get_tsa_section(CONF *conf, const char *section)
846 @@ -237,6 +241,7 @@ int TS_CONF_set_default_engine(const char *name)
850 +#ifndef OPENSSL_NO_STDIO
851 int TS_CONF_set_signer_cert(CONF *conf, const char *section,
852 const char *cert, TS_RESP_CTX *ctx)
854 @@ -302,6 +307,7 @@ int TS_CONF_set_signer_key(CONF *conf, const char *section,
855 EVP_PKEY_free(key_obj);
858 +#endif /* !OPENSSL_NO_STDIO */
860 int TS_CONF_set_def_policy(CONF *conf, const char *section,
861 const char *policy, TS_RESP_CTX *ctx)
862 diff --git a/crypto/ts/ts_err.c b/crypto/ts/ts_err.c
863 index ff1abf4..3f5b78f 100644
864 --- a/crypto/ts/ts_err.c
865 +++ b/crypto/ts/ts_err.c
867 /* crypto/ts/ts_err.c */
868 /* ====================================================================
869 - * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
870 + * Copyright (c) 1999-2015 The OpenSSL Project. All rights reserved.
872 * Redistribution and use in source and binary forms, with or without
873 * modification, are permitted provided that the following conditions
874 @@ -87,6 +87,11 @@ static ERR_STRING_DATA TS_str_functs[] = {
875 {ERR_FUNC(TS_F_TS_CHECK_SIGNING_CERTS), "TS_CHECK_SIGNING_CERTS"},
876 {ERR_FUNC(TS_F_TS_CHECK_STATUS_INFO), "TS_CHECK_STATUS_INFO"},
877 {ERR_FUNC(TS_F_TS_COMPUTE_IMPRINT), "TS_COMPUTE_IMPRINT"},
878 + {ERR_FUNC(TS_F_TS_CONF_INVALID), "ts_CONF_invalid"},
879 + {ERR_FUNC(TS_F_TS_CONF_LOAD_CERT), "TS_CONF_load_cert"},
880 + {ERR_FUNC(TS_F_TS_CONF_LOAD_CERTS), "TS_CONF_load_certs"},
881 + {ERR_FUNC(TS_F_TS_CONF_LOAD_KEY), "TS_CONF_load_key"},
882 + {ERR_FUNC(TS_F_TS_CONF_LOOKUP_FAIL), "ts_CONF_lookup_fail"},
883 {ERR_FUNC(TS_F_TS_CONF_SET_DEFAULT_ENGINE), "TS_CONF_set_default_engine"},
884 {ERR_FUNC(TS_F_TS_GET_STATUS_TEXT), "TS_GET_STATUS_TEXT"},
885 {ERR_FUNC(TS_F_TS_MSG_IMPRINT_SET_ALGO), "TS_MSG_IMPRINT_set_algo"},
886 @@ -132,6 +137,8 @@ static ERR_STRING_DATA TS_str_functs[] = {
887 static ERR_STRING_DATA TS_str_reasons[] = {
888 {ERR_REASON(TS_R_BAD_PKCS7_TYPE), "bad pkcs7 type"},
889 {ERR_REASON(TS_R_BAD_TYPE), "bad type"},
890 + {ERR_REASON(TS_R_CANNOT_LOAD_CERT), "cannot load certificate"},
891 + {ERR_REASON(TS_R_CANNOT_LOAD_KEY), "cannot load private key"},
892 {ERR_REASON(TS_R_CERTIFICATE_VERIFY_ERROR), "certificate verify error"},
893 {ERR_REASON(TS_R_COULD_NOT_SET_ENGINE), "could not set engine"},
894 {ERR_REASON(TS_R_COULD_NOT_SET_TIME), "could not set time"},
895 @@ -170,6 +177,8 @@ static ERR_STRING_DATA TS_str_reasons[] = {
896 {ERR_REASON(TS_R_UNACCEPTABLE_POLICY), "unacceptable policy"},
897 {ERR_REASON(TS_R_UNSUPPORTED_MD_ALGORITHM), "unsupported md algorithm"},
898 {ERR_REASON(TS_R_UNSUPPORTED_VERSION), "unsupported version"},
899 + {ERR_REASON(TS_R_VAR_BAD_VALUE), "var bad value"},
900 + {ERR_REASON(TS_R_VAR_LOOKUP_FAILURE), "cannot find config variable"},
901 {ERR_REASON(TS_R_WRONG_CONTENT_TYPE), "wrong content type"},
904 diff --git a/crypto/ui/ui_util.c b/crypto/ui/ui_util.c
905 index 0f29011..80dd40e 100644
906 --- a/crypto/ui/ui_util.c
907 +++ b/crypto/ui/ui_util.c
916 int UI_UTIL_read_pw_string(char *buf, int length, const char *prompt,
919 diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c
920 index 9ee8f8d..64b052e 100644
921 --- a/crypto/x509/by_dir.c
922 +++ b/crypto/x509/by_dir.c
924 # include <sys/stat.h>
927 +#ifndef OPENSSL_NO_STDIO
929 #include <openssl/lhash.h>
930 #include <openssl/x509.h>
932 @@ -434,3 +436,5 @@ static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
937 +#endif /* OPENSSL_NO_STDIO */
938 diff --git a/crypto/x509/x509_vfy.c b/crypto/x509/x509_vfy.c
939 index 0429767..7ddc21c 100644
940 --- a/crypto/x509/x509_vfy.c
941 +++ b/crypto/x509/x509_vfy.c
942 @@ -940,6 +940,8 @@ static int check_crl_time(X509_STORE_CTX *ctx, X509_CRL *crl, int notify)
943 ctx->current_crl = crl;
944 if (ctx->param->flags & X509_V_FLAG_USE_CHECK_TIME)
945 ptime = &ctx->param->check_time;
946 + else if (ctx->param->flags & X509_V_FLAG_NO_CHECK_TIME)
951 @@ -1663,6 +1665,8 @@ static int check_cert_time(X509_STORE_CTX *ctx, X509 *x)
953 if (ctx->param->flags & X509_V_FLAG_USE_CHECK_TIME)
954 ptime = &ctx->param->check_time;
955 + else if (ctx->param->flags & X509_V_FLAG_NO_CHECK_TIME)
960 diff --git a/crypto/x509/x509_vfy.h b/crypto/x509/x509_vfy.h
961 index 2663e1c..3790ef5 100644
962 --- a/crypto/x509/x509_vfy.h
963 +++ b/crypto/x509/x509_vfy.h
964 @@ -438,6 +438,8 @@ void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth);
965 * will force the behaviour to match that of previous versions.
967 # define X509_V_FLAG_NO_ALT_CHAINS 0x100000
968 +/* Do not check certificate/CRL validity against current time */
969 +# define X509_V_FLAG_NO_CHECK_TIME 0x200000
971 # define X509_VP_FLAG_DEFAULT 0x1
972 # define X509_VP_FLAG_OVERWRITE 0x2
973 @@ -490,9 +492,10 @@ void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx);
974 X509_STORE *X509_STORE_CTX_get0_store(X509_STORE_CTX *ctx);
976 X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m);
978 +#ifndef OPENSSL_NO_STDIO
979 X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void);
980 X509_LOOKUP_METHOD *X509_LOOKUP_file(void);
983 int X509_STORE_add_cert(X509_STORE *ctx, X509 *x);
984 int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x);
985 diff --git a/crypto/x509v3/ext_dat.h b/crypto/x509v3/ext_dat.h
986 index c3a6fce..01edd2a 100644
987 --- a/crypto/x509v3/ext_dat.h
988 +++ b/crypto/x509v3/ext_dat.h
989 @@ -127,8 +127,10 @@ static const X509V3_EXT_METHOD *standard_exts[] = {
993 +#ifndef OPENSSL_SYS_UEFI
999 /* Number of standard extensions */
1000 diff --git a/crypto/x509v3/v3_pci.c b/crypto/x509v3/v3_pci.c
1001 index 34cad53..12f12a7 100644
1002 --- a/crypto/x509v3/v3_pci.c
1003 +++ b/crypto/x509v3/v3_pci.c
1004 @@ -149,6 +149,7 @@ static int process_pci_value(CONF_VALUE *val,
1007 OPENSSL_free(tmp_data2);
1008 +#ifndef OPENSSL_NO_STDIO
1009 } else if (strncmp(val->value, "file:", 5) == 0) {
1010 unsigned char buf[2048];
1012 @@ -181,6 +182,7 @@ static int process_pci_value(CONF_VALUE *val,
1013 X509V3_conf_err(val);
1016 +#endif /* !OPENSSL_NO_STDIO */
1017 } else if (strncmp(val->value, "text:", 5) == 0) {
1018 val_len = strlen(val->value + 5);
1019 tmp_data = OPENSSL_realloc((*policy)->data,
1020 diff --git a/crypto/x509v3/x509v3.h b/crypto/x509v3/x509v3.h
1021 index f5c6156..a2e78aa 100644
1022 --- a/crypto/x509v3/x509v3.h
1023 +++ b/crypto/x509v3/x509v3.h
1024 @@ -688,8 +688,9 @@ void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent,
1026 int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag,
1028 +#ifndef OPENSSL_NO_FP_API
1029 int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent);
1032 int X509V3_extensions_print(BIO *out, char *title,
1033 STACK_OF(X509_EXTENSION) *exts,
1034 unsigned long flag, int indent);
1035 diff --git a/e_os.h b/e_os.h
1036 index 1fa36c1..3e9dae2 100644
1039 @@ -136,7 +136,7 @@ extern "C" {
1043 -# if defined(MSDOS) && !defined(GETPID_IS_MEANINGLESS)
1044 +# if (defined(MSDOS) || defined(OPENSSL_SYS_UEFI)) && !defined(GETPID_IS_MEANINGLESS)
1045 # define GETPID_IS_MEANINGLESS
1048 diff --git a/e_os2.h b/e_os2.h
1049 index 7be9989..909e22f 100644
1052 @@ -97,7 +97,14 @@ extern "C" {
1053 * For 32 bit environment, there seems to be the CygWin environment and then
1054 * all the others that try to do the same thing Microsoft does...
1056 -# if defined(OPENSSL_SYSNAME_UWIN)
1058 + * UEFI lives here because it might be built with a Microsoft toolchain and
1059 + * we need to avoid the false positive match on Windows.
1061 +# if defined(OPENSSL_SYSNAME_UEFI)
1062 +# undef OPENSSL_SYS_UNIX
1063 +# define OPENSSL_SYS_UEFI
1064 +# elif defined(OPENSSL_SYSNAME_UWIN)
1065 # undef OPENSSL_SYS_UNIX
1066 # define OPENSSL_SYS_WIN32_UWIN
1068 diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c
1069 index a73f866..d534c0a 100644
1070 --- a/ssl/ssl_cert.c
1071 +++ b/ssl/ssl_cert.c
1072 @@ -855,12 +855,13 @@ int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x)
1073 return (add_client_CA(&(ctx->client_CA), x));
1076 +#ifndef OPENSSL_NO_STDIO
1078 static int xname_cmp(const X509_NAME *const *a, const X509_NAME *const *b)
1080 return (X509_NAME_cmp(*a, *b));
1083 -#ifndef OPENSSL_NO_STDIO
1085 * Load CA certs from a file into a ::STACK. Note that it is somewhat misnamed;
1086 * it doesn't really have anything to do with clients (except that a common use
1087 @@ -928,7 +929,6 @@ STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file)
1094 * Add a file of certs to a stack.
1095 @@ -1048,6 +1048,7 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
1096 CRYPTO_w_unlock(CRYPTO_LOCK_READDIR);
1099 +#endif /* !OPENSSL_NO_STDIO */
1101 /* Add a certificate to a BUF_MEM structure */
1103 diff --git a/ssl/ssl_conf.c b/ssl/ssl_conf.c
1104 index 5478840..c2ad7c9 100644
1105 --- a/ssl/ssl_conf.c
1106 +++ b/ssl/ssl_conf.c
1107 @@ -362,6 +362,7 @@ static int cmd_Options(SSL_CONF_CTX *cctx, const char *value)
1108 return CONF_parse_list(value, ',', 1, ssl_set_option_list, cctx);
1111 +#ifndef OPENSSL_NO_STDIO
1112 static int cmd_Certificate(SSL_CONF_CTX *cctx, const char *value)
1115 @@ -428,7 +429,9 @@ static int cmd_DHParameters(SSL_CONF_CTX *cctx, const char *value)
1120 +#endif /* !OPENSSL_NO_DH */
1121 +#endif /* !OPENSSL_NO_STDIO */
1124 int (*cmd) (SSL_CONF_CTX *cctx, const char *value);
1125 const char *str_file;
1126 @@ -454,12 +457,14 @@ static const ssl_conf_cmd_tbl ssl_conf_cmds[] = {
1127 SSL_CONF_CMD_STRING(CipherString, "cipher"),
1128 SSL_CONF_CMD_STRING(Protocol, NULL),
1129 SSL_CONF_CMD_STRING(Options, NULL),
1130 +#ifndef OPENSSL_NO_STDIO
1131 SSL_CONF_CMD(Certificate, "cert", SSL_CONF_TYPE_FILE),
1132 SSL_CONF_CMD(PrivateKey, "key", SSL_CONF_TYPE_FILE),
1133 SSL_CONF_CMD(ServerInfoFile, NULL, SSL_CONF_TYPE_FILE),
1134 #ifndef OPENSSL_NO_DH
1135 SSL_CONF_CMD(DHParameters, "dhparam", SSL_CONF_TYPE_FILE)
1140 static int ssl_conf_cmd_skip_prefix(SSL_CONF_CTX *cctx, const char **pcmd)