1 diff --git a/Configure b/Configure
2 index c98107a..c122709 100755
5 @@ -609,6 +609,9 @@ my %table=(
6 # with itself, Applink is never engaged and can as well be omitted.
7 "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",
10 +"UEFI", "cc:-DL_ENDIAN -O:::UEFI::::",
13 "UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32",
15 @@ -1088,7 +1091,7 @@ if (defined($disabled{"tls1"}))
18 if (defined($disabled{"ec"}) || defined($disabled{"dsa"})
19 - || defined($disabled{"dh"}))
20 + || defined($disabled{"dh"}) || defined($disabled{"stdio"}))
22 $disabled{"gost"} = "forced";
24 diff --git a/apps/apps.c b/apps/apps.c
25 index b1dd970..8278c28 100644
28 @@ -2374,6 +2374,8 @@ int args_verify(char ***pargs, int *pargc,
29 flags |= X509_V_FLAG_PARTIAL_CHAIN;
30 else if (!strcmp(arg, "-no_alt_chains"))
31 flags |= X509_V_FLAG_NO_ALT_CHAINS;
32 + else if (!strcmp(arg, "-no_check_time"))
33 + flags |= X509_V_FLAG_NO_CHECK_TIME;
37 diff --git a/crypto/asn1/a_strex.c b/crypto/asn1/a_strex.c
38 index 35fd44c..9f39bff 100644
39 --- a/crypto/asn1/a_strex.c
40 +++ b/crypto/asn1/a_strex.c
41 @@ -104,6 +104,7 @@ static int send_bio_chars(void *arg, const void *buf, int len)
45 +#ifndef OPENSSL_NO_FP_API
46 static int send_fp_chars(void *arg, const void *buf, int len)
49 @@ -112,6 +113,7 @@ static int send_fp_chars(void *arg, const void *buf, int len)
55 typedef int char_io (void *arg, const void *buf, int len);
57 diff --git a/crypto/asn1/asn1_mac.h b/crypto/asn1/asn1_mac.h
58 index abc6dc3..3a672e9 100644
59 --- a/crypto/asn1/asn1_mac.h
60 +++ b/crypto/asn1/asn1_mac.h
61 @@ -70,7 +70,7 @@ extern "C" {
64 # define ASN1_MAC_H_err(f,r,line) \
65 - ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),__FILE__,(line))
66 + ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),OPENSSL_FILE,(line))
68 # define M_ASN1_D2I_vars(a,type,func) \
70 @@ -81,7 +81,7 @@ extern "C" {
71 c.error=ERR_R_NESTED_ASN1_ERROR; \
72 if ((a == NULL) || ((*a) == NULL)) \
73 { if ((ret=(type)func()) == NULL) \
74 - { c.line=__LINE__; goto err; } } \
75 + { c.line=OPENSSL_LINE; goto err; } } \
78 # define M_ASN1_D2I_Init() \
79 @@ -90,7 +90,7 @@ extern "C" {
81 # define M_ASN1_D2I_Finish_2(a) \
82 if (!asn1_const_Finish(&c)) \
83 - { c.line=__LINE__; goto err; } \
84 + { c.line=OPENSSL_LINE; goto err; } \
85 *(const unsigned char **)pp=c.p; \
86 if (a != NULL) (*a)=ret; \
88 @@ -105,7 +105,7 @@ err:\
90 # define M_ASN1_D2I_start_sequence() \
91 if (!asn1_GetSequence(&c,&length)) \
92 - { c.line=__LINE__; goto err; }
93 + { c.line=OPENSSL_LINE; goto err; }
94 /* Begin reading ASN1 without a surrounding sequence */
95 # define M_ASN1_D2I_begin() \
97 @@ -129,21 +129,21 @@ err:\
98 # define M_ASN1_D2I_get(b, func) \
100 if (func(&(b),&c.p,c.slen) == NULL) \
101 - {c.line=__LINE__; goto err; } \
102 + {c.line=OPENSSL_LINE; goto err; } \
105 /* Don't use this with d2i_ASN1_BOOLEAN() */
106 # define M_ASN1_D2I_get_x(type,b,func) \
108 if (((D2I_OF(type))func)(&(b),&c.p,c.slen) == NULL) \
109 - {c.line=__LINE__; goto err; } \
110 + {c.line=OPENSSL_LINE; goto err; } \
113 /* use this instead () */
114 # define M_ASN1_D2I_get_int(b,func) \
116 if (func(&(b),&c.p,c.slen) < 0) \
117 - {c.line=__LINE__; goto err; } \
118 + {c.line=OPENSSL_LINE; goto err; } \
121 # define M_ASN1_D2I_get_opt(b,func,type) \
122 @@ -164,7 +164,7 @@ err:\
123 M_ASN1_next=(_tmp& V_ASN1_CONSTRUCTED)|type; \
125 if (func(&(b),&c.p,c.slen) == NULL) \
126 - {c.line=__LINE__; M_ASN1_next_prev = _tmp; goto err; } \
127 + {c.line=OPENSSL_LINE; M_ASN1_next_prev = _tmp; goto err; } \
129 M_ASN1_next_prev=_tmp;
131 @@ -258,20 +258,20 @@ err:\
133 if (d2i_ASN1_SET(&(r),&c.p,c.slen,(char *(*)())func,\
134 (void (*)())free_func,a,b) == NULL) \
135 - { c.line=__LINE__; goto err; } \
136 + { c.line=OPENSSL_LINE; goto err; } \
139 # define M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,a,b) \
141 if (d2i_ASN1_SET_OF_##type(&(r),&c.p,c.slen,func,\
142 free_func,a,b) == NULL) \
143 - { c.line=__LINE__; goto err; } \
144 + { c.line=OPENSSL_LINE; goto err; } \
147 # define M_ASN1_D2I_get_set_strings(r,func,a,b) \
149 if (d2i_ASN1_STRING_SET(&(r),&c.p,c.slen,a,b) == NULL) \
150 - { c.line=__LINE__; goto err; } \
151 + { c.line=OPENSSL_LINE; goto err; } \
154 # define M_ASN1_D2I_get_EXP_opt(r,func,tag) \
155 @@ -285,16 +285,16 @@ err:\
156 Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
158 { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
159 - c.line=__LINE__; goto err; } \
160 + c.line=OPENSSL_LINE; goto err; } \
161 if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
162 Tlen = c.slen - (c.p - c.q) - 2; \
163 if (func(&(r),&c.p,Tlen) == NULL) \
164 - { c.line=__LINE__; goto err; } \
165 + { c.line=OPENSSL_LINE; goto err; } \
166 if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
167 Tlen = c.slen - (c.p - c.q); \
168 if(!ASN1_const_check_infinite_end(&c.p, Tlen)) \
169 { c.error=ERR_R_MISSING_ASN1_EOS; \
170 - c.line=__LINE__; goto err; } \
171 + c.line=OPENSSL_LINE; goto err; } \
175 @@ -310,18 +310,18 @@ err:\
176 Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
178 { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
179 - c.line=__LINE__; goto err; } \
180 + c.line=OPENSSL_LINE; goto err; } \
181 if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
182 Tlen = c.slen - (c.p - c.q) - 2; \
183 if (d2i_ASN1_SET(&(r),&c.p,Tlen,(char *(*)())func, \
184 (void (*)())free_func, \
185 b,V_ASN1_UNIVERSAL) == NULL) \
186 - { c.line=__LINE__; goto err; } \
187 + { c.line=OPENSSL_LINE; goto err; } \
188 if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
189 Tlen = c.slen - (c.p - c.q); \
190 if(!ASN1_check_infinite_end(&c.p, Tlen)) \
191 { c.error=ERR_R_MISSING_ASN1_EOS; \
192 - c.line=__LINE__; goto err; } \
193 + c.line=OPENSSL_LINE; goto err; } \
197 @@ -337,17 +337,17 @@ err:\
198 Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
200 { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \
201 - c.line=__LINE__; goto err; } \
202 + c.line=OPENSSL_LINE; goto err; } \
203 if (Tinf == (V_ASN1_CONSTRUCTED+1)) \
204 Tlen = c.slen - (c.p - c.q) - 2; \
205 if (d2i_ASN1_SET_OF_##type(&(r),&c.p,Tlen,func, \
206 free_func,b,V_ASN1_UNIVERSAL) == NULL) \
207 - { c.line=__LINE__; goto err; } \
208 + { c.line=OPENSSL_LINE; goto err; } \
209 if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \
210 Tlen = c.slen - (c.p - c.q); \
211 if(!ASN1_check_infinite_end(&c.p, Tlen)) \
212 { c.error=ERR_R_MISSING_ASN1_EOS; \
213 - c.line=__LINE__; goto err; } \
214 + c.line=OPENSSL_LINE; goto err; } \
218 @@ -355,7 +355,7 @@ err:\
220 # define M_ASN1_New_Malloc(ret,type) \
221 if ((ret=(type *)OPENSSL_malloc(sizeof(type))) == NULL) \
222 - { c.line=__LINE__; goto err2; }
223 + { c.line=OPENSSL_LINE; goto err2; }
225 # define M_ASN1_New(arg,func) \
226 if (((arg)=func()) == NULL) return(NULL)
227 diff --git a/crypto/asn1/n_pkey.c b/crypto/asn1/n_pkey.c
228 index d5a5514..bede55c 100644
229 --- a/crypto/asn1/n_pkey.c
230 +++ b/crypto/asn1/n_pkey.c
231 @@ -193,7 +193,12 @@ int i2d_RSA_NET(const RSA *a, unsigned char **pp,
232 OPENSSL_cleanse(pkey->private_key->data, rsalen);
235 +#ifndef OPENSSL_NO_UI
236 cb = EVP_read_pw_string;
241 i = cb((char *)buf, 256, "Enter Private Key password:", 1);
243 ASN1err(ASN1_F_I2D_RSA_NET, ASN1_R_BAD_PASSWORD_READ);
244 @@ -264,7 +269,11 @@ RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length,
248 +#ifndef OPENSSL_NO_UI
249 cb = EVP_read_pw_string;
253 if ((ret = d2i_RSA_NET_2(a, enckey->enckey->digest, cb, sgckey)) == NULL)
256 diff --git a/crypto/bn/bn_prime.c b/crypto/bn/bn_prime.c
257 index 1d25687..ad641c3 100644
258 --- a/crypto/bn/bn_prime.c
259 +++ b/crypto/bn/bn_prime.c
261 static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1,
262 const BIGNUM *a1_odd, int k, BN_CTX *ctx,
264 -static int probable_prime(BIGNUM *rnd, int bits);
265 +static int probable_prime(BIGNUM *rnd, int bits, prime_t *mods);
266 static int probable_prime_dh(BIGNUM *rnd, int bits,
267 const BIGNUM *add, const BIGNUM *rem,
269 @@ -166,9 +166,13 @@ int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe,
274 + BN_CTX *ctx = NULL;
275 + prime_t *mods = NULL;
276 int checks = BN_prime_checks_for_size(bits);
278 + mods = OPENSSL_malloc(sizeof(*mods) * NUMPRIMES);
284 @@ -179,7 +183,7 @@ int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe,
286 /* make a random number and set the top and bottom bits */
288 - if (!probable_prime(ret, bits))
289 + if (!probable_prime(ret, bits, mods))
293 @@ -230,6 +234,7 @@ int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe,
294 /* we have a prime :-) */
297 + OPENSSL_free(mods);
301 @@ -375,10 +380,9 @@ static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1,
305 -static int probable_prime(BIGNUM *rnd, int bits)
306 +static int probable_prime(BIGNUM *rnd, int bits, prime_t *mods)
309 - prime_t mods[NUMPRIMES];
310 BN_ULONG delta, maxdelta;
313 diff --git a/crypto/conf/conf.h b/crypto/conf/conf.h
314 index 8d926d5..c29e97d 100644
315 --- a/crypto/conf/conf.h
316 +++ b/crypto/conf/conf.h
317 @@ -118,8 +118,10 @@ typedef void conf_finish_func (CONF_IMODULE *md);
319 int CONF_set_default_method(CONF_METHOD *meth);
320 void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash);
321 +# ifndef OPENSSL_NO_STDIO
322 LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file,
325 # ifndef OPENSSL_NO_FP_API
326 LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp,
328 @@ -133,7 +135,9 @@ char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group,
329 long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group,
331 void CONF_free(LHASH_OF(CONF_VALUE) *conf);
332 +# ifndef OPENSSL_NO_FP_API
333 int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out);
335 int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out);
337 void OPENSSL_config(const char *config_name);
338 @@ -160,7 +164,9 @@ CONF_METHOD *NCONF_XML(void);
339 void NCONF_free(CONF *conf);
340 void NCONF_free_data(CONF *conf);
342 +# ifndef OPENSSL_NO_STDIO
343 int NCONF_load(CONF *conf, const char *file, long *eline);
345 # ifndef OPENSSL_NO_FP_API
346 int NCONF_load_fp(CONF *conf, FILE *fp, long *eline);
348 @@ -170,7 +176,9 @@ STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf,
349 char *NCONF_get_string(const CONF *conf, const char *group, const char *name);
350 int NCONF_get_number_e(const CONF *conf, const char *group, const char *name,
352 +# ifndef OPENSSL_NO_FP_API
353 int NCONF_dump_fp(const CONF *conf, FILE *out);
355 int NCONF_dump_bio(const CONF *conf, BIO *out);
357 # if 0 /* The following function has no error
358 @@ -184,8 +192,10 @@ long NCONF_get_number(CONF *conf, char *group, char *name);
360 int CONF_modules_load(const CONF *cnf, const char *appname,
361 unsigned long flags);
362 +# ifndef OPENSSL_NO_STDIO
363 int CONF_modules_load_file(const char *filename, const char *appname,
364 unsigned long flags);
366 void CONF_modules_unload(int all);
367 void CONF_modules_finish(void);
368 void CONF_modules_free(void);
369 diff --git a/crypto/conf/conf_def.c b/crypto/conf/conf_def.c
370 index 68c77ce..3d308c7 100644
371 --- a/crypto/conf/conf_def.c
372 +++ b/crypto/conf/conf_def.c
373 @@ -182,6 +182,10 @@ static int def_destroy_data(CONF *conf)
375 static int def_load(CONF *conf, const char *name, long *line)
377 +#ifdef OPENSSL_NO_STDIO
378 + CONFerr(CONF_F_DEF_LOAD, ERR_R_SYS_LIB);
384 @@ -202,6 +206,7 @@ static int def_load(CONF *conf, const char *name, long *line)
391 static int def_load_bio(CONF *conf, BIO *in, long *line)
392 diff --git a/crypto/conf/conf_lib.c b/crypto/conf/conf_lib.c
393 index 5281384..952b545 100644
394 --- a/crypto/conf/conf_lib.c
395 +++ b/crypto/conf/conf_lib.c
396 @@ -90,6 +90,7 @@ int CONF_set_default_method(CONF_METHOD *meth)
400 +#ifndef OPENSSL_NO_STDIO
401 LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file,
404 @@ -111,6 +112,7 @@ LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file,
410 #ifndef OPENSSL_NO_FP_API
411 LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp,
412 @@ -255,6 +257,7 @@ void NCONF_free_data(CONF *conf)
413 conf->meth->destroy_data(conf);
416 +#ifndef OPENSSL_NO_STDIO
417 int NCONF_load(CONF *conf, const char *file, long *eline)
420 @@ -264,6 +267,7 @@ int NCONF_load(CONF *conf, const char *file, long *eline)
422 return conf->meth->load(conf, file, eline);
426 #ifndef OPENSSL_NO_FP_API
427 int NCONF_load_fp(CONF *conf, FILE *fp, long *eline)
428 diff --git a/crypto/conf/conf_mod.c b/crypto/conf/conf_mod.c
429 index 9acfca4..5e0a482 100644
430 --- a/crypto/conf/conf_mod.c
431 +++ b/crypto/conf/conf_mod.c
432 @@ -159,6 +159,7 @@ int CONF_modules_load(const CONF *cnf, const char *appname,
436 +#ifndef OPENSSL_NO_STDIO
437 int CONF_modules_load_file(const char *filename, const char *appname,
440 @@ -194,6 +195,7 @@ int CONF_modules_load_file(const char *filename, const char *appname,
446 static int module_run(const CONF *cnf, char *name, char *value,
448 diff --git a/crypto/conf/conf_sap.c b/crypto/conf/conf_sap.c
449 index c042cf2..a25b636 100644
450 --- a/crypto/conf/conf_sap.c
451 +++ b/crypto/conf/conf_sap.c
452 @@ -87,9 +87,11 @@ void OPENSSL_config(const char *config_name)
453 ENGINE_load_builtin_engines();
456 +#ifndef OPENSSL_NO_STDIO
457 CONF_modules_load_file(NULL, config_name,
458 CONF_MFLAGS_DEFAULT_SECTION |
459 CONF_MFLAGS_IGNORE_MISSING_FILE);
461 openssl_configured = 1;
464 diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c
465 index 1925428..da4b34d 100644
466 --- a/crypto/cryptlib.c
467 +++ b/crypto/cryptlib.c
468 @@ -263,7 +263,7 @@ int CRYPTO_get_new_dynlockid(void)
471 pointer->references = 1;
472 - pointer->data = dynlock_create_callback(__FILE__, __LINE__);
473 + pointer->data = dynlock_create_callback(OPENSSL_FILE, OPENSSL_LINE);
474 if (pointer->data == NULL) {
475 OPENSSL_free(pointer);
476 CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID, ERR_R_MALLOC_FAILURE);
477 @@ -289,7 +289,7 @@ int CRYPTO_get_new_dynlockid(void)
478 CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
481 - dynlock_destroy_callback(pointer->data, __FILE__, __LINE__);
482 + dynlock_destroy_callback(pointer->data, OPENSSL_FILE, OPENSSL_LINE);
483 OPENSSL_free(pointer);
485 i += 1; /* to avoid 0 */
486 @@ -328,7 +328,7 @@ void CRYPTO_destroy_dynlockid(int i)
487 CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
490 - dynlock_destroy_callback(pointer->data, __FILE__, __LINE__);
491 + dynlock_destroy_callback(pointer->data, OPENSSL_FILE, OPENSSL_LINE);
492 OPENSSL_free(pointer);
495 @@ -670,6 +670,7 @@ unsigned long *OPENSSL_ia32cap_loc(void)
498 # if defined(OPENSSL_CPUID_OBJ) && !defined(OPENSSL_NO_ASM) && !defined(I386_ONLY)
500 # define OPENSSL_CPUID_SETUP
502 typedef unsigned __int64 IA32CAP;
503 @@ -980,11 +981,13 @@ void OPENSSL_showfatal(const char *fmta, ...)
505 void OPENSSL_showfatal(const char *fmta, ...)
507 +#ifndef OPENSSL_NO_STDIO
511 vfprintf(stderr, fmta, ap);
516 int OPENSSL_isservice(void)
517 @@ -1011,10 +1014,12 @@ void OpenSSLDie(const char *file, int line, const char *assertion)
521 +#ifndef OPENSSL_NO_STDIO
522 void *OPENSSL_stderr(void)
528 int CRYPTO_memcmp(const volatile void *in_a, const volatile void *in_b, size_t len)
530 diff --git a/crypto/cryptlib.h b/crypto/cryptlib.h
531 index fba180a..3e3ea5e 100644
532 --- a/crypto/cryptlib.h
533 +++ b/crypto/cryptlib.h
534 @@ -101,7 +101,9 @@ extern "C" {
535 void OPENSSL_cpuid_setup(void);
536 extern unsigned int OPENSSL_ia32cap_P[];
537 void OPENSSL_showfatal(const char *fmta, ...);
538 +#ifndef OPENSSL_NO_STDIO
539 void *OPENSSL_stderr(void);
541 extern int OPENSSL_NONPIC_relocated;
544 diff --git a/crypto/crypto.h b/crypto/crypto.h
545 index 6c644ce..bea4ca1 100644
546 --- a/crypto/crypto.h
547 +++ b/crypto/crypto.h
548 @@ -235,15 +235,15 @@ typedef struct openssl_item_st {
549 # ifndef OPENSSL_NO_LOCKING
550 # ifndef CRYPTO_w_lock
551 # define CRYPTO_w_lock(type) \
552 - CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
553 + CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,OPENSSL_FILE,OPENSSL_LINE)
554 # define CRYPTO_w_unlock(type) \
555 - CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
556 + CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,OPENSSL_FILE,OPENSSL_LINE)
557 # define CRYPTO_r_lock(type) \
558 - CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__)
559 + CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,OPENSSL_FILE,OPENSSL_LINE)
560 # define CRYPTO_r_unlock(type) \
561 - CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__)
562 + CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,OPENSSL_FILE,OPENSSL_LINE)
563 # define CRYPTO_add(addr,amount,type) \
564 - CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__)
565 + CRYPTO_add_lock(addr,amount,type,OPENSSL_FILE,OPENSSL_LINE)
568 # define CRYPTO_w_lock(a)
569 @@ -378,19 +378,19 @@ int CRYPTO_is_mem_check_on(void);
570 # define MemCheck_off() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE)
571 # define is_MemCheck_on() CRYPTO_is_mem_check_on()
573 -# define OPENSSL_malloc(num) CRYPTO_malloc((int)num,__FILE__,__LINE__)
574 -# define OPENSSL_strdup(str) CRYPTO_strdup((str),__FILE__,__LINE__)
575 +# define OPENSSL_malloc(num) CRYPTO_malloc((int)num,OPENSSL_FILE,OPENSSL_LINE)
576 +# define OPENSSL_strdup(str) CRYPTO_strdup((str),OPENSSL_FILE,OPENSSL_LINE)
577 # define OPENSSL_realloc(addr,num) \
578 - CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__)
579 + CRYPTO_realloc((char *)addr,(int)num,OPENSSL_FILE,OPENSSL_LINE)
580 # define OPENSSL_realloc_clean(addr,old_num,num) \
581 - CRYPTO_realloc_clean(addr,old_num,num,__FILE__,__LINE__)
582 + CRYPTO_realloc_clean(addr,old_num,num,OPENSSL_FILE,OPENSSL_LINE)
583 # define OPENSSL_remalloc(addr,num) \
584 - CRYPTO_remalloc((char **)addr,(int)num,__FILE__,__LINE__)
585 + CRYPTO_remalloc((char **)addr,(int)num,OPENSSL_FILE,OPENSSL_LINE)
586 # define OPENSSL_freeFunc CRYPTO_free
587 # define OPENSSL_free(addr) CRYPTO_free(addr)
589 # define OPENSSL_malloc_locked(num) \
590 - CRYPTO_malloc_locked((int)num,__FILE__,__LINE__)
591 + CRYPTO_malloc_locked((int)num,OPENSSL_FILE,OPENSSL_LINE)
592 # define OPENSSL_free_locked(addr) CRYPTO_free_locked(addr)
594 const char *SSLeay_version(int type);
595 @@ -545,7 +545,7 @@ void CRYPTO_set_mem_debug_options(long bits);
596 long CRYPTO_get_mem_debug_options(void);
598 # define CRYPTO_push_info(info) \
599 - CRYPTO_push_info_(info, __FILE__, __LINE__);
600 + CRYPTO_push_info_(info, OPENSSL_FILE, OPENSSL_LINE);
601 int CRYPTO_push_info_(const char *info, const char *file, int line);
602 int CRYPTO_pop_info(void);
603 int CRYPTO_remove_all_info(void);
604 @@ -588,7 +588,7 @@ void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb);
606 /* die if we have to */
607 void OpenSSLDie(const char *file, int line, const char *assertion);
608 -# define OPENSSL_assert(e) (void)((e) ? 0 : (OpenSSLDie(__FILE__, __LINE__, #e),1))
609 +# define OPENSSL_assert(e) (void)((e) ? 0 : (OpenSSLDie(OPENSSL_FILE, OPENSSL_LINE, #e),1))
611 unsigned long *OPENSSL_ia32cap_loc(void);
612 # define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc()))
613 @@ -605,14 +605,14 @@ void OPENSSL_init(void);
614 # define fips_md_init_ctx(alg, cx) \
615 int alg##_Init(cx##_CTX *c) \
617 - if (FIPS_mode()) OpenSSLDie(__FILE__, __LINE__, \
618 + if (FIPS_mode()) OpenSSLDie(OPENSSL_FILE, OPENSSL_LINE, \
619 "Low level API call to digest " #alg " forbidden in FIPS mode!"); \
620 return private_##alg##_Init(c); \
622 int private_##alg##_Init(cx##_CTX *c)
624 # define fips_cipher_abort(alg) \
625 - if (FIPS_mode()) OpenSSLDie(__FILE__, __LINE__, \
626 + if (FIPS_mode()) OpenSSLDie(OPENSSL_FILE, OPENSSL_LINE, \
627 "Low level API call to cipher " #alg " forbidden in FIPS mode!")
630 diff --git a/crypto/des/read2pwd.c b/crypto/des/read2pwd.c
631 index 01e275f..7633139 100644
632 --- a/crypto/des/read2pwd.c
633 +++ b/crypto/des/read2pwd.c
635 #include <openssl/ui.h>
636 #include <openssl/crypto.h>
642 int DES_read_password(DES_cblock *key, const char *prompt, int verify)
645 diff --git a/crypto/dh/Makefile b/crypto/dh/Makefile
646 index 46fa5ac..cc366ec 100644
647 --- a/crypto/dh/Makefile
648 +++ b/crypto/dh/Makefile
649 @@ -134,7 +134,7 @@ dh_gen.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
650 dh_gen.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
651 dh_gen.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
652 dh_gen.o: ../cryptlib.h dh_gen.c
653 -dh_kdf.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
654 +dh_kdf.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
655 dh_kdf.o: ../../include/openssl/buffer.h ../../include/openssl/cms.h
656 dh_kdf.o: ../../include/openssl/crypto.h ../../include/openssl/dh.h
657 dh_kdf.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
658 diff --git a/crypto/dh/dh.h b/crypto/dh/dh.h
659 index a5bd901..6488879 100644
662 @@ -240,11 +240,13 @@ DH *DH_get_1024_160(void);
663 DH *DH_get_2048_224(void);
664 DH *DH_get_2048_256(void);
666 +# ifndef OPENSSL_NO_CMS
668 int DH_KDF_X9_42(unsigned char *out, size_t outlen,
669 const unsigned char *Z, size_t Zlen,
670 ASN1_OBJECT *key_oid,
671 const unsigned char *ukm, size_t ukmlen, const EVP_MD *md);
674 # define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \
675 EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \
676 @@ -337,7 +339,9 @@ int DH_KDF_X9_42(unsigned char *out, size_t outlen,
679 # define EVP_PKEY_DH_KDF_NONE 1
680 +# ifndef OPENSSL_NO_CMS
681 # define EVP_PKEY_DH_KDF_X9_42 2
684 /* BEGIN ERROR CODES */
686 diff --git a/crypto/dh/dh_kdf.c b/crypto/dh/dh_kdf.c
687 index a882cb2..aace5fb 100644
688 --- a/crypto/dh/dh_kdf.c
689 +++ b/crypto/dh/dh_kdf.c
691 * ====================================================================
696 +#ifndef OPENSSL_NO_CMS
698 #include <openssl/dh.h>
699 #include <openssl/evp.h>
701 #include <openssl/cms.h>
703 /* Key derivation from X9.42/RFC2631 */
704 +/* Uses CMS functions, hence the #ifdef wrapper. */
706 #define DH_KDF_MAX (1L << 30)
708 @@ -185,3 +189,4 @@ int DH_KDF_X9_42(unsigned char *out, size_t outlen,
709 EVP_MD_CTX_cleanup(&mctx);
713 diff --git a/crypto/dh/dh_pmeth.c b/crypto/dh/dh_pmeth.c
714 index b58e3fa..926be98 100644
715 --- a/crypto/dh/dh_pmeth.c
716 +++ b/crypto/dh/dh_pmeth.c
717 @@ -207,7 +207,11 @@ static int pkey_dh_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
718 case EVP_PKEY_CTRL_DH_KDF_TYPE:
720 return dctx->kdf_type;
721 +#ifdef OPENSSL_NO_CMS
722 + if (p1 != EVP_PKEY_DH_KDF_NONE)
724 if (p1 != EVP_PKEY_DH_KDF_NONE && p1 != EVP_PKEY_DH_KDF_X9_42)
729 @@ -448,7 +452,9 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned char *key,
733 - } else if (dctx->kdf_type == EVP_PKEY_DH_KDF_X9_42) {
735 +#ifndef OPENSSL_NO_CMS
736 + else if (dctx->kdf_type == EVP_PKEY_DH_KDF_X9_42) {
737 unsigned char *Z = NULL;
739 if (!dctx->kdf_outlen || !dctx->kdf_oid)
740 @@ -479,7 +485,8 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned char *key,
749 const EVP_PKEY_METHOD dh_pkey_meth = {
750 diff --git a/crypto/ec/ec_ameth.c b/crypto/ec/ec_ameth.c
751 index 83e208c..4869098 100644
752 --- a/crypto/ec/ec_ameth.c
753 +++ b/crypto/ec/ec_ameth.c
755 #include <openssl/asn1t.h>
756 #include "asn1_locl.h"
758 +#ifndef OPENSSL_NO_CMS
759 static int ecdh_cms_decrypt(CMS_RecipientInfo *ri);
760 static int ecdh_cms_encrypt(CMS_RecipientInfo *ri);
763 static int eckey_param2type(int *pptype, void **ppval, EC_KEY *ec_key)
765 diff --git a/crypto/engine/eng_int.h b/crypto/engine/eng_int.h
766 index 46f163b..b4a72a0 100644
767 --- a/crypto/engine/eng_int.h
768 +++ b/crypto/engine/eng_int.h
769 @@ -88,7 +88,7 @@ extern "C" {
770 (unsigned int)(e), (isfunct ? "funct" : "struct"), \
771 ((isfunct) ? ((e)->funct_ref - (diff)) : ((e)->struct_ref - (diff))), \
772 ((isfunct) ? (e)->funct_ref : (e)->struct_ref), \
773 - (__FILE__), (__LINE__));
774 + (OPENSSL_FILE), (OPENSSL_LINE));
778 @@ -136,7 +136,7 @@ ENGINE *engine_table_select(ENGINE_TABLE **table, int nid);
780 ENGINE *engine_table_select_tmp(ENGINE_TABLE **table, int nid, const char *f,
782 -# define engine_table_select(t,n) engine_table_select_tmp(t,n,__FILE__,__LINE__)
783 +# define engine_table_select(t,n) engine_table_select_tmp(t,n,OPENSSL_FILE,OPENSSL_LINE)
785 typedef void (engine_table_doall_cb) (int nid, STACK_OF(ENGINE) *sk,
786 ENGINE *def, void *arg);
787 diff --git a/crypto/engine/eng_openssl.c b/crypto/engine/eng_openssl.c
788 index 34b0029..cf622bb 100644
789 --- a/crypto/engine/eng_openssl.c
790 +++ b/crypto/engine/eng_openssl.c
792 * this is no longer automatic in ENGINE_load_builtin_engines().
794 #define TEST_ENG_OPENSSL_RC4
795 +#ifndef OPENSSL_NO_FP_API
796 #define TEST_ENG_OPENSSL_PKEY
798 /* #define TEST_ENG_OPENSSL_RC4_OTHERS */
799 #define TEST_ENG_OPENSSL_RC4_P_INIT
800 /* #define TEST_ENG_OPENSSL_RC4_P_CIPHER */
801 diff --git a/crypto/err/err.h b/crypto/err/err.h
802 index 585aa8b..04c6cfc 100644
803 --- a/crypto/err/err.h
804 +++ b/crypto/err/err.h
805 @@ -200,39 +200,39 @@ typedef struct err_state_st {
807 # define ERR_LIB_USER 128
809 -# define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),__FILE__,__LINE__)
810 -# define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),__FILE__,__LINE__)
811 -# define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),__FILE__,__LINE__)
812 -# define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),__FILE__,__LINE__)
813 -# define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),__FILE__,__LINE__)
814 -# define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),__FILE__,__LINE__)
815 -# define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),__FILE__,__LINE__)
816 -# define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),__FILE__,__LINE__)
817 -# define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),__FILE__,__LINE__)
818 -# define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),__FILE__,__LINE__)
819 -# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),__FILE__,__LINE__)
820 -# define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),__FILE__,__LINE__)
821 -# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),__FILE__,__LINE__)
822 -# define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),__FILE__,__LINE__)
823 -# define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),__FILE__,__LINE__)
824 -# define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),__FILE__,__LINE__)
825 -# define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),__FILE__,__LINE__)
826 -# define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),__FILE__,__LINE__)
827 -# define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),__FILE__,__LINE__)
828 -# define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),__FILE__,__LINE__)
829 -# define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),__FILE__,__LINE__)
830 -# define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),__FILE__,__LINE__)
831 -# define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),__FILE__,__LINE__)
832 -# define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),__FILE__,__LINE__)
833 -# define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),__FILE__,__LINE__)
834 -# define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),__FILE__,__LINE__)
835 -# define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),__FILE__,__LINE__)
836 -# define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),__FILE__,__LINE__)
837 -# define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),__FILE__,__LINE__)
838 -# define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),__FILE__,__LINE__)
839 -# define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),__FILE__,__LINE__)
840 -# define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),__FILE__,__LINE__)
841 -# define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),__FILE__,__LINE__)
842 +# define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
843 +# define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
844 +# define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
845 +# define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
846 +# define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
847 +# define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
848 +# define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
849 +# define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
850 +# define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
851 +# define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
852 +# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
853 +# define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
854 +# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
855 +# define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
856 +# define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
857 +# define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
858 +# define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
859 +# define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
860 +# define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
861 +# define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
862 +# define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
863 +# define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
864 +# define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
865 +# define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
866 +# define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
867 +# define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
868 +# define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
869 +# define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
870 +# define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
871 +# define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
872 +# define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
873 +# define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
874 +# define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
877 * Borland C seems too stupid to be able to shift and do longs in the
878 diff --git a/crypto/evp/evp.h b/crypto/evp/evp.h
879 index 39ab793..ad1e350 100644
880 --- a/crypto/evp/evp.h
881 +++ b/crypto/evp/evp.h
882 @@ -602,11 +602,13 @@ int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in);
883 int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type);
884 int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s);
886 +#ifndef OPENSSL_NO_UI
887 int EVP_read_pw_string(char *buf, int length, const char *prompt, int verify);
888 int EVP_read_pw_string_min(char *buf, int minlen, int maxlen,
889 const char *prompt, int verify);
890 void EVP_set_pw_prompt(const char *prompt);
891 char *EVP_get_pw_prompt(void);
894 int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md,
895 const unsigned char *salt, const unsigned char *data,
896 diff --git a/crypto/evp/evp_key.c b/crypto/evp/evp_key.c
897 index 5be9e33..63c8866 100644
898 --- a/crypto/evp/evp_key.c
899 +++ b/crypto/evp/evp_key.c
901 #include <openssl/evp.h>
902 #include <openssl/ui.h>
904 +#ifndef OPENSSL_NO_UI
905 /* should be init to zeros. */
906 static char prompt_string[80];
908 @@ -117,6 +118,7 @@ int EVP_read_pw_string_min(char *buf, int min, int len, const char *prompt,
909 OPENSSL_cleanse(buff, BUFSIZ);
912 +#endif /* OPENSSL_NO_UI */
914 int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md,
915 const unsigned char *salt, const unsigned char *data,
916 diff --git a/crypto/opensslconf.h.in b/crypto/opensslconf.h.in
917 index 7a1c85d..7162c0f 100644
918 --- a/crypto/opensslconf.h.in
919 +++ b/crypto/opensslconf.h.in
921 /* crypto/opensslconf.h.in */
923 +#ifndef OPENSSL_FILE
924 +#ifdef OPENSSL_NO_FILENAMES
925 +#define OPENSSL_FILE ""
926 +#define OPENSSL_LINE 0
928 +#define OPENSSL_FILE __FILE__
929 +#define OPENSSL_LINE __LINE__
933 /* Generate 80386 code? */
940 -#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
941 +#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) && !defined(OPENSSL_SYSNAME_UEFI)
942 #define CONFIG_HEADER_BN_H
945 diff --git a/crypto/pem/pem.h b/crypto/pem/pem.h
946 index d3b23fc..5df6ffd 100644
947 --- a/crypto/pem/pem.h
948 +++ b/crypto/pem/pem.h
949 @@ -324,6 +324,7 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
951 # define DECLARE_PEM_read_fp(name, type) /**/
952 # define DECLARE_PEM_write_fp(name, type) /**/
953 +# define DECLARE_PEM_write_fp_const(name, type) /**/
954 # define DECLARE_PEM_write_cb_fp(name, type) /**/
957 @@ -417,6 +418,7 @@ int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc,
958 pem_password_cb *cd, void *u);
961 +#ifndef OPENSSL_NO_FP_API
962 int PEM_read(FILE *fp, char **name, char **header,
963 unsigned char **data, long *len);
964 int PEM_write(FILE *fp, const char *name, const char *hdr,
965 @@ -428,6 +430,7 @@ int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp,
966 int klen, pem_password_cb *callback, void *u);
967 STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk,
968 pem_password_cb *cb, void *u);
971 int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type,
972 EVP_MD *md_type, unsigned char **ek, int *ekl,
973 @@ -494,6 +497,7 @@ int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid,
974 EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb,
977 +#ifndef OPENSSL_NO_FP_API
978 int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
979 char *kstr, int klen,
980 pem_password_cb *cb, void *u);
981 @@ -510,6 +514,7 @@ EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb,
982 int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
983 char *kstr, int klen, pem_password_cb *cd,
987 EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x);
988 int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x);
989 diff --git a/crypto/pem/pem_lib.c b/crypto/pem/pem_lib.c
990 index fe881d6..e25cc68 100644
991 --- a/crypto/pem/pem_lib.c
992 +++ b/crypto/pem/pem_lib.c
993 @@ -84,7 +84,7 @@ int pem_check_suffix(const char *pem_str, const char *suffix);
995 int PEM_def_callback(char *buf, int num, int w, void *key)
997 -#ifdef OPENSSL_NO_FP_API
998 +#if defined(OPENSSL_NO_FP_API) || defined(OPENSSL_NO_UI)
1000 * We should not ever call the default callback routine from windows.
1002 diff --git a/crypto/pem/pem_pk8.c b/crypto/pem/pem_pk8.c
1003 index 5747c73..9edca4d 100644
1004 --- a/crypto/pem/pem_pk8.c
1005 +++ b/crypto/pem/pem_pk8.c
1007 static int do_pk8pkey(BIO *bp, EVP_PKEY *x, int isder,
1008 int nid, const EVP_CIPHER *enc,
1009 char *kstr, int klen, pem_password_cb *cb, void *u);
1010 +#ifndef OPENSSL_NO_FP_API
1011 static int do_pk8pkey_fp(FILE *bp, EVP_PKEY *x, int isder,
1012 int nid, const EVP_CIPHER *enc,
1013 char *kstr, int klen, pem_password_cb *cb, void *u);
1017 * These functions write a private key in PKCS#8 format: it is a "drop in"
1018 diff --git a/crypto/pkcs7/pk7_smime.c b/crypto/pkcs7/pk7_smime.c
1019 index dc9b484..e75c4b2 100644
1020 --- a/crypto/pkcs7/pk7_smime.c
1021 +++ b/crypto/pkcs7/pk7_smime.c
1023 #include <openssl/x509.h>
1024 #include <openssl/x509v3.h>
1026 +#define BUFFERSIZE 4096
1028 static int pkcs7_copy_existing_digest(PKCS7 *p7, PKCS7_SIGNER_INFO *si);
1030 PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
1031 @@ -254,7 +256,7 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
1032 STACK_OF(PKCS7_SIGNER_INFO) *sinfos;
1033 PKCS7_SIGNER_INFO *si;
1034 X509_STORE_CTX cert_ctx;
1037 int i, j = 0, k, ret = 0;
1039 BIO *tmpin = NULL, *tmpout = NULL;
1040 @@ -373,8 +375,12 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
1043 /* We now have to 'read' from p7bio to calculate digests etc. */
1044 + if ((buf = OPENSSL_malloc(BUFFERSIZE)) == NULL) {
1045 + PKCS7err(PKCS7_F_PKCS7_VERIFY, ERR_R_MALLOC_FAILURE);
1049 - i = BIO_read(p7bio, buf, sizeof(buf));
1050 + i = BIO_read(p7bio, buf, BUFFERSIZE);
1054 @@ -405,6 +411,7 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
1058 + OPENSSL_free(buf);
1059 if (tmpin == indata) {
1062 @@ -523,7 +530,7 @@ int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags)
1070 PKCS7err(PKCS7_F_PKCS7_DECRYPT, PKCS7_R_INVALID_NULL_POINTER);
1071 @@ -567,24 +574,30 @@ int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags)
1073 BIO_free_all(bread);
1077 - i = BIO_read(tmpmem, buf, sizeof(buf));
1080 - if (BIO_method_type(tmpmem) == BIO_TYPE_CIPHER) {
1081 - if (!BIO_get_cipher_status(tmpmem))
1087 - if (BIO_write(data, buf, i) != i) {
1091 + if ((buf = OPENSSL_malloc(BUFFERSIZE)) == NULL) {
1092 + PKCS7err(PKCS7_F_PKCS7_DECRYPT, ERR_R_MALLOC_FAILURE);
1096 + i = BIO_read(tmpmem, buf, BUFFERSIZE);
1099 + if (BIO_method_type(tmpmem) == BIO_TYPE_CIPHER) {
1100 + if (!BIO_get_cipher_status(tmpmem))
1106 + if (BIO_write(data, buf, i) != i) {
1110 - BIO_free_all(tmpmem);
1115 + OPENSSL_free(buf);
1116 + BIO_free_all(tmpmem);
1119 diff --git a/crypto/rand/rand_egd.c b/crypto/rand/rand_egd.c
1120 index 737aebf..f23f348 100644
1121 --- a/crypto/rand/rand_egd.c
1122 +++ b/crypto/rand/rand_egd.c
1124 * RAND_egd() is a wrapper for RAND_egd_bytes() with numbytes=255.
1127 -#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)
1128 +#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)
1129 int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
1132 diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c
1133 index 266111e..f60fac6 100644
1134 --- a/crypto/rand/rand_unix.c
1135 +++ b/crypto/rand/rand_unix.c
1137 #include <openssl/rand.h>
1138 #include "rand_lcl.h"
1140 -#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))
1141 +#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))
1143 # include <sys/types.h>
1144 # include <sys/time.h>
1145 @@ -439,7 +439,7 @@ int RAND_poll(void)
1146 * defined(OPENSSL_SYS_VXWORKS) ||
1147 * defined(OPENSSL_SYS_NETWARE)) */
1149 -#if defined(OPENSSL_SYS_VXWORKS)
1150 +#if defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_UEFI)
1154 diff --git a/crypto/rsa/rsa_ameth.c b/crypto/rsa/rsa_ameth.c
1155 index 4e06218..ddead3d 100644
1156 --- a/crypto/rsa/rsa_ameth.c
1157 +++ b/crypto/rsa/rsa_ameth.c
1160 #include "asn1_locl.h"
1162 +#ifndef OPENSSL_NO_CMS
1163 static int rsa_cms_sign(CMS_SignerInfo *si);
1164 static int rsa_cms_verify(CMS_SignerInfo *si);
1165 static int rsa_cms_decrypt(CMS_RecipientInfo *ri);
1166 static int rsa_cms_encrypt(CMS_RecipientInfo *ri);
1169 static int rsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
1171 @@ -665,6 +667,7 @@ static int rsa_pss_to_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pkctx,
1175 +#ifndef OPENSSL_NO_CMS
1176 static int rsa_cms_verify(CMS_SignerInfo *si)
1179 @@ -683,6 +686,7 @@ static int rsa_cms_verify(CMS_SignerInfo *si)
1186 * Customised RSA item verification routine. This is called when a signature
1187 @@ -705,6 +709,7 @@ static int rsa_item_verify(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
1191 +#ifndef OPENSSL_NO_CMS
1192 static int rsa_cms_sign(CMS_SignerInfo *si)
1194 int pad_mode = RSA_PKCS1_PADDING;
1195 @@ -729,6 +734,7 @@ static int rsa_cms_sign(CMS_SignerInfo *si)
1196 X509_ALGOR_set0(alg, OBJ_nid2obj(NID_rsassaPss), V_ASN1_SEQUENCE, os);
1201 static int rsa_item_sign(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
1202 X509_ALGOR *alg1, X509_ALGOR *alg2,
1203 @@ -762,6 +768,7 @@ static int rsa_item_sign(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
1207 +#ifndef OPENSSL_NO_CMS
1208 static RSA_OAEP_PARAMS *rsa_oaep_decode(const X509_ALGOR *alg,
1209 X509_ALGOR **pmaskHash)
1211 @@ -920,6 +927,7 @@ static int rsa_cms_encrypt(CMS_RecipientInfo *ri)
1212 ASN1_STRING_free(os);
1217 const EVP_PKEY_ASN1_METHOD rsa_asn1_meths[] = {
1219 diff --git a/crypto/srp/srp.h b/crypto/srp/srp.h
1220 index 028892a..4ed4bfe 100644
1221 --- a/crypto/srp/srp.h
1222 +++ b/crypto/srp/srp.h
1223 @@ -119,7 +119,9 @@ DECLARE_STACK_OF(SRP_gN)
1225 SRP_VBASE *SRP_VBASE_new(char *seed_key);
1226 int SRP_VBASE_free(SRP_VBASE *vb);
1227 +#ifndef OPENSSL_NO_STDIO
1228 int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file);
1231 /* This method ignores the configured seed and fails for an unknown user. */
1232 SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username);
1233 diff --git a/crypto/srp/srp_vfy.c b/crypto/srp/srp_vfy.c
1234 index 26ad3e0..6be4cf2 100644
1235 --- a/crypto/srp/srp_vfy.c
1236 +++ b/crypto/srp/srp_vfy.c
1237 @@ -225,6 +225,7 @@ static int SRP_user_pwd_set_ids(SRP_user_pwd *vinfo, const char *id,
1238 return (info == NULL || NULL != (vinfo->info = BUF_strdup(info)));
1241 +#ifndef OPENSSL_NO_STDIO
1242 static int SRP_user_pwd_set_sv(SRP_user_pwd *vinfo, const char *s,
1245 @@ -239,6 +240,7 @@ static int SRP_user_pwd_set_sv(SRP_user_pwd *vinfo, const char *s,
1246 len = t_fromb64(tmp, s);
1247 return ((vinfo->s = BN_bin2bn(tmp, len, NULL)) != NULL);
1251 static int SRP_user_pwd_set_sv_BN(SRP_user_pwd *vinfo, BIGNUM *s, BIGNUM *v)
1253 @@ -297,6 +299,7 @@ int SRP_VBASE_free(SRP_VBASE *vb)
1257 +#ifndef OPENSSL_NO_STDIO
1258 static SRP_gN_cache *SRP_gN_new_init(const char *ch)
1260 unsigned char tmp[MAX_LEN];
1261 @@ -328,6 +331,7 @@ static void SRP_gN_free(SRP_gN_cache *gN_cache)
1262 BN_free(gN_cache->bn);
1263 OPENSSL_free(gN_cache);
1267 static SRP_gN *SRP_get_gN_by_id(const char *id, STACK_OF(SRP_gN) *gN_tab)
1269 @@ -344,6 +348,7 @@ static SRP_gN *SRP_get_gN_by_id(const char *id, STACK_OF(SRP_gN) *gN_tab)
1270 return SRP_get_default_gN(id);
1273 +#ifndef OPENSSL_NO_STDIO
1274 static BIGNUM *SRP_gN_place_bn(STACK_OF(SRP_gN_cache) *gN_cache, char *ch)
1277 @@ -485,6 +490,7 @@ int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file)
1283 static SRP_user_pwd *find_user(SRP_VBASE *vb, char *username)
1285 diff --git a/crypto/ts/ts.h b/crypto/ts/ts.h
1286 index 16eccbb..a9fe40e 100644
1287 --- a/crypto/ts/ts.h
1288 +++ b/crypto/ts/ts.h
1289 @@ -281,8 +281,10 @@ TS_REQ *d2i_TS_REQ(TS_REQ **a, const unsigned char **pp, long length);
1291 TS_REQ *TS_REQ_dup(TS_REQ *a);
1293 +#ifndef OPENSSL_NO_FP_API
1294 TS_REQ *d2i_TS_REQ_fp(FILE *fp, TS_REQ **a);
1295 int i2d_TS_REQ_fp(FILE *fp, TS_REQ *a);
1297 TS_REQ *d2i_TS_REQ_bio(BIO *fp, TS_REQ **a);
1298 int i2d_TS_REQ_bio(BIO *fp, TS_REQ *a);
1300 @@ -294,10 +296,12 @@ TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a,
1302 TS_MSG_IMPRINT *TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT *a);
1304 +#ifndef OPENSSL_NO_FP_API
1305 TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT **a);
1306 int i2d_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT *a);
1307 -TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *fp, TS_MSG_IMPRINT **a);
1308 -int i2d_TS_MSG_IMPRINT_bio(BIO *fp, TS_MSG_IMPRINT *a);
1310 +TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT **a);
1311 +int i2d_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT *a);
1313 TS_RESP *TS_RESP_new(void);
1314 void TS_RESP_free(TS_RESP *a);
1315 @@ -306,10 +310,12 @@ TS_RESP *d2i_TS_RESP(TS_RESP **a, const unsigned char **pp, long length);
1316 TS_TST_INFO *PKCS7_to_TS_TST_INFO(PKCS7 *token);
1317 TS_RESP *TS_RESP_dup(TS_RESP *a);
1319 +#ifndef OPENSSL_NO_FP_API
1320 TS_RESP *d2i_TS_RESP_fp(FILE *fp, TS_RESP **a);
1321 int i2d_TS_RESP_fp(FILE *fp, TS_RESP *a);
1322 -TS_RESP *d2i_TS_RESP_bio(BIO *fp, TS_RESP **a);
1323 -int i2d_TS_RESP_bio(BIO *fp, TS_RESP *a);
1325 +TS_RESP *d2i_TS_RESP_bio(BIO *bio, TS_RESP **a);
1326 +int i2d_TS_RESP_bio(BIO *bio, TS_RESP *a);
1328 TS_STATUS_INFO *TS_STATUS_INFO_new(void);
1329 void TS_STATUS_INFO_free(TS_STATUS_INFO *a);
1330 @@ -325,10 +331,12 @@ TS_TST_INFO *d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **pp,
1332 TS_TST_INFO *TS_TST_INFO_dup(TS_TST_INFO *a);
1334 +#ifndef OPENSSL_NO_FP_API
1335 TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a);
1336 int i2d_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO *a);
1337 -TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *fp, TS_TST_INFO **a);
1338 -int i2d_TS_TST_INFO_bio(BIO *fp, TS_TST_INFO *a);
1340 +TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO **a);
1341 +int i2d_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO *a);
1343 TS_ACCURACY *TS_ACCURACY_new(void);
1344 void TS_ACCURACY_free(TS_ACCURACY *a);
1345 @@ -728,15 +736,18 @@ int TS_MSG_IMPRINT_print_bio(BIO *bio, TS_MSG_IMPRINT *msg);
1349 +#ifndef OPENSSL_NO_STDIO
1350 X509 *TS_CONF_load_cert(const char *file);
1351 STACK_OF(X509) *TS_CONF_load_certs(const char *file);
1352 EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass);
1354 const char *TS_CONF_get_tsa_section(CONF *conf, const char *section);
1355 int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb,
1357 int TS_CONF_set_crypto_device(CONF *conf, const char *section,
1358 const char *device);
1359 int TS_CONF_set_default_engine(const char *name);
1360 +#ifndef OPENSSL_NO_STDIO
1361 int TS_CONF_set_signer_cert(CONF *conf, const char *section,
1362 const char *cert, TS_RESP_CTX *ctx);
1363 int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs,
1364 @@ -744,6 +755,7 @@ int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs,
1365 int TS_CONF_set_signer_key(CONF *conf, const char *section,
1366 const char *key, const char *pass,
1369 int TS_CONF_set_def_policy(CONF *conf, const char *section,
1370 const char *policy, TS_RESP_CTX *ctx);
1371 int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx);
1372 @@ -784,6 +796,11 @@ void ERR_load_TS_strings(void);
1373 # define TS_F_TS_CHECK_SIGNING_CERTS 103
1374 # define TS_F_TS_CHECK_STATUS_INFO 104
1375 # define TS_F_TS_COMPUTE_IMPRINT 145
1376 +# define TS_F_TS_CONF_INVALID 151
1377 +# define TS_F_TS_CONF_LOAD_CERT 153
1378 +# define TS_F_TS_CONF_LOAD_CERTS 154
1379 +# define TS_F_TS_CONF_LOAD_KEY 155
1380 +# define TS_F_TS_CONF_LOOKUP_FAIL 152
1381 # define TS_F_TS_CONF_SET_DEFAULT_ENGINE 146
1382 # define TS_F_TS_GET_STATUS_TEXT 105
1383 # define TS_F_TS_MSG_IMPRINT_SET_ALGO 118
1384 @@ -822,6 +839,8 @@ void ERR_load_TS_strings(void);
1386 # define TS_R_BAD_PKCS7_TYPE 132
1387 # define TS_R_BAD_TYPE 133
1388 +# define TS_R_CANNOT_LOAD_CERT 137
1389 +# define TS_R_CANNOT_LOAD_KEY 138
1390 # define TS_R_CERTIFICATE_VERIFY_ERROR 100
1391 # define TS_R_COULD_NOT_SET_ENGINE 127
1392 # define TS_R_COULD_NOT_SET_TIME 115
1393 @@ -854,6 +873,8 @@ void ERR_load_TS_strings(void);
1394 # define TS_R_UNACCEPTABLE_POLICY 125
1395 # define TS_R_UNSUPPORTED_MD_ALGORITHM 126
1396 # define TS_R_UNSUPPORTED_VERSION 113
1397 +# define TS_R_VAR_BAD_VALUE 135
1398 +# define TS_R_VAR_LOOKUP_FAILURE 136
1399 # define TS_R_WRONG_CONTENT_TYPE 114
1402 diff --git a/crypto/ts/ts_conf.c b/crypto/ts/ts_conf.c
1403 index 4716b23..c4416ba 100644
1404 --- a/crypto/ts/ts_conf.c
1405 +++ b/crypto/ts/ts_conf.c
1408 /* Function definitions for certificate and key loading. */
1410 +#ifndef OPENSSL_NO_STDIO
1411 X509 *TS_CONF_load_cert(const char *file)
1414 @@ -102,7 +103,7 @@ X509 *TS_CONF_load_cert(const char *file)
1415 x = PEM_read_bio_X509_AUX(cert, NULL, NULL, NULL);
1418 - fprintf(stderr, "unable to load certificate: %s\n", file);
1419 + TSerr(TS_F_TS_CONF_LOAD_CERT, TS_R_CANNOT_LOAD_CERT);
1423 @@ -129,7 +130,7 @@ STACK_OF(X509) *TS_CONF_load_certs(const char *file)
1426 if (othercerts == NULL)
1427 - fprintf(stderr, "unable to load certificates: %s\n", file);
1428 + TSerr(TS_F_TS_CONF_LOAD_CERTS, TS_R_CANNOT_LOAD_CERT);
1429 sk_X509_INFO_pop_free(allcerts, X509_INFO_free);
1432 @@ -145,21 +146,24 @@ EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass)
1433 pkey = PEM_read_bio_PrivateKey(key, NULL, NULL, (char *)pass);
1436 - fprintf(stderr, "unable to load private key: %s\n", file);
1437 + TSerr(TS_F_TS_CONF_LOAD_KEY, TS_R_CANNOT_LOAD_KEY);
1441 +#endif /* !OPENSSL_NO_STDIO */
1443 /* Function definitions for handling configuration options. */
1445 static void TS_CONF_lookup_fail(const char *name, const char *tag)
1447 - fprintf(stderr, "variable lookup failed for %s::%s\n", name, tag);
1448 + TSerr(TS_F_TS_CONF_LOOKUP_FAIL, TS_R_VAR_LOOKUP_FAILURE);
1449 + ERR_add_error_data(3, name, "::", tag);
1452 static void TS_CONF_invalid(const char *name, const char *tag)
1454 - fprintf(stderr, "invalid variable value for %s::%s\n", name, tag);
1455 + TSerr(TS_F_TS_CONF_INVALID, TS_R_VAR_BAD_VALUE);
1456 + ERR_add_error_data(3, name, "::", tag);
1459 const char *TS_CONF_get_tsa_section(CONF *conf, const char *section)
1460 @@ -237,6 +241,7 @@ int TS_CONF_set_default_engine(const char *name)
1464 +#ifndef OPENSSL_NO_STDIO
1465 int TS_CONF_set_signer_cert(CONF *conf, const char *section,
1466 const char *cert, TS_RESP_CTX *ctx)
1468 @@ -302,6 +307,7 @@ int TS_CONF_set_signer_key(CONF *conf, const char *section,
1469 EVP_PKEY_free(key_obj);
1472 +#endif /* !OPENSSL_NO_STDIO */
1474 int TS_CONF_set_def_policy(CONF *conf, const char *section,
1475 const char *policy, TS_RESP_CTX *ctx)
1476 diff --git a/crypto/ts/ts_err.c b/crypto/ts/ts_err.c
1477 index ff1abf4..3f5b78f 100644
1478 --- a/crypto/ts/ts_err.c
1479 +++ b/crypto/ts/ts_err.c
1481 /* crypto/ts/ts_err.c */
1482 /* ====================================================================
1483 - * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
1484 + * Copyright (c) 1999-2015 The OpenSSL Project. All rights reserved.
1486 * Redistribution and use in source and binary forms, with or without
1487 * modification, are permitted provided that the following conditions
1488 @@ -87,6 +87,11 @@ static ERR_STRING_DATA TS_str_functs[] = {
1489 {ERR_FUNC(TS_F_TS_CHECK_SIGNING_CERTS), "TS_CHECK_SIGNING_CERTS"},
1490 {ERR_FUNC(TS_F_TS_CHECK_STATUS_INFO), "TS_CHECK_STATUS_INFO"},
1491 {ERR_FUNC(TS_F_TS_COMPUTE_IMPRINT), "TS_COMPUTE_IMPRINT"},
1492 + {ERR_FUNC(TS_F_TS_CONF_INVALID), "ts_CONF_invalid"},
1493 + {ERR_FUNC(TS_F_TS_CONF_LOAD_CERT), "TS_CONF_load_cert"},
1494 + {ERR_FUNC(TS_F_TS_CONF_LOAD_CERTS), "TS_CONF_load_certs"},
1495 + {ERR_FUNC(TS_F_TS_CONF_LOAD_KEY), "TS_CONF_load_key"},
1496 + {ERR_FUNC(TS_F_TS_CONF_LOOKUP_FAIL), "ts_CONF_lookup_fail"},
1497 {ERR_FUNC(TS_F_TS_CONF_SET_DEFAULT_ENGINE), "TS_CONF_set_default_engine"},
1498 {ERR_FUNC(TS_F_TS_GET_STATUS_TEXT), "TS_GET_STATUS_TEXT"},
1499 {ERR_FUNC(TS_F_TS_MSG_IMPRINT_SET_ALGO), "TS_MSG_IMPRINT_set_algo"},
1500 @@ -132,6 +137,8 @@ static ERR_STRING_DATA TS_str_functs[] = {
1501 static ERR_STRING_DATA TS_str_reasons[] = {
1502 {ERR_REASON(TS_R_BAD_PKCS7_TYPE), "bad pkcs7 type"},
1503 {ERR_REASON(TS_R_BAD_TYPE), "bad type"},
1504 + {ERR_REASON(TS_R_CANNOT_LOAD_CERT), "cannot load certificate"},
1505 + {ERR_REASON(TS_R_CANNOT_LOAD_KEY), "cannot load private key"},
1506 {ERR_REASON(TS_R_CERTIFICATE_VERIFY_ERROR), "certificate verify error"},
1507 {ERR_REASON(TS_R_COULD_NOT_SET_ENGINE), "could not set engine"},
1508 {ERR_REASON(TS_R_COULD_NOT_SET_TIME), "could not set time"},
1509 @@ -170,6 +177,8 @@ static ERR_STRING_DATA TS_str_reasons[] = {
1510 {ERR_REASON(TS_R_UNACCEPTABLE_POLICY), "unacceptable policy"},
1511 {ERR_REASON(TS_R_UNSUPPORTED_MD_ALGORITHM), "unsupported md algorithm"},
1512 {ERR_REASON(TS_R_UNSUPPORTED_VERSION), "unsupported version"},
1513 + {ERR_REASON(TS_R_VAR_BAD_VALUE), "var bad value"},
1514 + {ERR_REASON(TS_R_VAR_LOOKUP_FAILURE), "cannot find config variable"},
1515 {ERR_REASON(TS_R_WRONG_CONTENT_TYPE), "wrong content type"},
1518 diff --git a/crypto/ui/ui_util.c b/crypto/ui/ui_util.c
1519 index 0f29011..80dd40e 100644
1520 --- a/crypto/ui/ui_util.c
1521 +++ b/crypto/ui/ui_util.c
1524 #include "ui_locl.h"
1530 int UI_UTIL_read_pw_string(char *buf, int length, const char *prompt,
1533 diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c
1534 index 9ee8f8d..64b052e 100644
1535 --- a/crypto/x509/by_dir.c
1536 +++ b/crypto/x509/by_dir.c
1538 # include <sys/stat.h>
1541 +#ifndef OPENSSL_NO_STDIO
1543 #include <openssl/lhash.h>
1544 #include <openssl/x509.h>
1546 @@ -434,3 +436,5 @@ static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
1551 +#endif /* OPENSSL_NO_STDIO */
1552 diff --git a/crypto/x509/x509_vfy.c b/crypto/x509/x509_vfy.c
1553 index 4d34dba..25e8a89 100644
1554 --- a/crypto/x509/x509_vfy.c
1555 +++ b/crypto/x509/x509_vfy.c
1556 @@ -950,6 +950,8 @@ static int check_crl_time(X509_STORE_CTX *ctx, X509_CRL *crl, int notify)
1557 ctx->current_crl = crl;
1558 if (ctx->param->flags & X509_V_FLAG_USE_CHECK_TIME)
1559 ptime = &ctx->param->check_time;
1560 + else if (ctx->param->flags & X509_V_FLAG_NO_CHECK_TIME)
1565 @@ -1673,6 +1675,8 @@ static int check_cert_time(X509_STORE_CTX *ctx, X509 *x)
1567 if (ctx->param->flags & X509_V_FLAG_USE_CHECK_TIME)
1568 ptime = &ctx->param->check_time;
1569 + else if (ctx->param->flags & X509_V_FLAG_NO_CHECK_TIME)
1574 diff --git a/crypto/x509/x509_vfy.h b/crypto/x509/x509_vfy.h
1575 index 2663e1c..3790ef5 100644
1576 --- a/crypto/x509/x509_vfy.h
1577 +++ b/crypto/x509/x509_vfy.h
1578 @@ -438,6 +438,8 @@ void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth);
1579 * will force the behaviour to match that of previous versions.
1581 # define X509_V_FLAG_NO_ALT_CHAINS 0x100000
1582 +/* Do not check certificate/CRL validity against current time */
1583 +# define X509_V_FLAG_NO_CHECK_TIME 0x200000
1585 # define X509_VP_FLAG_DEFAULT 0x1
1586 # define X509_VP_FLAG_OVERWRITE 0x2
1587 @@ -490,9 +492,10 @@ void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx);
1588 X509_STORE *X509_STORE_CTX_get0_store(X509_STORE_CTX *ctx);
1590 X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m);
1592 +#ifndef OPENSSL_NO_STDIO
1593 X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void);
1594 X509_LOOKUP_METHOD *X509_LOOKUP_file(void);
1597 int X509_STORE_add_cert(X509_STORE *ctx, X509 *x);
1598 int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x);
1599 diff --git a/crypto/x509v3/ext_dat.h b/crypto/x509v3/ext_dat.h
1600 index c3a6fce..09ebbca 100644
1601 --- a/crypto/x509v3/ext_dat.h
1602 +++ b/crypto/x509v3/ext_dat.h
1603 @@ -127,8 +127,10 @@ static const X509V3_EXT_METHOD *standard_exts[] = {
1607 +#ifndef OPENSSL_NO_SCT
1613 /* Number of standard extensions */
1614 diff --git a/crypto/x509v3/v3_pci.c b/crypto/x509v3/v3_pci.c
1615 index 34cad53..12f12a7 100644
1616 --- a/crypto/x509v3/v3_pci.c
1617 +++ b/crypto/x509v3/v3_pci.c
1618 @@ -149,6 +149,7 @@ static int process_pci_value(CONF_VALUE *val,
1621 OPENSSL_free(tmp_data2);
1622 +#ifndef OPENSSL_NO_STDIO
1623 } else if (strncmp(val->value, "file:", 5) == 0) {
1624 unsigned char buf[2048];
1626 @@ -181,6 +182,7 @@ static int process_pci_value(CONF_VALUE *val,
1627 X509V3_conf_err(val);
1630 +#endif /* !OPENSSL_NO_STDIO */
1631 } else if (strncmp(val->value, "text:", 5) == 0) {
1632 val_len = strlen(val->value + 5);
1633 tmp_data = OPENSSL_realloc((*policy)->data,
1634 diff --git a/crypto/x509v3/v3_scts.c b/crypto/x509v3/v3_scts.c
1635 index 0b7c681..1895b8f 100644
1636 --- a/crypto/x509v3/v3_scts.c
1637 +++ b/crypto/x509v3/v3_scts.c
1639 #include <openssl/asn1.h>
1640 #include <openssl/x509v3.h>
1642 +#ifndef OPENSSL_NO_SCT
1643 /* Signature and hash algorithms from RFC 5246 */
1644 #define TLSEXT_hash_sha256 4
1646 @@ -332,3 +333,4 @@ static int i2r_SCT_LIST(X509V3_EXT_METHOD *method, STACK_OF(SCT) *sct_list,
1651 diff --git a/crypto/x509v3/x509v3.h b/crypto/x509v3/x509v3.h
1652 index f5c6156..a2e78aa 100644
1653 --- a/crypto/x509v3/x509v3.h
1654 +++ b/crypto/x509v3/x509v3.h
1655 @@ -688,8 +688,9 @@ void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent,
1657 int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag,
1659 +#ifndef OPENSSL_NO_FP_API
1660 int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent);
1663 int X509V3_extensions_print(BIO *out, char *title,
1664 STACK_OF(X509_EXTENSION) *exts,
1665 unsigned long flag, int indent);
1666 diff --git a/demos/engines/cluster_labs/hw_cluster_labs_err.h b/demos/engines/cluster_labs/hw_cluster_labs_err.h
1667 index 3300e11..e9e58d5 100644
1668 --- a/demos/engines/cluster_labs/hw_cluster_labs_err.h
1669 +++ b/demos/engines/cluster_labs/hw_cluster_labs_err.h
1670 @@ -67,7 +67,7 @@ extern "C" {
1671 static void ERR_load_CL_strings(void);
1672 static void ERR_unload_CL_strings(void);
1673 static void ERR_CL_error(int function, int reason, char *file, int line);
1674 -# define CLerr(f,r) ERR_CL_error((f),(r),__FILE__,__LINE__)
1675 +# define CLerr(f,r) ERR_CL_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1677 /* Error codes for the CL functions. */
1679 diff --git a/demos/engines/ibmca/hw_ibmca_err.h b/demos/engines/ibmca/hw_ibmca_err.h
1680 index c17e0c9..10d0212 100644
1681 --- a/demos/engines/ibmca/hw_ibmca_err.h
1682 +++ b/demos/engines/ibmca/hw_ibmca_err.h
1683 @@ -67,7 +67,7 @@ extern "C" {
1684 static void ERR_load_IBMCA_strings(void);
1685 static void ERR_unload_IBMCA_strings(void);
1686 static void ERR_IBMCA_error(int function, int reason, char *file, int line);
1687 -# define IBMCAerr(f,r) ERR_IBMCA_error((f),(r),__FILE__,__LINE__)
1688 +# define IBMCAerr(f,r) ERR_IBMCA_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1690 /* Error codes for the IBMCA functions. */
1692 diff --git a/demos/engines/rsaref/rsaref_err.h b/demos/engines/rsaref/rsaref_err.h
1693 index 4356815..598836f 100644
1694 --- a/demos/engines/rsaref/rsaref_err.h
1695 +++ b/demos/engines/rsaref/rsaref_err.h
1696 @@ -68,7 +68,7 @@ extern "C" {
1697 static void ERR_load_RSAREF_strings(void);
1698 static void ERR_unload_RSAREF_strings(void);
1699 static void ERR_RSAREF_error(int function, int reason, char *file, int line);
1700 -# define RSAREFerr(f,r) ERR_RSAREF_error((f),(r),__FILE__,__LINE__)
1701 +# define RSAREFerr(f,r) ERR_RSAREF_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1702 /* Error codes for the RSAREF functions. */
1704 /* Function codes. */
1705 diff --git a/demos/engines/zencod/hw_zencod_err.h b/demos/engines/zencod/hw_zencod_err.h
1706 index f4a8358..94d3293 100644
1707 --- a/demos/engines/zencod/hw_zencod_err.h
1708 +++ b/demos/engines/zencod/hw_zencod_err.h
1709 @@ -67,7 +67,7 @@ extern "C" {
1710 static void ERR_load_ZENCOD_strings(void);
1711 static void ERR_unload_ZENCOD_strings(void);
1712 static void ERR_ZENCOD_error(int function, int reason, char *file, int line);
1713 -# define ZENCODerr(f,r) ERR_ZENCOD_error((f),(r),__FILE__,__LINE__)
1714 +# define ZENCODerr(f,r) ERR_ZENCOD_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1716 /* Error codes for the ZENCOD functions. */
1718 diff --git a/doc/crypto/X509_VERIFY_PARAM_set_flags.pod b/doc/crypto/X509_VERIFY_PARAM_set_flags.pod
1719 index 44792f9..7f95d58 100644
1720 --- a/doc/crypto/X509_VERIFY_PARAM_set_flags.pod
1721 +++ b/doc/crypto/X509_VERIFY_PARAM_set_flags.pod
1722 @@ -203,6 +203,10 @@ chain found is not trusted, then OpenSSL will continue to check to see if an
1723 alternative chain can be found that is trusted. With this flag set the behaviour
1724 will match that of OpenSSL versions prior to 1.0.2b.
1726 +The B<X509_V_FLAG_NO_CHECK_TIME> flag suppresses checking the validity period
1727 +of certificates and CRLs against the current time. If X509_VERIFY_PARAM_set_time()
1728 +is used to specify a verification time, the check is not suppressed.
1732 The above functions should be used to manipulate verification parameters
1733 diff --git a/doc/crypto/threads.pod b/doc/crypto/threads.pod
1734 index dc0e939..fe123bb 100644
1735 --- a/doc/crypto/threads.pod
1736 +++ b/doc/crypto/threads.pod
1737 @@ -51,15 +51,15 @@ CRYPTO_destroy_dynlockid, CRYPTO_lock - OpenSSL thread support
1738 void CRYPTO_lock(int mode, int n, const char *file, int line);
1740 #define CRYPTO_w_lock(type) \
1741 - CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
1742 + CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,OPENSSL_FILE,OPENSSL_LINE)
1743 #define CRYPTO_w_unlock(type) \
1744 - CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
1745 + CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,OPENSSL_FILE,OPENSSL_LINE)
1746 #define CRYPTO_r_lock(type) \
1747 - CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__)
1748 + CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,OPENSSL_FILE,OPENSSL_LINE)
1749 #define CRYPTO_r_unlock(type) \
1750 - CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__)
1751 + CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,OPENSSL_FILE,OPENSSL_LINE)
1752 #define CRYPTO_add(addr,amount,type) \
1753 - CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__)
1754 + CRYPTO_add_lock(addr,amount,type,OPENSSL_FILE,OPENSSL_LINE)
1758 diff --git a/e_os.h b/e_os.h
1759 index 1fa36c1..3e9dae2 100644
1762 @@ -136,7 +136,7 @@ extern "C" {
1766 -# if defined(MSDOS) && !defined(GETPID_IS_MEANINGLESS)
1767 +# if (defined(MSDOS) || defined(OPENSSL_SYS_UEFI)) && !defined(GETPID_IS_MEANINGLESS)
1768 # define GETPID_IS_MEANINGLESS
1771 diff --git a/e_os2.h b/e_os2.h
1772 index 7be9989..909e22f 100644
1775 @@ -97,7 +97,14 @@ extern "C" {
1776 * For 32 bit environment, there seems to be the CygWin environment and then
1777 * all the others that try to do the same thing Microsoft does...
1779 -# if defined(OPENSSL_SYSNAME_UWIN)
1781 + * UEFI lives here because it might be built with a Microsoft toolchain and
1782 + * we need to avoid the false positive match on Windows.
1784 +# if defined(OPENSSL_SYSNAME_UEFI)
1785 +# undef OPENSSL_SYS_UNIX
1786 +# define OPENSSL_SYS_UEFI
1787 +# elif defined(OPENSSL_SYSNAME_UWIN)
1788 # undef OPENSSL_SYS_UNIX
1789 # define OPENSSL_SYS_WIN32_UWIN
1791 diff --git a/engines/ccgost/e_gost_err.h b/engines/ccgost/e_gost_err.h
1792 index a2018ec..9eacdcf 100644
1793 --- a/engines/ccgost/e_gost_err.h
1794 +++ b/engines/ccgost/e_gost_err.h
1795 @@ -67,7 +67,7 @@ extern "C" {
1796 void ERR_load_GOST_strings(void);
1797 void ERR_unload_GOST_strings(void);
1798 void ERR_GOST_error(int function, int reason, char *file, int line);
1799 -# define GOSTerr(f,r) ERR_GOST_error((f),(r),__FILE__,__LINE__)
1800 +# define GOSTerr(f,r) ERR_GOST_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1802 /* Error codes for the GOST functions. */
1804 diff --git a/engines/e_4758cca_err.h b/engines/e_4758cca_err.h
1805 index 2f29d96..47a2635 100644
1806 --- a/engines/e_4758cca_err.h
1807 +++ b/engines/e_4758cca_err.h
1808 @@ -67,7 +67,7 @@ extern "C" {
1809 static void ERR_load_CCA4758_strings(void);
1810 static void ERR_unload_CCA4758_strings(void);
1811 static void ERR_CCA4758_error(int function, int reason, char *file, int line);
1812 -# define CCA4758err(f,r) ERR_CCA4758_error((f),(r),__FILE__,__LINE__)
1813 +# define CCA4758err(f,r) ERR_CCA4758_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1815 /* Error codes for the CCA4758 functions. */
1817 diff --git a/engines/e_aep_err.h b/engines/e_aep_err.h
1818 index 2ed0114..1f8fa5b 100644
1819 --- a/engines/e_aep_err.h
1820 +++ b/engines/e_aep_err.h
1821 @@ -67,7 +67,7 @@ extern "C" {
1822 static void ERR_load_AEPHK_strings(void);
1823 static void ERR_unload_AEPHK_strings(void);
1824 static void ERR_AEPHK_error(int function, int reason, char *file, int line);
1825 -# define AEPHKerr(f,r) ERR_AEPHK_error((f),(r),__FILE__,__LINE__)
1826 +# define AEPHKerr(f,r) ERR_AEPHK_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1828 /* Error codes for the AEPHK functions. */
1830 diff --git a/engines/e_atalla_err.h b/engines/e_atalla_err.h
1831 index 7b71eff..d958496 100644
1832 --- a/engines/e_atalla_err.h
1833 +++ b/engines/e_atalla_err.h
1834 @@ -67,7 +67,7 @@ extern "C" {
1835 static void ERR_load_ATALLA_strings(void);
1836 static void ERR_unload_ATALLA_strings(void);
1837 static void ERR_ATALLA_error(int function, int reason, char *file, int line);
1838 -# define ATALLAerr(f,r) ERR_ATALLA_error((f),(r),__FILE__,__LINE__)
1839 +# define ATALLAerr(f,r) ERR_ATALLA_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1841 /* Error codes for the ATALLA functions. */
1843 diff --git a/engines/e_capi_err.h b/engines/e_capi_err.h
1844 index b5d06dc..cfe46b1 100644
1845 --- a/engines/e_capi_err.h
1846 +++ b/engines/e_capi_err.h
1847 @@ -67,7 +67,7 @@ extern "C" {
1848 static void ERR_load_CAPI_strings(void);
1849 static void ERR_unload_CAPI_strings(void);
1850 static void ERR_CAPI_error(int function, int reason, char *file, int line);
1851 -# define CAPIerr(f,r) ERR_CAPI_error((f),(r),__FILE__,__LINE__)
1852 +# define CAPIerr(f,r) ERR_CAPI_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1854 /* Error codes for the CAPI functions. */
1856 diff --git a/engines/e_chil_err.h b/engines/e_chil_err.h
1857 index d86a4ce..3d961b9 100644
1858 --- a/engines/e_chil_err.h
1859 +++ b/engines/e_chil_err.h
1860 @@ -67,7 +67,7 @@ extern "C" {
1861 static void ERR_load_HWCRHK_strings(void);
1862 static void ERR_unload_HWCRHK_strings(void);
1863 static void ERR_HWCRHK_error(int function, int reason, char *file, int line);
1864 -# define HWCRHKerr(f,r) ERR_HWCRHK_error((f),(r),__FILE__,__LINE__)
1865 +# define HWCRHKerr(f,r) ERR_HWCRHK_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1867 /* Error codes for the HWCRHK functions. */
1869 diff --git a/engines/e_cswift_err.h b/engines/e_cswift_err.h
1870 index fde3a82..7c20691 100644
1871 --- a/engines/e_cswift_err.h
1872 +++ b/engines/e_cswift_err.h
1873 @@ -67,7 +67,7 @@ extern "C" {
1874 static void ERR_load_CSWIFT_strings(void);
1875 static void ERR_unload_CSWIFT_strings(void);
1876 static void ERR_CSWIFT_error(int function, int reason, char *file, int line);
1877 -# define CSWIFTerr(f,r) ERR_CSWIFT_error((f),(r),__FILE__,__LINE__)
1878 +# define CSWIFTerr(f,r) ERR_CSWIFT_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1880 /* Error codes for the CSWIFT functions. */
1882 diff --git a/engines/e_gmp_err.h b/engines/e_gmp_err.h
1883 index 637abbc..ccaf3da 100644
1884 --- a/engines/e_gmp_err.h
1885 +++ b/engines/e_gmp_err.h
1886 @@ -67,7 +67,7 @@ extern "C" {
1887 static void ERR_load_GMP_strings(void);
1888 static void ERR_unload_GMP_strings(void);
1889 static void ERR_GMP_error(int function, int reason, char *file, int line);
1890 -# define GMPerr(f,r) ERR_GMP_error((f),(r),__FILE__,__LINE__)
1891 +# define GMPerr(f,r) ERR_GMP_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1893 /* Error codes for the GMP functions. */
1895 diff --git a/engines/e_nuron_err.h b/engines/e_nuron_err.h
1896 index aa7849c..e607d3e 100644
1897 --- a/engines/e_nuron_err.h
1898 +++ b/engines/e_nuron_err.h
1899 @@ -67,7 +67,7 @@ extern "C" {
1900 static void ERR_load_NURON_strings(void);
1901 static void ERR_unload_NURON_strings(void);
1902 static void ERR_NURON_error(int function, int reason, char *file, int line);
1903 -# define NURONerr(f,r) ERR_NURON_error((f),(r),__FILE__,__LINE__)
1904 +# define NURONerr(f,r) ERR_NURON_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1906 /* Error codes for the NURON functions. */
1908 diff --git a/engines/e_sureware_err.h b/engines/e_sureware_err.h
1909 index bef8623..54f2848 100644
1910 --- a/engines/e_sureware_err.h
1911 +++ b/engines/e_sureware_err.h
1912 @@ -68,7 +68,7 @@ static void ERR_load_SUREWARE_strings(void);
1913 static void ERR_unload_SUREWARE_strings(void);
1914 static void ERR_SUREWARE_error(int function, int reason, char *file,
1916 -# define SUREWAREerr(f,r) ERR_SUREWARE_error((f),(r),__FILE__,__LINE__)
1917 +# define SUREWAREerr(f,r) ERR_SUREWARE_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1919 /* Error codes for the SUREWARE functions. */
1921 diff --git a/engines/e_ubsec_err.h b/engines/e_ubsec_err.h
1922 index c8aec7c..67110ed 100644
1923 --- a/engines/e_ubsec_err.h
1924 +++ b/engines/e_ubsec_err.h
1925 @@ -67,7 +67,7 @@ extern "C" {
1926 static void ERR_load_UBSEC_strings(void);
1927 static void ERR_unload_UBSEC_strings(void);
1928 static void ERR_UBSEC_error(int function, int reason, char *file, int line);
1929 -# define UBSECerr(f,r) ERR_UBSEC_error((f),(r),__FILE__,__LINE__)
1930 +# define UBSECerr(f,r) ERR_UBSEC_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1932 /* Error codes for the UBSEC functions. */
1934 diff --git a/makevms.com b/makevms.com
1935 index f6b3ff2..1dcbe36 100755
1938 @@ -293,6 +293,7 @@ $ CONFIG_LOGICALS := AES,-
1946 diff --git a/ssl/d1_both.c b/ssl/d1_both.c
1947 index 5d26c94..ee3f49b 100644
1950 @@ -1053,7 +1053,7 @@ int dtls1_send_change_cipher_spec(SSL *s, int a, int b)
1951 int dtls1_read_failed(SSL *s, int code)
1954 - fprintf(stderr, "invalid state reached %s:%d", __FILE__, __LINE__);
1955 + fprintf(stderr, "dtls1_read_failed(); invalid state reached\n");
1959 diff --git a/ssl/ssl_asn1.c b/ssl/ssl_asn1.c
1960 index 35cc27c..a1f5335 100644
1961 --- a/ssl/ssl_asn1.c
1962 +++ b/ssl/ssl_asn1.c
1963 @@ -418,7 +418,7 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,
1964 if (ssl_version == SSL2_VERSION) {
1965 if (os.length != 3) {
1966 c.error = SSL_R_CIPHER_CODE_WRONG_LENGTH;
1967 - c.line = __LINE__;
1968 + c.line = OPENSSL_LINE;
1972 @@ -429,14 +429,14 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,
1973 || ssl_version == DTLS1_BAD_VER) {
1974 if (os.length != 2) {
1975 c.error = SSL_R_CIPHER_CODE_WRONG_LENGTH;
1976 - c.line = __LINE__;
1977 + c.line = OPENSSL_LINE;
1981 ((unsigned long)os.data[0] << 8L) | (unsigned long)os.data[1];
1983 c.error = SSL_R_UNKNOWN_SSL_VERSION;
1984 - c.line = __LINE__;
1985 + c.line = OPENSSL_LINE;
1989 @@ -526,7 +526,7 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,
1990 if (os.data != NULL) {
1991 if (os.length > SSL_MAX_SID_CTX_LENGTH) {
1992 c.error = SSL_R_BAD_LENGTH;
1993 - c.line = __LINE__;
1994 + c.line = OPENSSL_LINE;
1997 ret->sid_ctx_length = os.length;
1998 diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c
1999 index f48ebae..ac4f08c 100644
2000 --- a/ssl/ssl_cert.c
2001 +++ b/ssl/ssl_cert.c
2002 @@ -857,12 +857,12 @@ int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x)
2003 return (add_client_CA(&(ctx->client_CA), x));
2006 +#ifndef OPENSSL_NO_STDIO
2007 static int xname_cmp(const X509_NAME *const *a, const X509_NAME *const *b)
2009 return (X509_NAME_cmp(*a, *b));
2012 -#ifndef OPENSSL_NO_STDIO
2014 * Load CA certs from a file into a ::STACK. Note that it is somewhat misnamed;
2015 * it doesn't really have anything to do with clients (except that a common use
2016 @@ -930,7 +930,6 @@ STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file)
2023 * Add a file of certs to a stack.
2024 @@ -1050,6 +1049,7 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
2025 CRYPTO_w_unlock(CRYPTO_LOCK_READDIR);
2028 +#endif /* !OPENSSL_NO_STDIO */
2030 /* Add a certificate to a BUF_MEM structure */
2032 diff --git a/ssl/ssl_conf.c b/ssl/ssl_conf.c
2033 index 8d3709d..2bb403b 100644
2034 --- a/ssl/ssl_conf.c
2035 +++ b/ssl/ssl_conf.c
2036 @@ -370,6 +370,7 @@ static int cmd_Options(SSL_CONF_CTX *cctx, const char *value)
2037 return CONF_parse_list(value, ',', 1, ssl_set_option_list, cctx);
2040 +#ifndef OPENSSL_NO_STDIO
2041 static int cmd_Certificate(SSL_CONF_CTX *cctx, const char *value)
2044 @@ -436,7 +437,9 @@ static int cmd_DHParameters(SSL_CONF_CTX *cctx, const char *value)
2049 +#endif /* !OPENSSL_NO_DH */
2050 +#endif /* !OPENSSL_NO_STDIO */
2053 int (*cmd) (SSL_CONF_CTX *cctx, const char *value);
2054 const char *str_file;
2055 @@ -462,12 +465,14 @@ static const ssl_conf_cmd_tbl ssl_conf_cmds[] = {
2056 SSL_CONF_CMD_STRING(CipherString, "cipher"),
2057 SSL_CONF_CMD_STRING(Protocol, NULL),
2058 SSL_CONF_CMD_STRING(Options, NULL),
2059 +#ifndef OPENSSL_NO_STDIO
2060 SSL_CONF_CMD(Certificate, "cert", SSL_CONF_TYPE_FILE),
2061 SSL_CONF_CMD(PrivateKey, "key", SSL_CONF_TYPE_FILE),
2062 SSL_CONF_CMD(ServerInfoFile, NULL, SSL_CONF_TYPE_FILE),
2063 #ifndef OPENSSL_NO_DH
2064 SSL_CONF_CMD(DHParameters, "dhparam", SSL_CONF_TYPE_FILE)
2069 static int ssl_conf_cmd_skip_prefix(SSL_CONF_CTX *cctx, const char **pcmd)
2070 diff --git a/ssl/t1_enc.c b/ssl/t1_enc.c
2071 index 514fcb3..2a54cc9 100644
2074 @@ -780,9 +780,7 @@ int tls1_enc(SSL *s, int send)
2075 * we can't write into the input stream: Can this ever
2079 - "%s:%d: rec->data != rec->input\n",
2080 - __FILE__, __LINE__);
2081 + fprintf(stderr, "tls1_enc: rec->data != rec->input\n");
2082 else if (RAND_bytes(rec->input, ivlen) <= 0)
2085 diff --git a/test/cms-test.pl b/test/cms-test.pl
2086 index baa3b59..1ee3f02 100644
2087 --- a/test/cms-test.pl
2088 +++ b/test/cms-test.pl
2089 @@ -100,6 +100,13 @@ my $no_ec2m;
2091 my $ossl8 = `$ossl_path version -v` =~ /0\.9\.8/;
2093 +system ("$ossl_path no-cms > $null_path");
2096 + print "CMS disabled\n";
2100 system ("$ossl_path no-ec > $null_path");
2103 diff --git a/util/libeay.num b/util/libeay.num
2104 index 2094ab3..992abb2 100755
2105 --- a/util/libeay.num
2106 +++ b/util/libeay.num
2107 @@ -4370,7 +4370,7 @@ DH_compute_key_padded 4732 EXIST::FUNCTION:DH
2108 ECDSA_METHOD_set_sign 4733 EXIST::FUNCTION:ECDSA
2109 CMS_RecipientEncryptedKey_cert_cmp 4734 EXIST:!VMS:FUNCTION:CMS
2110 CMS_RecipEncryptedKey_cert_cmp 4734 EXIST:VMS:FUNCTION:CMS
2111 -DH_KDF_X9_42 4735 EXIST::FUNCTION:DH
2112 +DH_KDF_X9_42 4735 EXIST::FUNCTION:CMS,DH
2113 RSA_OAEP_PARAMS_free 4736 EXIST::FUNCTION:RSA
2114 EVP_des_ede3_wrap 4737 EXIST::FUNCTION:DES
2115 RSA_OAEP_PARAMS_it 4738 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RSA
2116 diff --git a/util/mkdef.pl b/util/mkdef.pl
2117 index b9b159a..9841498 100755
2120 @@ -97,6 +97,8 @@ my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF",
2121 "FP_API", "STDIO", "SOCK", "KRB5", "DGRAM",
2123 "STATIC_ENGINE", "ENGINE", "HW", "GMP",
2124 + # X.509v3 Signed Certificate Timestamps
2129 @@ -144,7 +146,7 @@ my $no_md2; my $no_md4; my $no_md5; my $no_sha; my $no_ripemd; my $no_mdc2;
2130 my $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=0; my $no_aes; my $no_krb5;
2131 my $no_ec; my $no_ecdsa; my $no_ecdh; my $no_engine; my $no_hw;
2132 my $no_fp_api; my $no_static_engine=1; my $no_gmp; my $no_deprecated;
2133 -my $no_rfc3779; my $no_psk; my $no_tlsext; my $no_cms; my $no_capieng;
2134 +my $no_sct; my $no_rfc3779; my $no_psk; my $no_tlsext; my $no_cms; my $no_capieng;
2135 my $no_jpake; my $no_srp; my $no_ssl2; my $no_ec2m; my $no_nistp_gcc;
2136 my $no_nextprotoneg; my $no_sctp; my $no_srtp; my $no_ssl_trace;
2137 my $no_unit_test; my $no_ssl3_method; my $no_ssl2_method;
2138 @@ -235,6 +237,7 @@ foreach (@ARGV, split(/ /, $options))
2139 elsif (/^no-engine$/) { $no_engine=1; }
2140 elsif (/^no-hw$/) { $no_hw=1; }
2141 elsif (/^no-gmp$/) { $no_gmp=1; }
2142 + elsif (/^no-sct$/) { $no_sct=1; }
2143 elsif (/^no-rfc3779$/) { $no_rfc3779=1; }
2144 elsif (/^no-tlsext$/) { $no_tlsext=1; }
2145 elsif (/^no-cms$/) { $no_cms=1; }
2146 @@ -1209,6 +1212,7 @@ sub is_valid
2147 if ($keyword eq "FP_API" && $no_fp_api) { return 0; }
2148 if ($keyword eq "STATIC_ENGINE" && $no_static_engine) { return 0; }
2149 if ($keyword eq "GMP" && $no_gmp) { return 0; }
2150 + if ($keyword eq "SCT" && $no_sct) { return 0; }
2151 if ($keyword eq "RFC3779" && $no_rfc3779) { return 0; }
2152 if ($keyword eq "TLSEXT" && $no_tlsext) { return 0; }
2153 if ($keyword eq "PSK" && $no_psk) { return 0; }
2154 diff --git a/util/mkerr.pl b/util/mkerr.pl
2155 index 09ebebe..cd57ade 100644
2158 @@ -89,7 +89,7 @@ Options:
2159 void ERR_load_<LIB>_strings(void);
2160 void ERR_unload_<LIB>_strings(void);
2161 void ERR_<LIB>_error(int f, int r, char *fn, int ln);
2162 - #define <LIB>err(f,r) ERR_<LIB>_error(f,r,__FILE__,__LINE__)
2163 + #define <LIB>err(f,r) ERR_<LIB>_error(f,r,OPENSSL_FILE,OPENSSL_LINE)
2164 while the code facilitates the use of these in an environment
2165 where the error support routines are dynamically loaded at
2167 @@ -474,7 +474,7 @@ EOF
2168 ${staticloader}void ERR_load_${lib}_strings(void);
2169 ${staticloader}void ERR_unload_${lib}_strings(void);
2170 ${staticloader}void ERR_${lib}_error(int function, int reason, char *file, int line);
2171 -# define ${lib}err(f,r) ERR_${lib}_error((f),(r),__FILE__,__LINE__)
2172 +# define ${lib}err(f,r) ERR_${lib}_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)