]> git.proxmox.com Git - mirror_edk2.git/blob - CryptoPkg/Library/OpensslLib/EDKII_openssl-1.0.2j.patch
ArmPkg: remove unused PcdArmUncachedMemoryMask PCD
[mirror_edk2.git] / CryptoPkg / Library / OpensslLib / EDKII_openssl-1.0.2j.patch
1 diff --git a/Configure b/Configure
2 index c39f71a..98dd1d0 100755
3 --- a/Configure
4 +++ b/Configure
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",
8
9 +# UEFI
10 +"UEFI", "cc:-DL_ENDIAN -O:::UEFI::::",
11 +
12 # UWIN
13 "UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32",
14
15 @@ -1083,7 +1086,7 @@ if (defined($disabled{"md5"}) || defined($disabled{"sha"})
16 }
17
18 if (defined($disabled{"ec"}) || defined($disabled{"dsa"})
19 - || defined($disabled{"dh"}))
20 + || defined($disabled{"dh"}) || defined($disabled{"stdio"}))
21 {
22 $disabled{"gost"} = "forced";
23 }
24 diff --git a/apps/apps.c b/apps/apps.c
25 index 9fdc3e0..6c183b0 100644
26 --- a/apps/apps.c
27 +++ b/apps/apps.c
28 @@ -2375,6 +2375,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;
34 else if (!strcmp(arg, "-allow_proxy_certs"))
35 flags |= X509_V_FLAG_ALLOW_PROXY_CERTS;
36 else
37 diff --git a/crypto/asn1/a_strex.c b/crypto/asn1/a_strex.c
38 index 2d562f9..91203b7 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)
42 return 1;
43 }
44
45 +#ifndef OPENSSL_NO_FP_API
46 static int send_fp_chars(void *arg, const void *buf, int len)
47 {
48 if (!arg)
49 @@ -112,6 +113,7 @@ static int send_fp_chars(void *arg, const void *buf, int len)
50 return 0;
51 return 1;
52 }
53 +#endif
54
55 typedef int char_io (void *arg, const void *buf, int len);
56
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" {
62 # endif
63
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))
67
68 # define M_ASN1_D2I_vars(a,type,func) \
69 ASN1_const_CTX c; \
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; } } \
76 else ret=(*a);
77
78 # define M_ASN1_D2I_Init() \
79 @@ -90,7 +90,7 @@ extern "C" {
80
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; \
87 return(ret);
88 @@ -105,7 +105,7 @@ err:\
89
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() \
96 c.slen = length;
97 @@ -129,21 +129,21 @@ err:\
98 # define M_ASN1_D2I_get(b, func) \
99 c.q=c.p; \
100 if (func(&(b),&c.p,c.slen) == NULL) \
101 - {c.line=__LINE__; goto err; } \
102 + {c.line=OPENSSL_LINE; goto err; } \
103 c.slen-=(c.p-c.q);
104
105 /* Don't use this with d2i_ASN1_BOOLEAN() */
106 # define M_ASN1_D2I_get_x(type,b,func) \
107 c.q=c.p; \
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; } \
111 c.slen-=(c.p-c.q);
112
113 /* use this instead () */
114 # define M_ASN1_D2I_get_int(b,func) \
115 c.q=c.p; \
116 if (func(&(b),&c.p,c.slen) < 0) \
117 - {c.line=__LINE__; goto err; } \
118 + {c.line=OPENSSL_LINE; goto err; } \
119 c.slen-=(c.p-c.q);
120
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; \
124 c.q=c.p; \
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; } \
128 c.slen-=(c.p-c.q);\
129 M_ASN1_next_prev=_tmp;
130
131 @@ -258,20 +258,20 @@ err:\
132 c.q=c.p; \
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; } \
137 c.slen-=(c.p-c.q);
138
139 # define M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,a,b) \
140 c.q=c.p; \
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; } \
145 c.slen-=(c.p-c.q);
146
147 # define M_ASN1_D2I_get_set_strings(r,func,a,b) \
148 c.q=c.p; \
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; } \
152 c.slen-=(c.p-c.q);
153
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); \
157 if (Tinf & 0x80) \
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; } \
172 }\
173 c.slen-=(c.p-c.q); \
174 }
175 @@ -310,18 +310,18 @@ err:\
176 Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
177 if (Tinf & 0x80) \
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; } \
194 }\
195 c.slen-=(c.p-c.q); \
196 }
197 @@ -337,17 +337,17 @@ err:\
198 Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \
199 if (Tinf & 0x80) \
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; } \
215 }\
216 c.slen-=(c.p-c.q); \
217 }
218 @@ -355,7 +355,7 @@ err:\
219 /* New macros */
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; }
224
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);
233
234 if (cb == NULL)
235 +#ifndef OPENSSL_NO_UI
236 cb = EVP_read_pw_string;
237 +#else
238 + i = 1;
239 + else
240 +#endif
241 i = cb((char *)buf, 256, "Enter Private Key password:", 1);
242 if (i != 0) {
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,
245 goto err;
246 }
247 if (cb == NULL)
248 +#ifndef OPENSSL_NO_UI
249 cb = EVP_read_pw_string;
250 +#else
251 + goto err;
252 +#endif
253 if ((ret = d2i_RSA_NET_2(a, enckey->enckey->digest, cb, sgckey)) == NULL)
254 goto err;
255
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
260 @@ -131,7 +131,7 @@
261 static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1,
262 const BIGNUM *a1_odd, int k, BN_CTX *ctx,
263 BN_MONT_CTX *mont);
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,
268 BN_CTX *ctx);
269 @@ -166,9 +166,13 @@ int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe,
270 BIGNUM *t;
271 int found = 0;
272 int i, j, c1 = 0;
273 - BN_CTX *ctx;
274 + BN_CTX *ctx = NULL;
275 + prime_t *mods = NULL;
276 int checks = BN_prime_checks_for_size(bits);
277
278 + mods = OPENSSL_malloc(sizeof(*mods) * NUMPRIMES);
279 + if (mods == NULL)
280 + goto err;
281 ctx = BN_CTX_new();
282 if (ctx == NULL)
283 goto err;
284 @@ -179,7 +183,7 @@ int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe,
285 loop:
286 /* make a random number and set the top and bottom bits */
287 if (add == NULL) {
288 - if (!probable_prime(ret, bits))
289 + if (!probable_prime(ret, bits, mods))
290 goto err;
291 } else {
292 if (safe) {
293 @@ -230,6 +234,7 @@ int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe,
294 /* we have a prime :-) */
295 found = 1;
296 err:
297 + OPENSSL_free(mods);
298 if (ctx != NULL) {
299 BN_CTX_end(ctx);
300 BN_CTX_free(ctx);
301 @@ -375,10 +380,9 @@ static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1,
302 return 1;
303 }
304
305 -static int probable_prime(BIGNUM *rnd, int bits)
306 +static int probable_prime(BIGNUM *rnd, int bits, prime_t *mods)
307 {
308 int i;
309 - prime_t mods[NUMPRIMES];
310 BN_ULONG delta, maxdelta;
311
312 again:
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);
318
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,
323 long *eline);
324 +# endif
325 # ifndef OPENSSL_NO_FP_API
326 LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp,
327 long *eline);
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,
330 const char *name);
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);
334 +# endif
335 int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out);
336
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);
341
342 +# ifndef OPENSSL_NO_STDIO
343 int NCONF_load(CONF *conf, const char *file, long *eline);
344 +# endif
345 # ifndef OPENSSL_NO_FP_API
346 int NCONF_load_fp(CONF *conf, FILE *fp, long *eline);
347 # endif
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,
351 long *result);
352 +# ifndef OPENSSL_NO_FP_API
353 int NCONF_dump_fp(const CONF *conf, FILE *out);
354 +# endif
355 int NCONF_dump_bio(const CONF *conf, BIO *out);
356
357 # if 0 /* The following function has no error
358 @@ -184,8 +192,10 @@ long NCONF_get_number(CONF *conf, char *group, char *name);
359
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);
365 +# endif
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)
374
375 static int def_load(CONF *conf, const char *name, long *line)
376 {
377 +#ifdef OPENSSL_NO_STDIO
378 + CONFerr(CONF_F_DEF_LOAD, ERR_R_SYS_LIB);
379 + return 0;
380 +#else
381 int ret;
382 BIO *in = NULL;
383
384 @@ -202,6 +206,7 @@ static int def_load(CONF *conf, const char *name, long *line)
385 BIO_free(in);
386
387 return ret;
388 +#endif
389 }
390
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)
397 return 1;
398 }
399
400 +#ifndef OPENSSL_NO_STDIO
401 LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file,
402 long *eline)
403 {
404 @@ -111,6 +112,7 @@ LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file,
405
406 return ltmp;
407 }
408 +#endif
409
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);
414 }
415
416 +#ifndef OPENSSL_NO_STDIO
417 int NCONF_load(CONF *conf, const char *file, long *eline)
418 {
419 if (conf == NULL) {
420 @@ -264,6 +267,7 @@ int NCONF_load(CONF *conf, const char *file, long *eline)
421
422 return conf->meth->load(conf, file, eline);
423 }
424 +#endif
425
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 e0c9a67..13d93ea 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,
433
434 }
435
436 +#ifndef OPENSSL_NO_STDIO
437 int CONF_modules_load_file(const char *filename, const char *appname,
438 unsigned long flags)
439 {
440 @@ -194,6 +195,7 @@ int CONF_modules_load_file(const char *filename, const char *appname,
441
442 return ret;
443 }
444 +#endif
445
446 static int module_run(const CONF *cnf, char *name, char *value,
447 unsigned long flags)
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();
454 #endif
455 ERR_clear_error();
456 +#ifndef OPENSSL_NO_STDIO
457 CONF_modules_load_file(NULL, config_name,
458 CONF_MFLAGS_DEFAULT_SECTION |
459 CONF_MFLAGS_IGNORE_MISSING_FILE);
460 +#endif
461 openssl_configured = 1;
462 }
463
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)
469 return (0);
470 }
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);
479
480 if (i == -1) {
481 - dynlock_destroy_callback(pointer->data, __FILE__, __LINE__);
482 + dynlock_destroy_callback(pointer->data, OPENSSL_FILE, OPENSSL_LINE);
483 OPENSSL_free(pointer);
484 } else
485 i += 1; /* to avoid 0 */
486 @@ -328,7 +328,7 @@ void CRYPTO_destroy_dynlockid(int i)
487 CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
488
489 if (pointer) {
490 - dynlock_destroy_callback(pointer->data, __FILE__, __LINE__);
491 + dynlock_destroy_callback(pointer->data, OPENSSL_FILE, OPENSSL_LINE);
492 OPENSSL_free(pointer);
493 }
494 }
495 @@ -670,6 +670,7 @@ unsigned long *OPENSSL_ia32cap_loc(void)
496 }
497
498 # if defined(OPENSSL_CPUID_OBJ) && !defined(OPENSSL_NO_ASM) && !defined(I386_ONLY)
499 +#include <stdio.h>
500 # define OPENSSL_CPUID_SETUP
501 # if defined(_WIN32)
502 typedef unsigned __int64 IA32CAP;
503 @@ -980,11 +981,13 @@ void OPENSSL_showfatal(const char *fmta, ...)
504 #else
505 void OPENSSL_showfatal(const char *fmta, ...)
506 {
507 +#ifndef OPENSSL_NO_STDIO
508 va_list ap;
509
510 va_start(ap, fmta);
511 vfprintf(stderr, fmta, ap);
512 va_end(ap);
513 +#endif
514 }
515
516 int OPENSSL_isservice(void)
517 @@ -1011,10 +1014,12 @@ void OpenSSLDie(const char *file, int line, const char *assertion)
518 #endif
519 }
520
521 +#ifndef OPENSSL_NO_STDIO
522 void *OPENSSL_stderr(void)
523 {
524 return stderr;
525 }
526 +#endif
527
528 int CRYPTO_memcmp(const volatile void *in_a, const volatile void *in_b, size_t len)
529 {
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);
540 +#endif
541 extern int OPENSSL_NONPIC_relocated;
542
543 #ifdef __cplusplus
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)
566 # endif
567 # else
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()
572
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)
588
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)
593
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);
597
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);
605
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))
610
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) \
616 { \
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); \
621 } \
622 int private_##alg##_Init(cx##_CTX *c)
623
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!")
628
629 # else
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
634 @@ -114,6 +114,10 @@
635 #include <openssl/ui.h>
636 #include <openssl/crypto.h>
637
638 +#ifndef BUFSIZ
639 +#define BUFSIZ 256
640 +#endif
641 +
642 int DES_read_password(DES_cblock *key, const char *prompt, int verify)
643 {
644 int ok;
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
660 --- a/crypto/dh/dh.h
661 +++ b/crypto/dh/dh.h
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);
665
666 +# ifndef OPENSSL_NO_CMS
667 /* RFC2631 KDF */
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);
672 +# endif
673
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,
677
678 /* KDF types */
679 # define EVP_PKEY_DH_KDF_NONE 1
680 +# ifndef OPENSSL_NO_CMS
681 # define EVP_PKEY_DH_KDF_X9_42 2
682 +# endif
683
684 /* BEGIN ERROR CODES */
685 /*
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
690 @@ -51,6 +51,9 @@
691 * ====================================================================
692 */
693
694 +#include <e_os.h>
695 +
696 +#ifndef OPENSSL_NO_CMS
697 #include <string.h>
698 #include <openssl/dh.h>
699 #include <openssl/evp.h>
700 @@ -58,6 +61,7 @@
701 #include <openssl/cms.h>
702
703 /* Key derivation from X9.42/RFC2631 */
704 +/* Uses CMS functions, hence the #ifdef wrapper. */
705
706 #define DH_KDF_MAX (1L << 30)
707
708 @@ -185,3 +189,4 @@ int DH_KDF_X9_42(unsigned char *out, size_t outlen,
709 EVP_MD_CTX_cleanup(&mctx);
710 return rv;
711 }
712 +#endif
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:
719 if (p1 == -2)
720 return dctx->kdf_type;
721 +#ifdef OPENSSL_NO_CMS
722 + if (p1 != EVP_PKEY_DH_KDF_NONE)
723 +#else
724 if (p1 != EVP_PKEY_DH_KDF_NONE && p1 != EVP_PKEY_DH_KDF_X9_42)
725 +#endif
726 return -2;
727 dctx->kdf_type = p1;
728 return 1;
729 @@ -448,7 +452,9 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned char *key,
730 return ret;
731 *keylen = ret;
732 return 1;
733 - } else if (dctx->kdf_type == EVP_PKEY_DH_KDF_X9_42) {
734 + }
735 +#ifndef OPENSSL_NO_CMS
736 + else if (dctx->kdf_type == EVP_PKEY_DH_KDF_X9_42) {
737 unsigned char *Z = NULL;
738 size_t Zlen = 0;
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,
741 }
742 return ret;
743 }
744 - return 1;
745 +#endif
746 + return 0;
747 }
748
749 const EVP_PKEY_METHOD dh_pkey_meth = {
750 diff --git a/crypto/engine/eng_int.h b/crypto/engine/eng_int.h
751 index 46f163b..b4a72a0 100644
752 --- a/crypto/engine/eng_int.h
753 +++ b/crypto/engine/eng_int.h
754 @@ -88,7 +88,7 @@ extern "C" {
755 (unsigned int)(e), (isfunct ? "funct" : "struct"), \
756 ((isfunct) ? ((e)->funct_ref - (diff)) : ((e)->struct_ref - (diff))), \
757 ((isfunct) ? (e)->funct_ref : (e)->struct_ref), \
758 - (__FILE__), (__LINE__));
759 + (OPENSSL_FILE), (OPENSSL_LINE));
760
761 # else
762
763 @@ -136,7 +136,7 @@ ENGINE *engine_table_select(ENGINE_TABLE **table, int nid);
764 # else
765 ENGINE *engine_table_select_tmp(ENGINE_TABLE **table, int nid, const char *f,
766 int l);
767 -# define engine_table_select(t,n) engine_table_select_tmp(t,n,__FILE__,__LINE__)
768 +# define engine_table_select(t,n) engine_table_select_tmp(t,n,OPENSSL_FILE,OPENSSL_LINE)
769 # endif
770 typedef void (engine_table_doall_cb) (int nid, STACK_OF(ENGINE) *sk,
771 ENGINE *def, void *arg);
772 diff --git a/crypto/engine/eng_openssl.c b/crypto/engine/eng_openssl.c
773 index 34b0029..cf622bb 100644
774 --- a/crypto/engine/eng_openssl.c
775 +++ b/crypto/engine/eng_openssl.c
776 @@ -86,7 +86,9 @@
777 * this is no longer automatic in ENGINE_load_builtin_engines().
778 */
779 #define TEST_ENG_OPENSSL_RC4
780 +#ifndef OPENSSL_NO_FP_API
781 #define TEST_ENG_OPENSSL_PKEY
782 +#endif
783 /* #define TEST_ENG_OPENSSL_RC4_OTHERS */
784 #define TEST_ENG_OPENSSL_RC4_P_INIT
785 /* #define TEST_ENG_OPENSSL_RC4_P_CIPHER */
786 diff --git a/crypto/err/err.h b/crypto/err/err.h
787 index 585aa8b..04c6cfc 100644
788 --- a/crypto/err/err.h
789 +++ b/crypto/err/err.h
790 @@ -200,39 +200,39 @@ typedef struct err_state_st {
791
792 # define ERR_LIB_USER 128
793
794 -# define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),__FILE__,__LINE__)
795 -# define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),__FILE__,__LINE__)
796 -# define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),__FILE__,__LINE__)
797 -# define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),__FILE__,__LINE__)
798 -# define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),__FILE__,__LINE__)
799 -# define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),__FILE__,__LINE__)
800 -# define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),__FILE__,__LINE__)
801 -# define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),__FILE__,__LINE__)
802 -# define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),__FILE__,__LINE__)
803 -# define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),__FILE__,__LINE__)
804 -# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),__FILE__,__LINE__)
805 -# define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),__FILE__,__LINE__)
806 -# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),__FILE__,__LINE__)
807 -# define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),__FILE__,__LINE__)
808 -# define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),__FILE__,__LINE__)
809 -# define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),__FILE__,__LINE__)
810 -# define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),__FILE__,__LINE__)
811 -# define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),__FILE__,__LINE__)
812 -# define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),__FILE__,__LINE__)
813 -# define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),__FILE__,__LINE__)
814 -# define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),__FILE__,__LINE__)
815 -# define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),__FILE__,__LINE__)
816 -# define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),__FILE__,__LINE__)
817 -# define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),__FILE__,__LINE__)
818 -# define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),__FILE__,__LINE__)
819 -# define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),__FILE__,__LINE__)
820 -# define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),__FILE__,__LINE__)
821 -# define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),__FILE__,__LINE__)
822 -# define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),__FILE__,__LINE__)
823 -# define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),__FILE__,__LINE__)
824 -# define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),__FILE__,__LINE__)
825 -# define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),__FILE__,__LINE__)
826 -# define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),__FILE__,__LINE__)
827 +# define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
828 +# define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
829 +# define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
830 +# define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
831 +# define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
832 +# define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
833 +# define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
834 +# define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
835 +# define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
836 +# define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
837 +# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
838 +# define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
839 +# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
840 +# define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
841 +# define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
842 +# define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
843 +# define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
844 +# define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
845 +# define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
846 +# define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
847 +# define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
848 +# define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
849 +# define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
850 +# define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
851 +# define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
852 +# define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
853 +# define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
854 +# define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
855 +# define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
856 +# define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
857 +# define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
858 +# define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
859 +# define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
860
861 /*
862 * Borland C seems too stupid to be able to shift and do longs in the
863 diff --git a/crypto/evp/evp.h b/crypto/evp/evp.h
864 index 39ab793..ad1e350 100644
865 --- a/crypto/evp/evp.h
866 +++ b/crypto/evp/evp.h
867 @@ -602,11 +602,13 @@ int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in);
868 int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type);
869 int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s);
870
871 +#ifndef OPENSSL_NO_UI
872 int EVP_read_pw_string(char *buf, int length, const char *prompt, int verify);
873 int EVP_read_pw_string_min(char *buf, int minlen, int maxlen,
874 const char *prompt, int verify);
875 void EVP_set_pw_prompt(const char *prompt);
876 char *EVP_get_pw_prompt(void);
877 +#endif
878
879 int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md,
880 const unsigned char *salt, const unsigned char *data,
881 diff --git a/crypto/evp/evp_key.c b/crypto/evp/evp_key.c
882 index 5be9e33..63c8866 100644
883 --- a/crypto/evp/evp_key.c
884 +++ b/crypto/evp/evp_key.c
885 @@ -63,6 +63,7 @@
886 #include <openssl/evp.h>
887 #include <openssl/ui.h>
888
889 +#ifndef OPENSSL_NO_UI
890 /* should be init to zeros. */
891 static char prompt_string[80];
892
893 @@ -117,6 +118,7 @@ int EVP_read_pw_string_min(char *buf, int min, int len, const char *prompt,
894 OPENSSL_cleanse(buff, BUFSIZ);
895 return ret;
896 }
897 +#endif /* OPENSSL_NO_UI */
898
899 int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md,
900 const unsigned char *salt, const unsigned char *data,
901 diff --git a/crypto/opensslconf.h.in b/crypto/opensslconf.h.in
902 index 7a1c85d..7162c0f 100644
903 --- a/crypto/opensslconf.h.in
904 +++ b/crypto/opensslconf.h.in
905 @@ -1,5 +1,15 @@
906 /* crypto/opensslconf.h.in */
907
908 +#ifndef OPENSSL_FILE
909 +#ifdef OPENSSL_NO_FILENAMES
910 +#define OPENSSL_FILE ""
911 +#define OPENSSL_LINE 0
912 +#else
913 +#define OPENSSL_FILE __FILE__
914 +#define OPENSSL_LINE __LINE__
915 +#endif
916 +#endif
917 +
918 /* Generate 80386 code? */
919 #undef I386_ONLY
920
921 @@ -56,7 +66,7 @@
922 #endif
923 #endif
924
925 -#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
926 +#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) && !defined(OPENSSL_SYSNAME_UEFI)
927 #define CONFIG_HEADER_BN_H
928 #undef BN_LLONG
929
930 diff --git a/crypto/pem/pem.h b/crypto/pem/pem.h
931 index aac72fb..d271ec8 100644
932 --- a/crypto/pem/pem.h
933 +++ b/crypto/pem/pem.h
934 @@ -324,6 +324,7 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
935
936 # define DECLARE_PEM_read_fp(name, type) /**/
937 # define DECLARE_PEM_write_fp(name, type) /**/
938 +# define DECLARE_PEM_write_fp_const(name, type) /**/
939 # define DECLARE_PEM_write_cb_fp(name, type) /**/
940 # else
941
942 @@ -417,6 +418,7 @@ int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc,
943 pem_password_cb *cd, void *u);
944 # endif
945
946 +#ifndef OPENSSL_NO_FP_API
947 int PEM_read(FILE *fp, char **name, char **header,
948 unsigned char **data, long *len);
949 int PEM_write(FILE *fp, const char *name, const char *hdr,
950 @@ -428,6 +430,7 @@ int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp,
951 int klen, pem_password_cb *callback, void *u);
952 STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk,
953 pem_password_cb *cb, void *u);
954 +#endif
955
956 int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type,
957 EVP_MD *md_type, unsigned char **ek, int *ekl,
958 @@ -494,6 +497,7 @@ int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid,
959 EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb,
960 void *u);
961
962 +#ifndef OPENSSL_NO_FP_API
963 int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
964 char *kstr, int klen,
965 pem_password_cb *cb, void *u);
966 @@ -510,6 +514,7 @@ EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb,
967 int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
968 char *kstr, int klen, pem_password_cb *cd,
969 void *u);
970 +#endif
971
972 EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x);
973 int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x);
974 diff --git a/crypto/pem/pem_lib.c b/crypto/pem/pem_lib.c
975 index c82b3c0..56c77b1 100644
976 --- a/crypto/pem/pem_lib.c
977 +++ b/crypto/pem/pem_lib.c
978 @@ -84,7 +84,7 @@ int pem_check_suffix(const char *pem_str, const char *suffix);
979
980 int PEM_def_callback(char *buf, int num, int w, void *key)
981 {
982 -#ifdef OPENSSL_NO_FP_API
983 +#if defined(OPENSSL_NO_FP_API) || defined(OPENSSL_NO_UI)
984 /*
985 * We should not ever call the default callback routine from windows.
986 */
987 diff --git a/crypto/pem/pem_pk8.c b/crypto/pem/pem_pk8.c
988 index 5747c73..9edca4d 100644
989 --- a/crypto/pem/pem_pk8.c
990 +++ b/crypto/pem/pem_pk8.c
991 @@ -69,9 +69,11 @@
992 static int do_pk8pkey(BIO *bp, EVP_PKEY *x, int isder,
993 int nid, const EVP_CIPHER *enc,
994 char *kstr, int klen, pem_password_cb *cb, void *u);
995 +#ifndef OPENSSL_NO_FP_API
996 static int do_pk8pkey_fp(FILE *bp, EVP_PKEY *x, int isder,
997 int nid, const EVP_CIPHER *enc,
998 char *kstr, int klen, pem_password_cb *cb, void *u);
999 +#endif
1000
1001 /*
1002 * These functions write a private key in PKCS#8 format: it is a "drop in"
1003 diff --git a/crypto/pkcs7/pk7_smime.c b/crypto/pkcs7/pk7_smime.c
1004 index dc9b484..e75c4b2 100644
1005 --- a/crypto/pkcs7/pk7_smime.c
1006 +++ b/crypto/pkcs7/pk7_smime.c
1007 @@ -64,6 +64,8 @@
1008 #include <openssl/x509.h>
1009 #include <openssl/x509v3.h>
1010
1011 +#define BUFFERSIZE 4096
1012 +
1013 static int pkcs7_copy_existing_digest(PKCS7 *p7, PKCS7_SIGNER_INFO *si);
1014
1015 PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
1016 @@ -254,7 +256,7 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
1017 STACK_OF(PKCS7_SIGNER_INFO) *sinfos;
1018 PKCS7_SIGNER_INFO *si;
1019 X509_STORE_CTX cert_ctx;
1020 - char buf[4096];
1021 + char *buf = NULL;
1022 int i, j = 0, k, ret = 0;
1023 BIO *p7bio = NULL;
1024 BIO *tmpin = NULL, *tmpout = NULL;
1025 @@ -373,8 +375,12 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
1026 tmpout = out;
1027
1028 /* We now have to 'read' from p7bio to calculate digests etc. */
1029 + if ((buf = OPENSSL_malloc(BUFFERSIZE)) == NULL) {
1030 + PKCS7err(PKCS7_F_PKCS7_VERIFY, ERR_R_MALLOC_FAILURE);
1031 + goto err;
1032 + }
1033 for (;;) {
1034 - i = BIO_read(p7bio, buf, sizeof(buf));
1035 + i = BIO_read(p7bio, buf, BUFFERSIZE);
1036 if (i <= 0)
1037 break;
1038 if (tmpout)
1039 @@ -405,6 +411,7 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
1040 ret = 1;
1041
1042 err:
1043 + OPENSSL_free(buf);
1044 if (tmpin == indata) {
1045 if (indata)
1046 BIO_pop(p7bio);
1047 @@ -523,7 +530,7 @@ int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags)
1048 {
1049 BIO *tmpmem;
1050 int ret, i;
1051 - char buf[4096];
1052 + char *buf = NULL;
1053
1054 if (!p7) {
1055 PKCS7err(PKCS7_F_PKCS7_DECRYPT, PKCS7_R_INVALID_NULL_POINTER);
1056 @@ -567,24 +574,30 @@ int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags)
1057 }
1058 BIO_free_all(bread);
1059 return ret;
1060 - } else {
1061 - for (;;) {
1062 - i = BIO_read(tmpmem, buf, sizeof(buf));
1063 - if (i <= 0) {
1064 - ret = 1;
1065 - if (BIO_method_type(tmpmem) == BIO_TYPE_CIPHER) {
1066 - if (!BIO_get_cipher_status(tmpmem))
1067 - ret = 0;
1068 - }
1069 -
1070 - break;
1071 - }
1072 - if (BIO_write(data, buf, i) != i) {
1073 - ret = 0;
1074 - break;
1075 + }
1076 + if ((buf = OPENSSL_malloc(BUFFERSIZE)) == NULL) {
1077 + PKCS7err(PKCS7_F_PKCS7_DECRYPT, ERR_R_MALLOC_FAILURE);
1078 + goto err;
1079 + }
1080 + for (;;) {
1081 + i = BIO_read(tmpmem, buf, BUFFERSIZE);
1082 + if (i <= 0) {
1083 + ret = 1;
1084 + if (BIO_method_type(tmpmem) == BIO_TYPE_CIPHER) {
1085 + if (!BIO_get_cipher_status(tmpmem))
1086 + ret = 0;
1087 }
1088 +
1089 + break;
1090 + }
1091 + if (BIO_write(data, buf, i) != i) {
1092 + ret = 0;
1093 + break;
1094 }
1095 - BIO_free_all(tmpmem);
1096 - return ret;
1097 }
1098 +
1099 +err:
1100 + OPENSSL_free(buf);
1101 + BIO_free_all(tmpmem);
1102 + return ret;
1103 }
1104 diff --git a/crypto/rand/rand_egd.c b/crypto/rand/rand_egd.c
1105 index 737aebf..f23f348 100644
1106 --- a/crypto/rand/rand_egd.c
1107 +++ b/crypto/rand/rand_egd.c
1108 @@ -95,7 +95,7 @@
1109 * RAND_egd() is a wrapper for RAND_egd_bytes() with numbytes=255.
1110 */
1111
1112 -#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)
1113 +#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)
1114 int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
1115 {
1116 return (-1);
1117 diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c
1118 index 6c5b65d..11ee152 100644
1119 --- a/crypto/rand/rand_unix.c
1120 +++ b/crypto/rand/rand_unix.c
1121 @@ -116,7 +116,7 @@
1122 #include <openssl/rand.h>
1123 #include "rand_lcl.h"
1124
1125 -#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))
1126 +#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))
1127
1128 # include <sys/types.h>
1129 # include <sys/time.h>
1130 @@ -439,7 +439,7 @@ int RAND_poll(void)
1131 * defined(OPENSSL_SYS_VXWORKS) ||
1132 * defined(OPENSSL_SYS_NETWARE)) */
1133
1134 -#if defined(OPENSSL_SYS_VXWORKS)
1135 +#if defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_UEFI)
1136 int RAND_poll(void)
1137 {
1138 return 0;
1139 diff --git a/crypto/srp/srp.h b/crypto/srp/srp.h
1140 index 028892a..4ed4bfe 100644
1141 --- a/crypto/srp/srp.h
1142 +++ b/crypto/srp/srp.h
1143 @@ -119,7 +119,9 @@ DECLARE_STACK_OF(SRP_gN)
1144
1145 SRP_VBASE *SRP_VBASE_new(char *seed_key);
1146 int SRP_VBASE_free(SRP_VBASE *vb);
1147 +#ifndef OPENSSL_NO_STDIO
1148 int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file);
1149 +#endif
1150
1151 /* This method ignores the configured seed and fails for an unknown user. */
1152 SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username);
1153 diff --git a/crypto/srp/srp_vfy.c b/crypto/srp/srp_vfy.c
1154 index a8ec52a..ce20804 100644
1155 --- a/crypto/srp/srp_vfy.c
1156 +++ b/crypto/srp/srp_vfy.c
1157 @@ -228,6 +228,7 @@ static int SRP_user_pwd_set_ids(SRP_user_pwd *vinfo, const char *id,
1158 return (info == NULL || NULL != (vinfo->info = BUF_strdup(info)));
1159 }
1160
1161 +#ifndef OPENSSL_NO_STDIO
1162 static int SRP_user_pwd_set_sv(SRP_user_pwd *vinfo, const char *s,
1163 const char *v)
1164 {
1165 @@ -254,6 +255,7 @@ static int SRP_user_pwd_set_sv(SRP_user_pwd *vinfo, const char *s,
1166 vinfo->v = NULL;
1167 return 0;
1168 }
1169 +#endif
1170
1171 static int SRP_user_pwd_set_sv_BN(SRP_user_pwd *vinfo, BIGNUM *s, BIGNUM *v)
1172 {
1173 @@ -312,6 +314,7 @@ int SRP_VBASE_free(SRP_VBASE *vb)
1174 return 0;
1175 }
1176
1177 +#ifndef OPENSSL_NO_STDIO
1178 static SRP_gN_cache *SRP_gN_new_init(const char *ch)
1179 {
1180 unsigned char tmp[MAX_LEN];
1181 @@ -346,6 +349,7 @@ static void SRP_gN_free(SRP_gN_cache *gN_cache)
1182 BN_free(gN_cache->bn);
1183 OPENSSL_free(gN_cache);
1184 }
1185 +#endif
1186
1187 static SRP_gN *SRP_get_gN_by_id(const char *id, STACK_OF(SRP_gN) *gN_tab)
1188 {
1189 @@ -362,6 +366,7 @@ static SRP_gN *SRP_get_gN_by_id(const char *id, STACK_OF(SRP_gN) *gN_tab)
1190 return SRP_get_default_gN(id);
1191 }
1192
1193 +#ifndef OPENSSL_NO_STDIO
1194 static BIGNUM *SRP_gN_place_bn(STACK_OF(SRP_gN_cache) *gN_cache, char *ch)
1195 {
1196 int i;
1197 @@ -503,6 +508,7 @@ int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file)
1198 return error_code;
1199
1200 }
1201 +#endif
1202
1203 static SRP_user_pwd *find_user(SRP_VBASE *vb, char *username)
1204 {
1205 diff --git a/crypto/ts/ts.h b/crypto/ts/ts.h
1206 index 2daa1b2..5205bc5 100644
1207 --- a/crypto/ts/ts.h
1208 +++ b/crypto/ts/ts.h
1209 @@ -281,8 +281,10 @@ TS_REQ *d2i_TS_REQ(TS_REQ **a, const unsigned char **pp, long length);
1210
1211 TS_REQ *TS_REQ_dup(TS_REQ *a);
1212
1213 +#ifndef OPENSSL_NO_FP_API
1214 TS_REQ *d2i_TS_REQ_fp(FILE *fp, TS_REQ **a);
1215 int i2d_TS_REQ_fp(FILE *fp, TS_REQ *a);
1216 +#endif
1217 TS_REQ *d2i_TS_REQ_bio(BIO *fp, TS_REQ **a);
1218 int i2d_TS_REQ_bio(BIO *fp, TS_REQ *a);
1219
1220 @@ -294,10 +296,12 @@ TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a,
1221
1222 TS_MSG_IMPRINT *TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT *a);
1223
1224 +#ifndef OPENSSL_NO_FP_API
1225 TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT **a);
1226 int i2d_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT *a);
1227 -TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *fp, TS_MSG_IMPRINT **a);
1228 -int i2d_TS_MSG_IMPRINT_bio(BIO *fp, TS_MSG_IMPRINT *a);
1229 +#endif
1230 +TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT **a);
1231 +int i2d_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT *a);
1232
1233 TS_RESP *TS_RESP_new(void);
1234 void TS_RESP_free(TS_RESP *a);
1235 @@ -306,10 +310,12 @@ TS_RESP *d2i_TS_RESP(TS_RESP **a, const unsigned char **pp, long length);
1236 TS_TST_INFO *PKCS7_to_TS_TST_INFO(PKCS7 *token);
1237 TS_RESP *TS_RESP_dup(TS_RESP *a);
1238
1239 +#ifndef OPENSSL_NO_FP_API
1240 TS_RESP *d2i_TS_RESP_fp(FILE *fp, TS_RESP **a);
1241 int i2d_TS_RESP_fp(FILE *fp, TS_RESP *a);
1242 -TS_RESP *d2i_TS_RESP_bio(BIO *fp, TS_RESP **a);
1243 -int i2d_TS_RESP_bio(BIO *fp, TS_RESP *a);
1244 +#endif
1245 +TS_RESP *d2i_TS_RESP_bio(BIO *bio, TS_RESP **a);
1246 +int i2d_TS_RESP_bio(BIO *bio, TS_RESP *a);
1247
1248 TS_STATUS_INFO *TS_STATUS_INFO_new(void);
1249 void TS_STATUS_INFO_free(TS_STATUS_INFO *a);
1250 @@ -325,10 +331,12 @@ TS_TST_INFO *d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **pp,
1251 long length);
1252 TS_TST_INFO *TS_TST_INFO_dup(TS_TST_INFO *a);
1253
1254 +#ifndef OPENSSL_NO_FP_API
1255 TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a);
1256 int i2d_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO *a);
1257 -TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *fp, TS_TST_INFO **a);
1258 -int i2d_TS_TST_INFO_bio(BIO *fp, TS_TST_INFO *a);
1259 +#endif
1260 +TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO **a);
1261 +int i2d_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO *a);
1262
1263 TS_ACCURACY *TS_ACCURACY_new(void);
1264 void TS_ACCURACY_free(TS_ACCURACY *a);
1265 @@ -731,15 +739,18 @@ int TS_MSG_IMPRINT_print_bio(BIO *bio, TS_MSG_IMPRINT *msg);
1266 * ts/ts_conf.c
1267 */
1268
1269 +#ifndef OPENSSL_NO_STDIO
1270 X509 *TS_CONF_load_cert(const char *file);
1271 STACK_OF(X509) *TS_CONF_load_certs(const char *file);
1272 EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass);
1273 +#endif
1274 const char *TS_CONF_get_tsa_section(CONF *conf, const char *section);
1275 int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb,
1276 TS_RESP_CTX *ctx);
1277 int TS_CONF_set_crypto_device(CONF *conf, const char *section,
1278 const char *device);
1279 int TS_CONF_set_default_engine(const char *name);
1280 +#ifndef OPENSSL_NO_STDIO
1281 int TS_CONF_set_signer_cert(CONF *conf, const char *section,
1282 const char *cert, TS_RESP_CTX *ctx);
1283 int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs,
1284 @@ -747,6 +758,7 @@ int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs,
1285 int TS_CONF_set_signer_key(CONF *conf, const char *section,
1286 const char *key, const char *pass,
1287 TS_RESP_CTX *ctx);
1288 +#endif
1289 int TS_CONF_set_def_policy(CONF *conf, const char *section,
1290 const char *policy, TS_RESP_CTX *ctx);
1291 int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx);
1292 @@ -787,6 +799,11 @@ void ERR_load_TS_strings(void);
1293 # define TS_F_TS_CHECK_SIGNING_CERTS 103
1294 # define TS_F_TS_CHECK_STATUS_INFO 104
1295 # define TS_F_TS_COMPUTE_IMPRINT 145
1296 +# define TS_F_TS_CONF_INVALID 151
1297 +# define TS_F_TS_CONF_LOAD_CERT 153
1298 +# define TS_F_TS_CONF_LOAD_CERTS 154
1299 +# define TS_F_TS_CONF_LOAD_KEY 155
1300 +# define TS_F_TS_CONF_LOOKUP_FAIL 152
1301 # define TS_F_TS_CONF_SET_DEFAULT_ENGINE 146
1302 # define TS_F_TS_GET_STATUS_TEXT 105
1303 # define TS_F_TS_MSG_IMPRINT_SET_ALGO 118
1304 @@ -825,6 +842,8 @@ void ERR_load_TS_strings(void);
1305 /* Reason codes. */
1306 # define TS_R_BAD_PKCS7_TYPE 132
1307 # define TS_R_BAD_TYPE 133
1308 +# define TS_R_CANNOT_LOAD_CERT 137
1309 +# define TS_R_CANNOT_LOAD_KEY 138
1310 # define TS_R_CERTIFICATE_VERIFY_ERROR 100
1311 # define TS_R_COULD_NOT_SET_ENGINE 127
1312 # define TS_R_COULD_NOT_SET_TIME 115
1313 @@ -857,6 +876,8 @@ void ERR_load_TS_strings(void);
1314 # define TS_R_UNACCEPTABLE_POLICY 125
1315 # define TS_R_UNSUPPORTED_MD_ALGORITHM 126
1316 # define TS_R_UNSUPPORTED_VERSION 113
1317 +# define TS_R_VAR_BAD_VALUE 135
1318 +# define TS_R_VAR_LOOKUP_FAILURE 136
1319 # define TS_R_WRONG_CONTENT_TYPE 114
1320
1321 #ifdef __cplusplus
1322 diff --git a/crypto/ts/ts_conf.c b/crypto/ts/ts_conf.c
1323 index 4716b23..c4416ba 100644
1324 --- a/crypto/ts/ts_conf.c
1325 +++ b/crypto/ts/ts_conf.c
1326 @@ -92,6 +92,7 @@
1327
1328 /* Function definitions for certificate and key loading. */
1329
1330 +#ifndef OPENSSL_NO_STDIO
1331 X509 *TS_CONF_load_cert(const char *file)
1332 {
1333 BIO *cert = NULL;
1334 @@ -102,7 +103,7 @@ X509 *TS_CONF_load_cert(const char *file)
1335 x = PEM_read_bio_X509_AUX(cert, NULL, NULL, NULL);
1336 end:
1337 if (x == NULL)
1338 - fprintf(stderr, "unable to load certificate: %s\n", file);
1339 + TSerr(TS_F_TS_CONF_LOAD_CERT, TS_R_CANNOT_LOAD_CERT);
1340 BIO_free(cert);
1341 return x;
1342 }
1343 @@ -129,7 +130,7 @@ STACK_OF(X509) *TS_CONF_load_certs(const char *file)
1344 }
1345 end:
1346 if (othercerts == NULL)
1347 - fprintf(stderr, "unable to load certificates: %s\n", file);
1348 + TSerr(TS_F_TS_CONF_LOAD_CERTS, TS_R_CANNOT_LOAD_CERT);
1349 sk_X509_INFO_pop_free(allcerts, X509_INFO_free);
1350 BIO_free(certs);
1351 return othercerts;
1352 @@ -145,21 +146,24 @@ EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass)
1353 pkey = PEM_read_bio_PrivateKey(key, NULL, NULL, (char *)pass);
1354 end:
1355 if (pkey == NULL)
1356 - fprintf(stderr, "unable to load private key: %s\n", file);
1357 + TSerr(TS_F_TS_CONF_LOAD_KEY, TS_R_CANNOT_LOAD_KEY);
1358 BIO_free(key);
1359 return pkey;
1360 }
1361 +#endif /* !OPENSSL_NO_STDIO */
1362
1363 /* Function definitions for handling configuration options. */
1364
1365 static void TS_CONF_lookup_fail(const char *name, const char *tag)
1366 {
1367 - fprintf(stderr, "variable lookup failed for %s::%s\n", name, tag);
1368 + TSerr(TS_F_TS_CONF_LOOKUP_FAIL, TS_R_VAR_LOOKUP_FAILURE);
1369 + ERR_add_error_data(3, name, "::", tag);
1370 }
1371
1372 static void TS_CONF_invalid(const char *name, const char *tag)
1373 {
1374 - fprintf(stderr, "invalid variable value for %s::%s\n", name, tag);
1375 + TSerr(TS_F_TS_CONF_INVALID, TS_R_VAR_BAD_VALUE);
1376 + ERR_add_error_data(3, name, "::", tag);
1377 }
1378
1379 const char *TS_CONF_get_tsa_section(CONF *conf, const char *section)
1380 @@ -237,6 +241,7 @@ int TS_CONF_set_default_engine(const char *name)
1381
1382 #endif
1383
1384 +#ifndef OPENSSL_NO_STDIO
1385 int TS_CONF_set_signer_cert(CONF *conf, const char *section,
1386 const char *cert, TS_RESP_CTX *ctx)
1387 {
1388 @@ -302,6 +307,7 @@ int TS_CONF_set_signer_key(CONF *conf, const char *section,
1389 EVP_PKEY_free(key_obj);
1390 return ret;
1391 }
1392 +#endif /* !OPENSSL_NO_STDIO */
1393
1394 int TS_CONF_set_def_policy(CONF *conf, const char *section,
1395 const char *policy, TS_RESP_CTX *ctx)
1396 diff --git a/crypto/ts/ts_err.c b/crypto/ts/ts_err.c
1397 index ff1abf4..3f5b78f 100644
1398 --- a/crypto/ts/ts_err.c
1399 +++ b/crypto/ts/ts_err.c
1400 @@ -1,6 +1,6 @@
1401 /* crypto/ts/ts_err.c */
1402 /* ====================================================================
1403 - * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
1404 + * Copyright (c) 1999-2015 The OpenSSL Project. All rights reserved.
1405 *
1406 * Redistribution and use in source and binary forms, with or without
1407 * modification, are permitted provided that the following conditions
1408 @@ -87,6 +87,11 @@ static ERR_STRING_DATA TS_str_functs[] = {
1409 {ERR_FUNC(TS_F_TS_CHECK_SIGNING_CERTS), "TS_CHECK_SIGNING_CERTS"},
1410 {ERR_FUNC(TS_F_TS_CHECK_STATUS_INFO), "TS_CHECK_STATUS_INFO"},
1411 {ERR_FUNC(TS_F_TS_COMPUTE_IMPRINT), "TS_COMPUTE_IMPRINT"},
1412 + {ERR_FUNC(TS_F_TS_CONF_INVALID), "ts_CONF_invalid"},
1413 + {ERR_FUNC(TS_F_TS_CONF_LOAD_CERT), "TS_CONF_load_cert"},
1414 + {ERR_FUNC(TS_F_TS_CONF_LOAD_CERTS), "TS_CONF_load_certs"},
1415 + {ERR_FUNC(TS_F_TS_CONF_LOAD_KEY), "TS_CONF_load_key"},
1416 + {ERR_FUNC(TS_F_TS_CONF_LOOKUP_FAIL), "ts_CONF_lookup_fail"},
1417 {ERR_FUNC(TS_F_TS_CONF_SET_DEFAULT_ENGINE), "TS_CONF_set_default_engine"},
1418 {ERR_FUNC(TS_F_TS_GET_STATUS_TEXT), "TS_GET_STATUS_TEXT"},
1419 {ERR_FUNC(TS_F_TS_MSG_IMPRINT_SET_ALGO), "TS_MSG_IMPRINT_set_algo"},
1420 @@ -132,6 +137,8 @@ static ERR_STRING_DATA TS_str_functs[] = {
1421 static ERR_STRING_DATA TS_str_reasons[] = {
1422 {ERR_REASON(TS_R_BAD_PKCS7_TYPE), "bad pkcs7 type"},
1423 {ERR_REASON(TS_R_BAD_TYPE), "bad type"},
1424 + {ERR_REASON(TS_R_CANNOT_LOAD_CERT), "cannot load certificate"},
1425 + {ERR_REASON(TS_R_CANNOT_LOAD_KEY), "cannot load private key"},
1426 {ERR_REASON(TS_R_CERTIFICATE_VERIFY_ERROR), "certificate verify error"},
1427 {ERR_REASON(TS_R_COULD_NOT_SET_ENGINE), "could not set engine"},
1428 {ERR_REASON(TS_R_COULD_NOT_SET_TIME), "could not set time"},
1429 @@ -170,6 +177,8 @@ static ERR_STRING_DATA TS_str_reasons[] = {
1430 {ERR_REASON(TS_R_UNACCEPTABLE_POLICY), "unacceptable policy"},
1431 {ERR_REASON(TS_R_UNSUPPORTED_MD_ALGORITHM), "unsupported md algorithm"},
1432 {ERR_REASON(TS_R_UNSUPPORTED_VERSION), "unsupported version"},
1433 + {ERR_REASON(TS_R_VAR_BAD_VALUE), "var bad value"},
1434 + {ERR_REASON(TS_R_VAR_LOOKUP_FAILURE), "cannot find config variable"},
1435 {ERR_REASON(TS_R_WRONG_CONTENT_TYPE), "wrong content type"},
1436 {0, NULL}
1437 };
1438 diff --git a/crypto/ui/ui_util.c b/crypto/ui/ui_util.c
1439 index 0f29011..80dd40e 100644
1440 --- a/crypto/ui/ui_util.c
1441 +++ b/crypto/ui/ui_util.c
1442 @@ -56,6 +56,10 @@
1443 #include <string.h>
1444 #include "ui_locl.h"
1445
1446 +#ifndef BUFSIZ
1447 +#define BUFSIZ 256
1448 +#endif
1449 +
1450 int UI_UTIL_read_pw_string(char *buf, int length, const char *prompt,
1451 int verify)
1452 {
1453 diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c
1454 index bbc3189..29695f9 100644
1455 --- a/crypto/x509/by_dir.c
1456 +++ b/crypto/x509/by_dir.c
1457 @@ -69,6 +69,8 @@
1458 # include <sys/stat.h>
1459 #endif
1460
1461 +#ifndef OPENSSL_NO_STDIO
1462 +
1463 #include <openssl/lhash.h>
1464 #include <openssl/x509.h>
1465
1466 @@ -438,3 +440,5 @@ static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
1467 BUF_MEM_free(b);
1468 return (ok);
1469 }
1470 +
1471 +#endif /* OPENSSL_NO_STDIO */
1472 diff --git a/crypto/x509/x509_vfy.c b/crypto/x509/x509_vfy.c
1473 index 8334b3f..d075f66 100644
1474 --- a/crypto/x509/x509_vfy.c
1475 +++ b/crypto/x509/x509_vfy.c
1476 @@ -1064,6 +1064,8 @@ static int check_crl_time(X509_STORE_CTX *ctx, X509_CRL *crl, int notify)
1477 ctx->current_crl = crl;
1478 if (ctx->param->flags & X509_V_FLAG_USE_CHECK_TIME)
1479 ptime = &ctx->param->check_time;
1480 + else if (ctx->param->flags & X509_V_FLAG_NO_CHECK_TIME)
1481 + return 1;
1482 else
1483 ptime = NULL;
1484
1485 @@ -1805,6 +1807,8 @@ static int check_cert_time(X509_STORE_CTX *ctx, X509 *x)
1486
1487 if (ctx->param->flags & X509_V_FLAG_USE_CHECK_TIME)
1488 ptime = &ctx->param->check_time;
1489 + else if (ctx->param->flags & X509_V_FLAG_NO_CHECK_TIME)
1490 + return 1;
1491 else
1492 ptime = NULL;
1493
1494 diff --git a/crypto/x509/x509_vfy.h b/crypto/x509/x509_vfy.h
1495 index 5062682..e90d931 100644
1496 --- a/crypto/x509/x509_vfy.h
1497 +++ b/crypto/x509/x509_vfy.h
1498 @@ -443,6 +443,8 @@ void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth);
1499 * will force the behaviour to match that of previous versions.
1500 */
1501 # define X509_V_FLAG_NO_ALT_CHAINS 0x100000
1502 +/* Do not check certificate/CRL validity against current time */
1503 +# define X509_V_FLAG_NO_CHECK_TIME 0x200000
1504
1505 # define X509_VP_FLAG_DEFAULT 0x1
1506 # define X509_VP_FLAG_OVERWRITE 0x2
1507 @@ -496,8 +498,10 @@ X509_STORE *X509_STORE_CTX_get0_store(X509_STORE_CTX *ctx);
1508
1509 X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m);
1510
1511 +#ifndef OPENSSL_NO_STDIO
1512 X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void);
1513 X509_LOOKUP_METHOD *X509_LOOKUP_file(void);
1514 +#endif
1515
1516 int X509_STORE_add_cert(X509_STORE *ctx, X509 *x);
1517 int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x);
1518 diff --git a/crypto/x509v3/ext_dat.h b/crypto/x509v3/ext_dat.h
1519 index c3a6fce..09ebbca 100644
1520 --- a/crypto/x509v3/ext_dat.h
1521 +++ b/crypto/x509v3/ext_dat.h
1522 @@ -127,8 +127,10 @@ static const X509V3_EXT_METHOD *standard_exts[] = {
1523 &v3_idp,
1524 &v3_alt[2],
1525 &v3_freshest_crl,
1526 +#ifndef OPENSSL_NO_SCT
1527 &v3_ct_scts[0],
1528 &v3_ct_scts[1],
1529 +#endif
1530 };
1531
1532 /* Number of standard extensions */
1533 diff --git a/crypto/x509v3/v3_pci.c b/crypto/x509v3/v3_pci.c
1534 index 34cad53..12f12a7 100644
1535 --- a/crypto/x509v3/v3_pci.c
1536 +++ b/crypto/x509v3/v3_pci.c
1537 @@ -149,6 +149,7 @@ static int process_pci_value(CONF_VALUE *val,
1538 goto err;
1539 }
1540 OPENSSL_free(tmp_data2);
1541 +#ifndef OPENSSL_NO_STDIO
1542 } else if (strncmp(val->value, "file:", 5) == 0) {
1543 unsigned char buf[2048];
1544 int n;
1545 @@ -181,6 +182,7 @@ static int process_pci_value(CONF_VALUE *val,
1546 X509V3_conf_err(val);
1547 goto err;
1548 }
1549 +#endif /* !OPENSSL_NO_STDIO */
1550 } else if (strncmp(val->value, "text:", 5) == 0) {
1551 val_len = strlen(val->value + 5);
1552 tmp_data = OPENSSL_realloc((*policy)->data,
1553 diff --git a/crypto/x509v3/v3_scts.c b/crypto/x509v3/v3_scts.c
1554 index 0b7c681..1895b8f 100644
1555 --- a/crypto/x509v3/v3_scts.c
1556 +++ b/crypto/x509v3/v3_scts.c
1557 @@ -61,6 +61,7 @@
1558 #include <openssl/asn1.h>
1559 #include <openssl/x509v3.h>
1560
1561 +#ifndef OPENSSL_NO_SCT
1562 /* Signature and hash algorithms from RFC 5246 */
1563 #define TLSEXT_hash_sha256 4
1564
1565 @@ -332,3 +333,4 @@ static int i2r_SCT_LIST(X509V3_EXT_METHOD *method, STACK_OF(SCT) *sct_list,
1566
1567 return 1;
1568 }
1569 +#endif
1570 diff --git a/crypto/x509v3/x509v3.h b/crypto/x509v3/x509v3.h
1571 index f5c6156..a2e78aa 100644
1572 --- a/crypto/x509v3/x509v3.h
1573 +++ b/crypto/x509v3/x509v3.h
1574 @@ -688,8 +688,9 @@ void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent,
1575 int ml);
1576 int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag,
1577 int indent);
1578 +#ifndef OPENSSL_NO_FP_API
1579 int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent);
1580 -
1581 +#endif
1582 int X509V3_extensions_print(BIO *out, char *title,
1583 STACK_OF(X509_EXTENSION) *exts,
1584 unsigned long flag, int indent);
1585 diff --git a/demos/engines/cluster_labs/hw_cluster_labs_err.h b/demos/engines/cluster_labs/hw_cluster_labs_err.h
1586 index 3300e11..e9e58d5 100644
1587 --- a/demos/engines/cluster_labs/hw_cluster_labs_err.h
1588 +++ b/demos/engines/cluster_labs/hw_cluster_labs_err.h
1589 @@ -67,7 +67,7 @@ extern "C" {
1590 static void ERR_load_CL_strings(void);
1591 static void ERR_unload_CL_strings(void);
1592 static void ERR_CL_error(int function, int reason, char *file, int line);
1593 -# define CLerr(f,r) ERR_CL_error((f),(r),__FILE__,__LINE__)
1594 +# define CLerr(f,r) ERR_CL_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1595
1596 /* Error codes for the CL functions. */
1597
1598 diff --git a/demos/engines/ibmca/hw_ibmca_err.h b/demos/engines/ibmca/hw_ibmca_err.h
1599 index c17e0c9..10d0212 100644
1600 --- a/demos/engines/ibmca/hw_ibmca_err.h
1601 +++ b/demos/engines/ibmca/hw_ibmca_err.h
1602 @@ -67,7 +67,7 @@ extern "C" {
1603 static void ERR_load_IBMCA_strings(void);
1604 static void ERR_unload_IBMCA_strings(void);
1605 static void ERR_IBMCA_error(int function, int reason, char *file, int line);
1606 -# define IBMCAerr(f,r) ERR_IBMCA_error((f),(r),__FILE__,__LINE__)
1607 +# define IBMCAerr(f,r) ERR_IBMCA_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1608
1609 /* Error codes for the IBMCA functions. */
1610
1611 diff --git a/demos/engines/rsaref/rsaref_err.h b/demos/engines/rsaref/rsaref_err.h
1612 index 4356815..598836f 100644
1613 --- a/demos/engines/rsaref/rsaref_err.h
1614 +++ b/demos/engines/rsaref/rsaref_err.h
1615 @@ -68,7 +68,7 @@ extern "C" {
1616 static void ERR_load_RSAREF_strings(void);
1617 static void ERR_unload_RSAREF_strings(void);
1618 static void ERR_RSAREF_error(int function, int reason, char *file, int line);
1619 -# define RSAREFerr(f,r) ERR_RSAREF_error((f),(r),__FILE__,__LINE__)
1620 +# define RSAREFerr(f,r) ERR_RSAREF_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1621 /* Error codes for the RSAREF functions. */
1622
1623 /* Function codes. */
1624 diff --git a/demos/engines/zencod/hw_zencod_err.h b/demos/engines/zencod/hw_zencod_err.h
1625 index f4a8358..94d3293 100644
1626 --- a/demos/engines/zencod/hw_zencod_err.h
1627 +++ b/demos/engines/zencod/hw_zencod_err.h
1628 @@ -67,7 +67,7 @@ extern "C" {
1629 static void ERR_load_ZENCOD_strings(void);
1630 static void ERR_unload_ZENCOD_strings(void);
1631 static void ERR_ZENCOD_error(int function, int reason, char *file, int line);
1632 -# define ZENCODerr(f,r) ERR_ZENCOD_error((f),(r),__FILE__,__LINE__)
1633 +# define ZENCODerr(f,r) ERR_ZENCOD_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1634
1635 /* Error codes for the ZENCOD functions. */
1636
1637 diff --git a/doc/crypto/X509_VERIFY_PARAM_set_flags.pod b/doc/crypto/X509_VERIFY_PARAM_set_flags.pod
1638 index 44792f9..7f95d58 100644
1639 --- a/doc/crypto/X509_VERIFY_PARAM_set_flags.pod
1640 +++ b/doc/crypto/X509_VERIFY_PARAM_set_flags.pod
1641 @@ -203,6 +203,10 @@ chain found is not trusted, then OpenSSL will continue to check to see if an
1642 alternative chain can be found that is trusted. With this flag set the behaviour
1643 will match that of OpenSSL versions prior to 1.0.2b.
1644
1645 +The B<X509_V_FLAG_NO_CHECK_TIME> flag suppresses checking the validity period
1646 +of certificates and CRLs against the current time. If X509_VERIFY_PARAM_set_time()
1647 +is used to specify a verification time, the check is not suppressed.
1648 +
1649 =head1 NOTES
1650
1651 The above functions should be used to manipulate verification parameters
1652 diff --git a/doc/crypto/threads.pod b/doc/crypto/threads.pod
1653 index dc0e939..fe123bb 100644
1654 --- a/doc/crypto/threads.pod
1655 +++ b/doc/crypto/threads.pod
1656 @@ -51,15 +51,15 @@ CRYPTO_destroy_dynlockid, CRYPTO_lock - OpenSSL thread support
1657 void CRYPTO_lock(int mode, int n, const char *file, int line);
1658
1659 #define CRYPTO_w_lock(type) \
1660 - CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
1661 + CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,OPENSSL_FILE,OPENSSL_LINE)
1662 #define CRYPTO_w_unlock(type) \
1663 - CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
1664 + CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,OPENSSL_FILE,OPENSSL_LINE)
1665 #define CRYPTO_r_lock(type) \
1666 - CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__)
1667 + CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,OPENSSL_FILE,OPENSSL_LINE)
1668 #define CRYPTO_r_unlock(type) \
1669 - CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__)
1670 + CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,OPENSSL_FILE,OPENSSL_LINE)
1671 #define CRYPTO_add(addr,amount,type) \
1672 - CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__)
1673 + CRYPTO_add_lock(addr,amount,type,OPENSSL_FILE,OPENSSL_LINE)
1674
1675 =head1 DESCRIPTION
1676
1677 diff --git a/e_os.h b/e_os.h
1678 index 1fa36c1..3e9dae2 100644
1679 --- a/e_os.h
1680 +++ b/e_os.h
1681 @@ -136,7 +136,7 @@ extern "C" {
1682 # define MSDOS
1683 # endif
1684
1685 -# if defined(MSDOS) && !defined(GETPID_IS_MEANINGLESS)
1686 +# if (defined(MSDOS) || defined(OPENSSL_SYS_UEFI)) && !defined(GETPID_IS_MEANINGLESS)
1687 # define GETPID_IS_MEANINGLESS
1688 # endif
1689
1690 diff --git a/e_os2.h b/e_os2.h
1691 index 7be9989..909e22f 100644
1692 --- a/e_os2.h
1693 +++ b/e_os2.h
1694 @@ -97,7 +97,14 @@ extern "C" {
1695 * For 32 bit environment, there seems to be the CygWin environment and then
1696 * all the others that try to do the same thing Microsoft does...
1697 */
1698 -# if defined(OPENSSL_SYSNAME_UWIN)
1699 +/*
1700 + * UEFI lives here because it might be built with a Microsoft toolchain and
1701 + * we need to avoid the false positive match on Windows.
1702 + */
1703 +# if defined(OPENSSL_SYSNAME_UEFI)
1704 +# undef OPENSSL_SYS_UNIX
1705 +# define OPENSSL_SYS_UEFI
1706 +# elif defined(OPENSSL_SYSNAME_UWIN)
1707 # undef OPENSSL_SYS_UNIX
1708 # define OPENSSL_SYS_WIN32_UWIN
1709 # else
1710 diff --git a/engines/ccgost/e_gost_err.h b/engines/ccgost/e_gost_err.h
1711 index a2018ec..9eacdcf 100644
1712 --- a/engines/ccgost/e_gost_err.h
1713 +++ b/engines/ccgost/e_gost_err.h
1714 @@ -67,7 +67,7 @@ extern "C" {
1715 void ERR_load_GOST_strings(void);
1716 void ERR_unload_GOST_strings(void);
1717 void ERR_GOST_error(int function, int reason, char *file, int line);
1718 -# define GOSTerr(f,r) ERR_GOST_error((f),(r),__FILE__,__LINE__)
1719 +# define GOSTerr(f,r) ERR_GOST_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1720
1721 /* Error codes for the GOST functions. */
1722
1723 diff --git a/engines/e_4758cca_err.h b/engines/e_4758cca_err.h
1724 index 2f29d96..47a2635 100644
1725 --- a/engines/e_4758cca_err.h
1726 +++ b/engines/e_4758cca_err.h
1727 @@ -67,7 +67,7 @@ extern "C" {
1728 static void ERR_load_CCA4758_strings(void);
1729 static void ERR_unload_CCA4758_strings(void);
1730 static void ERR_CCA4758_error(int function, int reason, char *file, int line);
1731 -# define CCA4758err(f,r) ERR_CCA4758_error((f),(r),__FILE__,__LINE__)
1732 +# define CCA4758err(f,r) ERR_CCA4758_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1733
1734 /* Error codes for the CCA4758 functions. */
1735
1736 diff --git a/engines/e_aep_err.h b/engines/e_aep_err.h
1737 index 2ed0114..1f8fa5b 100644
1738 --- a/engines/e_aep_err.h
1739 +++ b/engines/e_aep_err.h
1740 @@ -67,7 +67,7 @@ extern "C" {
1741 static void ERR_load_AEPHK_strings(void);
1742 static void ERR_unload_AEPHK_strings(void);
1743 static void ERR_AEPHK_error(int function, int reason, char *file, int line);
1744 -# define AEPHKerr(f,r) ERR_AEPHK_error((f),(r),__FILE__,__LINE__)
1745 +# define AEPHKerr(f,r) ERR_AEPHK_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1746
1747 /* Error codes for the AEPHK functions. */
1748
1749 diff --git a/engines/e_atalla_err.h b/engines/e_atalla_err.h
1750 index 7b71eff..d958496 100644
1751 --- a/engines/e_atalla_err.h
1752 +++ b/engines/e_atalla_err.h
1753 @@ -67,7 +67,7 @@ extern "C" {
1754 static void ERR_load_ATALLA_strings(void);
1755 static void ERR_unload_ATALLA_strings(void);
1756 static void ERR_ATALLA_error(int function, int reason, char *file, int line);
1757 -# define ATALLAerr(f,r) ERR_ATALLA_error((f),(r),__FILE__,__LINE__)
1758 +# define ATALLAerr(f,r) ERR_ATALLA_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1759
1760 /* Error codes for the ATALLA functions. */
1761
1762 diff --git a/engines/e_capi_err.h b/engines/e_capi_err.h
1763 index b5d06dc..cfe46b1 100644
1764 --- a/engines/e_capi_err.h
1765 +++ b/engines/e_capi_err.h
1766 @@ -67,7 +67,7 @@ extern "C" {
1767 static void ERR_load_CAPI_strings(void);
1768 static void ERR_unload_CAPI_strings(void);
1769 static void ERR_CAPI_error(int function, int reason, char *file, int line);
1770 -# define CAPIerr(f,r) ERR_CAPI_error((f),(r),__FILE__,__LINE__)
1771 +# define CAPIerr(f,r) ERR_CAPI_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1772
1773 /* Error codes for the CAPI functions. */
1774
1775 diff --git a/engines/e_chil_err.h b/engines/e_chil_err.h
1776 index d86a4ce..3d961b9 100644
1777 --- a/engines/e_chil_err.h
1778 +++ b/engines/e_chil_err.h
1779 @@ -67,7 +67,7 @@ extern "C" {
1780 static void ERR_load_HWCRHK_strings(void);
1781 static void ERR_unload_HWCRHK_strings(void);
1782 static void ERR_HWCRHK_error(int function, int reason, char *file, int line);
1783 -# define HWCRHKerr(f,r) ERR_HWCRHK_error((f),(r),__FILE__,__LINE__)
1784 +# define HWCRHKerr(f,r) ERR_HWCRHK_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1785
1786 /* Error codes for the HWCRHK functions. */
1787
1788 diff --git a/engines/e_cswift_err.h b/engines/e_cswift_err.h
1789 index fde3a82..7c20691 100644
1790 --- a/engines/e_cswift_err.h
1791 +++ b/engines/e_cswift_err.h
1792 @@ -67,7 +67,7 @@ extern "C" {
1793 static void ERR_load_CSWIFT_strings(void);
1794 static void ERR_unload_CSWIFT_strings(void);
1795 static void ERR_CSWIFT_error(int function, int reason, char *file, int line);
1796 -# define CSWIFTerr(f,r) ERR_CSWIFT_error((f),(r),__FILE__,__LINE__)
1797 +# define CSWIFTerr(f,r) ERR_CSWIFT_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1798
1799 /* Error codes for the CSWIFT functions. */
1800
1801 diff --git a/engines/e_gmp_err.h b/engines/e_gmp_err.h
1802 index 637abbc..ccaf3da 100644
1803 --- a/engines/e_gmp_err.h
1804 +++ b/engines/e_gmp_err.h
1805 @@ -67,7 +67,7 @@ extern "C" {
1806 static void ERR_load_GMP_strings(void);
1807 static void ERR_unload_GMP_strings(void);
1808 static void ERR_GMP_error(int function, int reason, char *file, int line);
1809 -# define GMPerr(f,r) ERR_GMP_error((f),(r),__FILE__,__LINE__)
1810 +# define GMPerr(f,r) ERR_GMP_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1811
1812 /* Error codes for the GMP functions. */
1813
1814 diff --git a/engines/e_nuron_err.h b/engines/e_nuron_err.h
1815 index aa7849c..e607d3e 100644
1816 --- a/engines/e_nuron_err.h
1817 +++ b/engines/e_nuron_err.h
1818 @@ -67,7 +67,7 @@ extern "C" {
1819 static void ERR_load_NURON_strings(void);
1820 static void ERR_unload_NURON_strings(void);
1821 static void ERR_NURON_error(int function, int reason, char *file, int line);
1822 -# define NURONerr(f,r) ERR_NURON_error((f),(r),__FILE__,__LINE__)
1823 +# define NURONerr(f,r) ERR_NURON_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1824
1825 /* Error codes for the NURON functions. */
1826
1827 diff --git a/engines/e_sureware_err.h b/engines/e_sureware_err.h
1828 index bef8623..54f2848 100644
1829 --- a/engines/e_sureware_err.h
1830 +++ b/engines/e_sureware_err.h
1831 @@ -68,7 +68,7 @@ static void ERR_load_SUREWARE_strings(void);
1832 static void ERR_unload_SUREWARE_strings(void);
1833 static void ERR_SUREWARE_error(int function, int reason, char *file,
1834 int line);
1835 -# define SUREWAREerr(f,r) ERR_SUREWARE_error((f),(r),__FILE__,__LINE__)
1836 +# define SUREWAREerr(f,r) ERR_SUREWARE_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1837
1838 /* Error codes for the SUREWARE functions. */
1839
1840 diff --git a/engines/e_ubsec_err.h b/engines/e_ubsec_err.h
1841 index c8aec7c..67110ed 100644
1842 --- a/engines/e_ubsec_err.h
1843 +++ b/engines/e_ubsec_err.h
1844 @@ -67,7 +67,7 @@ extern "C" {
1845 static void ERR_load_UBSEC_strings(void);
1846 static void ERR_unload_UBSEC_strings(void);
1847 static void ERR_UBSEC_error(int function, int reason, char *file, int line);
1848 -# define UBSECerr(f,r) ERR_UBSEC_error((f),(r),__FILE__,__LINE__)
1849 +# define UBSECerr(f,r) ERR_UBSEC_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1850
1851 /* Error codes for the UBSEC functions. */
1852
1853 diff --git a/makevms.com b/makevms.com
1854 index f6b3ff2..1dcbe36 100755
1855 --- a/makevms.com
1856 +++ b/makevms.com
1857 @@ -293,6 +293,7 @@ $ CONFIG_LOGICALS := AES,-
1858 RFC3779,-
1859 RIPEMD,-
1860 RSA,-
1861 + SCT,-
1862 SCTP,-
1863 SEED,-
1864 SHA,-
1865 diff --git a/ssl/d1_both.c b/ssl/d1_both.c
1866 index 9bc6153..b5648eb 100644
1867 --- a/ssl/d1_both.c
1868 +++ b/ssl/d1_both.c
1869 @@ -1068,7 +1068,7 @@ int dtls1_send_change_cipher_spec(SSL *s, int a, int b)
1870 int dtls1_read_failed(SSL *s, int code)
1871 {
1872 if (code > 0) {
1873 - fprintf(stderr, "invalid state reached %s:%d", __FILE__, __LINE__);
1874 + fprintf(stderr, "dtls1_read_failed(); invalid state reached\n");
1875 return 1;
1876 }
1877
1878 diff --git a/ssl/ssl_asn1.c b/ssl/ssl_asn1.c
1879 index 499f0e8..5672f99 100644
1880 --- a/ssl/ssl_asn1.c
1881 +++ b/ssl/ssl_asn1.c
1882 @@ -418,7 +418,7 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,
1883 if (ssl_version == SSL2_VERSION) {
1884 if (os.length != 3) {
1885 c.error = SSL_R_CIPHER_CODE_WRONG_LENGTH;
1886 - c.line = __LINE__;
1887 + c.line = OPENSSL_LINE;
1888 goto err;
1889 }
1890 id = 0x02000000L |
1891 @@ -429,14 +429,14 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,
1892 || ssl_version == DTLS1_BAD_VER) {
1893 if (os.length != 2) {
1894 c.error = SSL_R_CIPHER_CODE_WRONG_LENGTH;
1895 - c.line = __LINE__;
1896 + c.line = OPENSSL_LINE;
1897 goto err;
1898 }
1899 id = 0x03000000L |
1900 ((unsigned long)os.data[0] << 8L) | (unsigned long)os.data[1];
1901 } else {
1902 c.error = SSL_R_UNKNOWN_SSL_VERSION;
1903 - c.line = __LINE__;
1904 + c.line = OPENSSL_LINE;
1905 goto err;
1906 }
1907
1908 @@ -526,7 +526,7 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,
1909 if (os.data != NULL) {
1910 if (os.length > SSL_MAX_SID_CTX_LENGTH) {
1911 c.error = SSL_R_BAD_LENGTH;
1912 - c.line = __LINE__;
1913 + c.line = OPENSSL_LINE;
1914 OPENSSL_free(os.data);
1915 os.data = NULL;
1916 os.length = 0;
1917 diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c
1918 index f48ebae..ac4f08c 100644
1919 --- a/ssl/ssl_cert.c
1920 +++ b/ssl/ssl_cert.c
1921 @@ -857,12 +857,12 @@ int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x)
1922 return (add_client_CA(&(ctx->client_CA), x));
1923 }
1924
1925 +#ifndef OPENSSL_NO_STDIO
1926 static int xname_cmp(const X509_NAME *const *a, const X509_NAME *const *b)
1927 {
1928 return (X509_NAME_cmp(*a, *b));
1929 }
1930
1931 -#ifndef OPENSSL_NO_STDIO
1932 /**
1933 * Load CA certs from a file into a ::STACK. Note that it is somewhat misnamed;
1934 * it doesn't really have anything to do with clients (except that a common use
1935 @@ -930,7 +930,6 @@ STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file)
1936 ERR_clear_error();
1937 return (ret);
1938 }
1939 -#endif
1940
1941 /**
1942 * Add a file of certs to a stack.
1943 @@ -1050,6 +1049,7 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
1944 CRYPTO_w_unlock(CRYPTO_LOCK_READDIR);
1945 return ret;
1946 }
1947 +#endif /* !OPENSSL_NO_STDIO */
1948
1949 /* Add a certificate to a BUF_MEM structure */
1950
1951 diff --git a/ssl/ssl_conf.c b/ssl/ssl_conf.c
1952 index 8d3709d..2bb403b 100644
1953 --- a/ssl/ssl_conf.c
1954 +++ b/ssl/ssl_conf.c
1955 @@ -370,6 +370,7 @@ static int cmd_Options(SSL_CONF_CTX *cctx, const char *value)
1956 return CONF_parse_list(value, ',', 1, ssl_set_option_list, cctx);
1957 }
1958
1959 +#ifndef OPENSSL_NO_STDIO
1960 static int cmd_Certificate(SSL_CONF_CTX *cctx, const char *value)
1961 {
1962 int rv = 1;
1963 @@ -436,7 +437,9 @@ static int cmd_DHParameters(SSL_CONF_CTX *cctx, const char *value)
1964 BIO_free(in);
1965 return rv > 0;
1966 }
1967 -#endif
1968 +#endif /* !OPENSSL_NO_DH */
1969 +#endif /* !OPENSSL_NO_STDIO */
1970 +
1971 typedef struct {
1972 int (*cmd) (SSL_CONF_CTX *cctx, const char *value);
1973 const char *str_file;
1974 @@ -462,12 +465,14 @@ static const ssl_conf_cmd_tbl ssl_conf_cmds[] = {
1975 SSL_CONF_CMD_STRING(CipherString, "cipher"),
1976 SSL_CONF_CMD_STRING(Protocol, NULL),
1977 SSL_CONF_CMD_STRING(Options, NULL),
1978 +#ifndef OPENSSL_NO_STDIO
1979 SSL_CONF_CMD(Certificate, "cert", SSL_CONF_TYPE_FILE),
1980 SSL_CONF_CMD(PrivateKey, "key", SSL_CONF_TYPE_FILE),
1981 SSL_CONF_CMD(ServerInfoFile, NULL, SSL_CONF_TYPE_FILE),
1982 #ifndef OPENSSL_NO_DH
1983 SSL_CONF_CMD(DHParameters, "dhparam", SSL_CONF_TYPE_FILE)
1984 #endif
1985 +#endif
1986 };
1987
1988 static int ssl_conf_cmd_skip_prefix(SSL_CONF_CTX *cctx, const char **pcmd)
1989 diff --git a/ssl/t1_enc.c b/ssl/t1_enc.c
1990 index b6d1ee9..75f38cd 100644
1991 --- a/ssl/t1_enc.c
1992 +++ b/ssl/t1_enc.c
1993 @@ -779,9 +779,7 @@ int tls1_enc(SSL *s, int send)
1994 * we can't write into the input stream: Can this ever
1995 * happen?? (steve)
1996 */
1997 - fprintf(stderr,
1998 - "%s:%d: rec->data != rec->input\n",
1999 - __FILE__, __LINE__);
2000 + fprintf(stderr, "tls1_enc: rec->data != rec->input\n");
2001 else if (RAND_bytes(rec->input, ivlen) <= 0)
2002 return -1;
2003 }
2004 diff --git a/test/cms-test.pl b/test/cms-test.pl
2005 index baa3b59..1ee3f02 100644
2006 --- a/test/cms-test.pl
2007 +++ b/test/cms-test.pl
2008 @@ -100,6 +100,13 @@ my $no_ec2m;
2009 my $no_ecdh;
2010 my $ossl8 = `$ossl_path version -v` =~ /0\.9\.8/;
2011
2012 +system ("$ossl_path no-cms > $null_path");
2013 +if ($? == 0)
2014 + {
2015 + print "CMS disabled\n";
2016 + exit 0;
2017 + }
2018 +
2019 system ("$ossl_path no-ec > $null_path");
2020 if ($? == 0)
2021 {
2022 diff --git a/util/libeay.num b/util/libeay.num
2023 index 2094ab3..992abb2 100755
2024 --- a/util/libeay.num
2025 +++ b/util/libeay.num
2026 @@ -4370,7 +4370,7 @@ DH_compute_key_padded 4732 EXIST::FUNCTION:DH
2027 ECDSA_METHOD_set_sign 4733 EXIST::FUNCTION:ECDSA
2028 CMS_RecipientEncryptedKey_cert_cmp 4734 EXIST:!VMS:FUNCTION:CMS
2029 CMS_RecipEncryptedKey_cert_cmp 4734 EXIST:VMS:FUNCTION:CMS
2030 -DH_KDF_X9_42 4735 EXIST::FUNCTION:DH
2031 +DH_KDF_X9_42 4735 EXIST::FUNCTION:CMS,DH
2032 RSA_OAEP_PARAMS_free 4736 EXIST::FUNCTION:RSA
2033 EVP_des_ede3_wrap 4737 EXIST::FUNCTION:DES
2034 RSA_OAEP_PARAMS_it 4738 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RSA
2035 diff --git a/util/mkdef.pl b/util/mkdef.pl
2036 index b9b159a..9841498 100755
2037 --- a/util/mkdef.pl
2038 +++ b/util/mkdef.pl
2039 @@ -97,6 +97,8 @@ my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF",
2040 "FP_API", "STDIO", "SOCK", "KRB5", "DGRAM",
2041 # Engines
2042 "STATIC_ENGINE", "ENGINE", "HW", "GMP",
2043 + # X.509v3 Signed Certificate Timestamps
2044 + "SCT",
2045 # RFC3779
2046 "RFC3779",
2047 # TLS
2048 @@ -144,7 +146,7 @@ my $no_md2; my $no_md4; my $no_md5; my $no_sha; my $no_ripemd; my $no_mdc2;
2049 my $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=0; my $no_aes; my $no_krb5;
2050 my $no_ec; my $no_ecdsa; my $no_ecdh; my $no_engine; my $no_hw;
2051 my $no_fp_api; my $no_static_engine=1; my $no_gmp; my $no_deprecated;
2052 -my $no_rfc3779; my $no_psk; my $no_tlsext; my $no_cms; my $no_capieng;
2053 +my $no_sct; my $no_rfc3779; my $no_psk; my $no_tlsext; my $no_cms; my $no_capieng;
2054 my $no_jpake; my $no_srp; my $no_ssl2; my $no_ec2m; my $no_nistp_gcc;
2055 my $no_nextprotoneg; my $no_sctp; my $no_srtp; my $no_ssl_trace;
2056 my $no_unit_test; my $no_ssl3_method; my $no_ssl2_method;
2057 @@ -235,6 +237,7 @@ foreach (@ARGV, split(/ /, $options))
2058 elsif (/^no-engine$/) { $no_engine=1; }
2059 elsif (/^no-hw$/) { $no_hw=1; }
2060 elsif (/^no-gmp$/) { $no_gmp=1; }
2061 + elsif (/^no-sct$/) { $no_sct=1; }
2062 elsif (/^no-rfc3779$/) { $no_rfc3779=1; }
2063 elsif (/^no-tlsext$/) { $no_tlsext=1; }
2064 elsif (/^no-cms$/) { $no_cms=1; }
2065 @@ -1209,6 +1212,7 @@ sub is_valid
2066 if ($keyword eq "FP_API" && $no_fp_api) { return 0; }
2067 if ($keyword eq "STATIC_ENGINE" && $no_static_engine) { return 0; }
2068 if ($keyword eq "GMP" && $no_gmp) { return 0; }
2069 + if ($keyword eq "SCT" && $no_sct) { return 0; }
2070 if ($keyword eq "RFC3779" && $no_rfc3779) { return 0; }
2071 if ($keyword eq "TLSEXT" && $no_tlsext) { return 0; }
2072 if ($keyword eq "PSK" && $no_psk) { return 0; }
2073 diff --git a/util/mkerr.pl b/util/mkerr.pl
2074 index c197f3a..97b295c 100644
2075 --- a/util/mkerr.pl
2076 +++ b/util/mkerr.pl
2077 @@ -89,7 +89,7 @@ Options:
2078 void ERR_load_<LIB>_strings(void);
2079 void ERR_unload_<LIB>_strings(void);
2080 void ERR_<LIB>_error(int f, int r, char *fn, int ln);
2081 - #define <LIB>err(f,r) ERR_<LIB>_error(f,r,__FILE__,__LINE__)
2082 + #define <LIB>err(f,r) ERR_<LIB>_error(f,r,OPENSSL_FILE,OPENSSL_LINE)
2083 while the code facilitates the use of these in an environment
2084 where the error support routines are dynamically loaded at
2085 runtime.
2086 @@ -482,7 +482,7 @@ EOF
2087 ${staticloader}void ERR_load_${lib}_strings(void);
2088 ${staticloader}void ERR_unload_${lib}_strings(void);
2089 ${staticloader}void ERR_${lib}_error(int function, int reason, char *file, int line);
2090 -# define ${lib}err(f,r) ERR_${lib}_error((f),(r),__FILE__,__LINE__)
2091 +# define ${lib}err(f,r) ERR_${lib}_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
2092
2093 EOF
2094 }