]> git.proxmox.com Git - mirror_edk2.git/blob - CryptoPkg/Library/OpensslLib/EDKII_openssl-1.0.2g.patch
CryptoPkg: update openssl to ignore RVCT 3079
[mirror_edk2.git] / CryptoPkg / Library / OpensslLib / EDKII_openssl-1.0.2g.patch
1 diff --git a/Configure b/Configure
2 index c98107a..c122709 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 @@ -1088,7 +1091,7 @@ if (defined($disabled{"tls1"}))
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 b1dd970..8278c28 100644
26 --- a/apps/apps.c
27 +++ b/apps/apps.c
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;
34 else
35 return 0;
36
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)
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..e933ead 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..41cf38e 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 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,
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..4eddb9a 100644
688 --- a/crypto/dh/dh_kdf.c
689 +++ b/crypto/dh/dh_kdf.c
690 @@ -51,13 +51,18 @@
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 #include <openssl/asn1.h>
701 #include <openssl/cms.h>
702
703 +
704 /* Key derivation from X9.42/RFC2631 */
705 +/* Uses CMS functions, hence the #ifdef wrapper. */
706
707 #define DH_KDF_MAX (1L << 30)
708
709 @@ -185,3 +190,4 @@ int DH_KDF_X9_42(unsigned char *out, size_t outlen,
710 EVP_MD_CTX_cleanup(&mctx);
711 return rv;
712 }
713 +#endif
714 diff --git a/crypto/dh/dh_pmeth.c b/crypto/dh/dh_pmeth.c
715 index b58e3fa..c6288f6 100644
716 --- a/crypto/dh/dh_pmeth.c
717 +++ b/crypto/dh/dh_pmeth.c
718 @@ -207,7 +207,11 @@ static int pkey_dh_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
719 case EVP_PKEY_CTRL_DH_KDF_TYPE:
720 if (p1 == -2)
721 return dctx->kdf_type;
722 +#ifdef OPENSSL_NO_CMS
723 + if (p1 != EVP_PKEY_DH_KDF_NONE)
724 +#else
725 if (p1 != EVP_PKEY_DH_KDF_NONE && p1 != EVP_PKEY_DH_KDF_X9_42)
726 +#endif
727 return -2;
728 dctx->kdf_type = p1;
729 return 1;
730 @@ -448,7 +452,10 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned char *key,
731 return ret;
732 *keylen = ret;
733 return 1;
734 - } else if (dctx->kdf_type == EVP_PKEY_DH_KDF_X9_42) {
735 + }
736 +#ifndef OPENSSL_NO_CMS
737 + else if (dctx->kdf_type == EVP_PKEY_DH_KDF_X9_42) {
738 +
739 unsigned char *Z = NULL;
740 size_t Zlen = 0;
741 if (!dctx->kdf_outlen || !dctx->kdf_oid)
742 @@ -479,7 +486,8 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned char *key,
743 }
744 return ret;
745 }
746 - return 1;
747 +#endif
748 + return 0;
749 }
750
751 const EVP_PKEY_METHOD dh_pkey_meth = {
752 diff --git a/crypto/ec/ec_ameth.c b/crypto/ec/ec_ameth.c
753 index 83e208c..4869098 100644
754 --- a/crypto/ec/ec_ameth.c
755 +++ b/crypto/ec/ec_ameth.c
756 @@ -67,8 +67,10 @@
757 #include <openssl/asn1t.h>
758 #include "asn1_locl.h"
759
760 +#ifndef OPENSSL_NO_CMS
761 static int ecdh_cms_decrypt(CMS_RecipientInfo *ri);
762 static int ecdh_cms_encrypt(CMS_RecipientInfo *ri);
763 +#endif
764
765 static int eckey_param2type(int *pptype, void **ppval, EC_KEY *ec_key)
766 {
767 diff --git a/crypto/engine/eng_int.h b/crypto/engine/eng_int.h
768 index 46f163b..b4a72a0 100644
769 --- a/crypto/engine/eng_int.h
770 +++ b/crypto/engine/eng_int.h
771 @@ -88,7 +88,7 @@ extern "C" {
772 (unsigned int)(e), (isfunct ? "funct" : "struct"), \
773 ((isfunct) ? ((e)->funct_ref - (diff)) : ((e)->struct_ref - (diff))), \
774 ((isfunct) ? (e)->funct_ref : (e)->struct_ref), \
775 - (__FILE__), (__LINE__));
776 + (OPENSSL_FILE), (OPENSSL_LINE));
777
778 # else
779
780 @@ -136,7 +136,7 @@ ENGINE *engine_table_select(ENGINE_TABLE **table, int nid);
781 # else
782 ENGINE *engine_table_select_tmp(ENGINE_TABLE **table, int nid, const char *f,
783 int l);
784 -# define engine_table_select(t,n) engine_table_select_tmp(t,n,__FILE__,__LINE__)
785 +# define engine_table_select(t,n) engine_table_select_tmp(t,n,OPENSSL_FILE,OPENSSL_LINE)
786 # endif
787 typedef void (engine_table_doall_cb) (int nid, STACK_OF(ENGINE) *sk,
788 ENGINE *def, void *arg);
789 diff --git a/crypto/engine/eng_openssl.c b/crypto/engine/eng_openssl.c
790 index 34b0029..cf622bb 100644
791 --- a/crypto/engine/eng_openssl.c
792 +++ b/crypto/engine/eng_openssl.c
793 @@ -86,7 +86,9 @@
794 * this is no longer automatic in ENGINE_load_builtin_engines().
795 */
796 #define TEST_ENG_OPENSSL_RC4
797 +#ifndef OPENSSL_NO_FP_API
798 #define TEST_ENG_OPENSSL_PKEY
799 +#endif
800 /* #define TEST_ENG_OPENSSL_RC4_OTHERS */
801 #define TEST_ENG_OPENSSL_RC4_P_INIT
802 /* #define TEST_ENG_OPENSSL_RC4_P_CIPHER */
803 diff --git a/crypto/err/err.h b/crypto/err/err.h
804 index 585aa8b..04c6cfc 100644
805 --- a/crypto/err/err.h
806 +++ b/crypto/err/err.h
807 @@ -200,39 +200,39 @@ typedef struct err_state_st {
808
809 # define ERR_LIB_USER 128
810
811 -# define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),__FILE__,__LINE__)
812 -# define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),__FILE__,__LINE__)
813 -# define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),__FILE__,__LINE__)
814 -# define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),__FILE__,__LINE__)
815 -# define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),__FILE__,__LINE__)
816 -# define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),__FILE__,__LINE__)
817 -# define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),__FILE__,__LINE__)
818 -# define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),__FILE__,__LINE__)
819 -# define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),__FILE__,__LINE__)
820 -# define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),__FILE__,__LINE__)
821 -# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),__FILE__,__LINE__)
822 -# define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),__FILE__,__LINE__)
823 -# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),__FILE__,__LINE__)
824 -# define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),__FILE__,__LINE__)
825 -# define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),__FILE__,__LINE__)
826 -# define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),__FILE__,__LINE__)
827 -# define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),__FILE__,__LINE__)
828 -# define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),__FILE__,__LINE__)
829 -# define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),__FILE__,__LINE__)
830 -# define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),__FILE__,__LINE__)
831 -# define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),__FILE__,__LINE__)
832 -# define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),__FILE__,__LINE__)
833 -# define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),__FILE__,__LINE__)
834 -# define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),__FILE__,__LINE__)
835 -# define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),__FILE__,__LINE__)
836 -# define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),__FILE__,__LINE__)
837 -# define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),__FILE__,__LINE__)
838 -# define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),__FILE__,__LINE__)
839 -# define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),__FILE__,__LINE__)
840 -# define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),__FILE__,__LINE__)
841 -# define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),__FILE__,__LINE__)
842 -# define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),__FILE__,__LINE__)
843 -# define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),__FILE__,__LINE__)
844 +# define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
845 +# define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
846 +# define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
847 +# define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
848 +# define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
849 +# define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
850 +# define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
851 +# define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
852 +# define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
853 +# define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
854 +# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
855 +# define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
856 +# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
857 +# define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
858 +# define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
859 +# define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
860 +# define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
861 +# define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
862 +# define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
863 +# define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
864 +# define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
865 +# define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
866 +# define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
867 +# define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
868 +# define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
869 +# define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
870 +# define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
871 +# define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
872 +# define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
873 +# define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
874 +# define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
875 +# define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
876 +# define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),OPENSSL_FILE,OPENSSL_LINE)
877
878 /*
879 * Borland C seems too stupid to be able to shift and do longs in the
880 diff --git a/crypto/evp/evp.h b/crypto/evp/evp.h
881 index 39ab793..ad1e350 100644
882 --- a/crypto/evp/evp.h
883 +++ b/crypto/evp/evp.h
884 @@ -602,11 +602,13 @@ int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in);
885 int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type);
886 int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s);
887
888 +#ifndef OPENSSL_NO_UI
889 int EVP_read_pw_string(char *buf, int length, const char *prompt, int verify);
890 int EVP_read_pw_string_min(char *buf, int minlen, int maxlen,
891 const char *prompt, int verify);
892 void EVP_set_pw_prompt(const char *prompt);
893 char *EVP_get_pw_prompt(void);
894 +#endif
895
896 int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md,
897 const unsigned char *salt, const unsigned char *data,
898 diff --git a/crypto/evp/evp_key.c b/crypto/evp/evp_key.c
899 index 5be9e33..63c8866 100644
900 --- a/crypto/evp/evp_key.c
901 +++ b/crypto/evp/evp_key.c
902 @@ -63,6 +63,7 @@
903 #include <openssl/evp.h>
904 #include <openssl/ui.h>
905
906 +#ifndef OPENSSL_NO_UI
907 /* should be init to zeros. */
908 static char prompt_string[80];
909
910 @@ -117,6 +118,7 @@ int EVP_read_pw_string_min(char *buf, int min, int len, const char *prompt,
911 OPENSSL_cleanse(buff, BUFSIZ);
912 return ret;
913 }
914 +#endif /* OPENSSL_NO_UI */
915
916 int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md,
917 const unsigned char *salt, const unsigned char *data,
918 diff --git a/crypto/opensslconf.h.in b/crypto/opensslconf.h.in
919 index 7a1c85d..7162c0f 100644
920 --- a/crypto/opensslconf.h.in
921 +++ b/crypto/opensslconf.h.in
922 @@ -1,5 +1,15 @@
923 /* crypto/opensslconf.h.in */
924
925 +#ifndef OPENSSL_FILE
926 +#ifdef OPENSSL_NO_FILENAMES
927 +#define OPENSSL_FILE ""
928 +#define OPENSSL_LINE 0
929 +#else
930 +#define OPENSSL_FILE __FILE__
931 +#define OPENSSL_LINE __LINE__
932 +#endif
933 +#endif
934 +
935 /* Generate 80386 code? */
936 #undef I386_ONLY
937
938 @@ -56,7 +66,7 @@
939 #endif
940 #endif
941
942 -#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
943 +#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) && !defined(OPENSSL_SYSNAME_UEFI)
944 #define CONFIG_HEADER_BN_H
945 #undef BN_LLONG
946
947 diff --git a/crypto/pem/pem.h b/crypto/pem/pem.h
948 index d3b23fc..87b0b6a 100644
949 --- a/crypto/pem/pem.h
950 +++ b/crypto/pem/pem.h
951 @@ -324,6 +324,7 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \
952
953 # define DECLARE_PEM_read_fp(name, type) /**/
954 # define DECLARE_PEM_write_fp(name, type) /**/
955 +# define DECLARE_PEM_write_fp_const(name, type) /**/
956 # define DECLARE_PEM_write_cb_fp(name, type) /**/
957 # else
958
959 @@ -417,6 +418,7 @@ int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc,
960 pem_password_cb *cd, void *u);
961 # endif
962
963 +#ifndef OPENSSL_NO_FP_API
964 int PEM_read(FILE *fp, char **name, char **header,
965 unsigned char **data, long *len);
966 int PEM_write(FILE *fp, const char *name, const char *hdr,
967 @@ -428,6 +430,7 @@ int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp,
968 int klen, pem_password_cb *callback, void *u);
969 STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk,
970 pem_password_cb *cb, void *u);
971 +#endif
972
973 int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type,
974 EVP_MD *md_type, unsigned char **ek, int *ekl,
975 @@ -494,6 +497,7 @@ int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid,
976 EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb,
977 void *u);
978
979 +#ifndef OPENSSL_NO_FP_API
980 int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
981 char *kstr, int klen,
982 pem_password_cb *cb, void *u);
983 @@ -510,7 +514,7 @@ EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb,
984 int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc,
985 char *kstr, int klen, pem_password_cb *cd,
986 void *u);
987 -
988 +#endif
989 EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x);
990 int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x);
991
992 diff --git a/crypto/pem/pem_lib.c b/crypto/pem/pem_lib.c
993 index a29821a..5525efd 100644
994 --- a/crypto/pem/pem_lib.c
995 +++ b/crypto/pem/pem_lib.c
996 @@ -84,7 +84,7 @@ int pem_check_suffix(const char *pem_str, const char *suffix);
997
998 int PEM_def_callback(char *buf, int num, int w, void *key)
999 {
1000 -#ifdef OPENSSL_NO_FP_API
1001 +#if defined(OPENSSL_NO_FP_API) || defined(OPENSSL_NO_UI)
1002 /*
1003 * We should not ever call the default callback routine from windows.
1004 */
1005 diff --git a/crypto/pem/pem_pk8.c b/crypto/pem/pem_pk8.c
1006 index 5747c73..fe465cc 100644
1007 --- a/crypto/pem/pem_pk8.c
1008 +++ b/crypto/pem/pem_pk8.c
1009 @@ -69,10 +69,12 @@
1010 static int do_pk8pkey(BIO *bp, EVP_PKEY *x, int isder,
1011 int nid, const EVP_CIPHER *enc,
1012 char *kstr, int klen, pem_password_cb *cb, void *u);
1013 +
1014 +#ifndef OPENSSL_NO_FP_API
1015 static int do_pk8pkey_fp(FILE *bp, EVP_PKEY *x, int isder,
1016 int nid, const EVP_CIPHER *enc,
1017 char *kstr, int klen, pem_password_cb *cb, void *u);
1018 -
1019 +#endif
1020 /*
1021 * These functions write a private key in PKCS#8 format: it is a "drop in"
1022 * replacement for PEM_write_bio_PrivateKey() and friends. As usual if 'enc'
1023 diff --git a/crypto/pkcs7/pk7_smime.c b/crypto/pkcs7/pk7_smime.c
1024 index dc9b484..0bc3d43 100644
1025 --- a/crypto/pkcs7/pk7_smime.c
1026 +++ b/crypto/pkcs7/pk7_smime.c
1027 @@ -64,6 +64,9 @@
1028 #include <openssl/x509.h>
1029 #include <openssl/x509v3.h>
1030
1031 +
1032 +#define BUFFERSIZE 4096
1033 +
1034 static int pkcs7_copy_existing_digest(PKCS7 *p7, PKCS7_SIGNER_INFO *si);
1035
1036 PKCS7 *PKCS7_sign(X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs,
1037 @@ -254,7 +257,7 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
1038 STACK_OF(PKCS7_SIGNER_INFO) *sinfos;
1039 PKCS7_SIGNER_INFO *si;
1040 X509_STORE_CTX cert_ctx;
1041 - char buf[4096];
1042 + char *buf = NULL;
1043 int i, j = 0, k, ret = 0;
1044 BIO *p7bio = NULL;
1045 BIO *tmpin = NULL, *tmpout = NULL;
1046 @@ -373,8 +376,12 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
1047 tmpout = out;
1048
1049 /* We now have to 'read' from p7bio to calculate digests etc. */
1050 + if ((buf = OPENSSL_malloc(BUFFERSIZE)) == NULL) {
1051 + PKCS7err(PKCS7_F_PKCS7_VERIFY, ERR_R_MALLOC_FAILURE);
1052 + goto err;
1053 + }
1054 for (;;) {
1055 - i = BIO_read(p7bio, buf, sizeof(buf));
1056 + i = BIO_read(p7bio, buf, BUFFERSIZE);
1057 if (i <= 0)
1058 break;
1059 if (tmpout)
1060 @@ -405,6 +412,7 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store,
1061 ret = 1;
1062
1063 err:
1064 + OPENSSL_free(buf);
1065 if (tmpin == indata) {
1066 if (indata)
1067 BIO_pop(p7bio);
1068 @@ -523,7 +531,7 @@ int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags)
1069 {
1070 BIO *tmpmem;
1071 int ret, i;
1072 - char buf[4096];
1073 + char *buf = NULL;
1074
1075 if (!p7) {
1076 PKCS7err(PKCS7_F_PKCS7_DECRYPT, PKCS7_R_INVALID_NULL_POINTER);
1077 @@ -567,24 +575,29 @@ int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags)
1078 }
1079 BIO_free_all(bread);
1080 return ret;
1081 - } else {
1082 - for (;;) {
1083 - i = BIO_read(tmpmem, buf, sizeof(buf));
1084 - if (i <= 0) {
1085 - ret = 1;
1086 - if (BIO_method_type(tmpmem) == BIO_TYPE_CIPHER) {
1087 - if (!BIO_get_cipher_status(tmpmem))
1088 - ret = 0;
1089 - }
1090 -
1091 - break;
1092 - }
1093 - if (BIO_write(data, buf, i) != i) {
1094 - ret = 0;
1095 - break;
1096 + }
1097 + if ((buf = OPENSSL_malloc(BUFFERSIZE)) == NULL) {
1098 + PKCS7err(PKCS7_F_PKCS7_DECRYPT, ERR_R_MALLOC_FAILURE);
1099 + goto err;
1100 + }
1101 + for (;;) {
1102 + i = BIO_read(tmpmem, buf, BUFFERSIZE);
1103 + if (i <= 0) {
1104 + ret = 1;
1105 + if (BIO_method_type(tmpmem) == BIO_TYPE_CIPHER) {
1106 + if (!BIO_get_cipher_status(tmpmem))
1107 + ret = 0;
1108 }
1109 +
1110 + break;
1111 + }
1112 + if (BIO_write(data, buf, i) != i) {
1113 + ret = 0;
1114 + break;
1115 }
1116 - BIO_free_all(tmpmem);
1117 - return ret;
1118 }
1119 +err:
1120 + OPENSSL_free(buf);
1121 + BIO_free_all(tmpmem);
1122 + return ret;
1123 }
1124 diff --git a/crypto/rand/rand_egd.c b/crypto/rand/rand_egd.c
1125 index 737aebf..f23f348 100644
1126 --- a/crypto/rand/rand_egd.c
1127 +++ b/crypto/rand/rand_egd.c
1128 @@ -95,7 +95,7 @@
1129 * RAND_egd() is a wrapper for RAND_egd_bytes() with numbytes=255.
1130 */
1131
1132 -#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)
1133 +#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)
1134 int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes)
1135 {
1136 return (-1);
1137 diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c
1138 index 266111e..f60fac6 100644
1139 --- a/crypto/rand/rand_unix.c
1140 +++ b/crypto/rand/rand_unix.c
1141 @@ -116,7 +116,7 @@
1142 #include <openssl/rand.h>
1143 #include "rand_lcl.h"
1144
1145 -#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))
1146 +#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))
1147
1148 # include <sys/types.h>
1149 # include <sys/time.h>
1150 @@ -439,7 +439,7 @@ int RAND_poll(void)
1151 * defined(OPENSSL_SYS_VXWORKS) ||
1152 * defined(OPENSSL_SYS_NETWARE)) */
1153
1154 -#if defined(OPENSSL_SYS_VXWORKS)
1155 +#if defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_UEFI)
1156 int RAND_poll(void)
1157 {
1158 return 0;
1159 diff --git a/crypto/rsa/rsa_ameth.c b/crypto/rsa/rsa_ameth.c
1160 index 4e06218..ddead3d 100644
1161 --- a/crypto/rsa/rsa_ameth.c
1162 +++ b/crypto/rsa/rsa_ameth.c
1163 @@ -68,10 +68,12 @@
1164 #endif
1165 #include "asn1_locl.h"
1166
1167 +#ifndef OPENSSL_NO_CMS
1168 static int rsa_cms_sign(CMS_SignerInfo *si);
1169 static int rsa_cms_verify(CMS_SignerInfo *si);
1170 static int rsa_cms_decrypt(CMS_RecipientInfo *ri);
1171 static int rsa_cms_encrypt(CMS_RecipientInfo *ri);
1172 +#endif
1173
1174 static int rsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
1175 {
1176 @@ -665,6 +667,7 @@ static int rsa_pss_to_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pkctx,
1177 return rv;
1178 }
1179
1180 +#ifndef OPENSSL_NO_CMS
1181 static int rsa_cms_verify(CMS_SignerInfo *si)
1182 {
1183 int nid, nid2;
1184 @@ -683,6 +686,7 @@ static int rsa_cms_verify(CMS_SignerInfo *si)
1185 }
1186 return 0;
1187 }
1188 +#endif
1189
1190 /*
1191 * Customised RSA item verification routine. This is called when a signature
1192 @@ -705,6 +709,7 @@ static int rsa_item_verify(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
1193 return -1;
1194 }
1195
1196 +#ifndef OPENSSL_NO_CMS
1197 static int rsa_cms_sign(CMS_SignerInfo *si)
1198 {
1199 int pad_mode = RSA_PKCS1_PADDING;
1200 @@ -729,6 +734,7 @@ static int rsa_cms_sign(CMS_SignerInfo *si)
1201 X509_ALGOR_set0(alg, OBJ_nid2obj(NID_rsassaPss), V_ASN1_SEQUENCE, os);
1202 return 1;
1203 }
1204 +#endif
1205
1206 static int rsa_item_sign(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
1207 X509_ALGOR *alg1, X509_ALGOR *alg2,
1208 @@ -762,6 +768,7 @@ static int rsa_item_sign(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
1209 return 2;
1210 }
1211
1212 +#ifndef OPENSSL_NO_CMS
1213 static RSA_OAEP_PARAMS *rsa_oaep_decode(const X509_ALGOR *alg,
1214 X509_ALGOR **pmaskHash)
1215 {
1216 @@ -920,6 +927,7 @@ static int rsa_cms_encrypt(CMS_RecipientInfo *ri)
1217 ASN1_STRING_free(os);
1218 return rv;
1219 }
1220 +#endif
1221
1222 const EVP_PKEY_ASN1_METHOD rsa_asn1_meths[] = {
1223 {
1224 diff --git a/crypto/srp/srp.h b/crypto/srp/srp.h
1225 index 028892a..713fc54 100644
1226 --- a/crypto/srp/srp.h
1227 +++ b/crypto/srp/srp.h
1228 @@ -119,8 +119,9 @@ DECLARE_STACK_OF(SRP_gN)
1229
1230 SRP_VBASE *SRP_VBASE_new(char *seed_key);
1231 int SRP_VBASE_free(SRP_VBASE *vb);
1232 +#ifndef OPENSSL_NO_STDIO
1233 int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file);
1234 -
1235 +#endif
1236 /* This method ignores the configured seed and fails for an unknown user. */
1237 SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username);
1238 /* NOTE: unlike in SRP_VBASE_get_by_user, caller owns the returned pointer.*/
1239 diff --git a/crypto/srp/srp_vfy.c b/crypto/srp/srp_vfy.c
1240 index 26ad3e0..6be4cf2 100644
1241 --- a/crypto/srp/srp_vfy.c
1242 +++ b/crypto/srp/srp_vfy.c
1243 @@ -225,6 +225,7 @@ static int SRP_user_pwd_set_ids(SRP_user_pwd *vinfo, const char *id,
1244 return (info == NULL || NULL != (vinfo->info = BUF_strdup(info)));
1245 }
1246
1247 +#ifndef OPENSSL_NO_STDIO
1248 static int SRP_user_pwd_set_sv(SRP_user_pwd *vinfo, const char *s,
1249 const char *v)
1250 {
1251 @@ -239,6 +240,7 @@ static int SRP_user_pwd_set_sv(SRP_user_pwd *vinfo, const char *s,
1252 len = t_fromb64(tmp, s);
1253 return ((vinfo->s = BN_bin2bn(tmp, len, NULL)) != NULL);
1254 }
1255 +#endif
1256
1257 static int SRP_user_pwd_set_sv_BN(SRP_user_pwd *vinfo, BIGNUM *s, BIGNUM *v)
1258 {
1259 @@ -297,6 +299,7 @@ int SRP_VBASE_free(SRP_VBASE *vb)
1260 return 0;
1261 }
1262
1263 +#ifndef OPENSSL_NO_STDIO
1264 static SRP_gN_cache *SRP_gN_new_init(const char *ch)
1265 {
1266 unsigned char tmp[MAX_LEN];
1267 @@ -328,6 +331,7 @@ static void SRP_gN_free(SRP_gN_cache *gN_cache)
1268 BN_free(gN_cache->bn);
1269 OPENSSL_free(gN_cache);
1270 }
1271 +#endif
1272
1273 static SRP_gN *SRP_get_gN_by_id(const char *id, STACK_OF(SRP_gN) *gN_tab)
1274 {
1275 @@ -344,6 +348,7 @@ static SRP_gN *SRP_get_gN_by_id(const char *id, STACK_OF(SRP_gN) *gN_tab)
1276 return SRP_get_default_gN(id);
1277 }
1278
1279 +#ifndef OPENSSL_NO_STDIO
1280 static BIGNUM *SRP_gN_place_bn(STACK_OF(SRP_gN_cache) *gN_cache, char *ch)
1281 {
1282 int i;
1283 @@ -485,6 +490,7 @@ int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file)
1284 return error_code;
1285
1286 }
1287 +#endif
1288
1289 static SRP_user_pwd *find_user(SRP_VBASE *vb, char *username)
1290 {
1291 diff --git a/crypto/ts/ts.h b/crypto/ts/ts.h
1292 index 16eccbb..a9fe40e 100644
1293 --- a/crypto/ts/ts.h
1294 +++ b/crypto/ts/ts.h
1295 @@ -281,8 +281,10 @@ TS_REQ *d2i_TS_REQ(TS_REQ **a, const unsigned char **pp, long length);
1296
1297 TS_REQ *TS_REQ_dup(TS_REQ *a);
1298
1299 +#ifndef OPENSSL_NO_FP_API
1300 TS_REQ *d2i_TS_REQ_fp(FILE *fp, TS_REQ **a);
1301 int i2d_TS_REQ_fp(FILE *fp, TS_REQ *a);
1302 +#endif
1303 TS_REQ *d2i_TS_REQ_bio(BIO *fp, TS_REQ **a);
1304 int i2d_TS_REQ_bio(BIO *fp, TS_REQ *a);
1305
1306 @@ -294,10 +296,12 @@ TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a,
1307
1308 TS_MSG_IMPRINT *TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT *a);
1309
1310 +#ifndef OPENSSL_NO_FP_API
1311 TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT **a);
1312 int i2d_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT *a);
1313 -TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *fp, TS_MSG_IMPRINT **a);
1314 -int i2d_TS_MSG_IMPRINT_bio(BIO *fp, TS_MSG_IMPRINT *a);
1315 +#endif
1316 +TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT **a);
1317 +int i2d_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT *a);
1318
1319 TS_RESP *TS_RESP_new(void);
1320 void TS_RESP_free(TS_RESP *a);
1321 @@ -306,10 +310,12 @@ TS_RESP *d2i_TS_RESP(TS_RESP **a, const unsigned char **pp, long length);
1322 TS_TST_INFO *PKCS7_to_TS_TST_INFO(PKCS7 *token);
1323 TS_RESP *TS_RESP_dup(TS_RESP *a);
1324
1325 +#ifndef OPENSSL_NO_FP_API
1326 TS_RESP *d2i_TS_RESP_fp(FILE *fp, TS_RESP **a);
1327 int i2d_TS_RESP_fp(FILE *fp, TS_RESP *a);
1328 -TS_RESP *d2i_TS_RESP_bio(BIO *fp, TS_RESP **a);
1329 -int i2d_TS_RESP_bio(BIO *fp, TS_RESP *a);
1330 +#endif
1331 +TS_RESP *d2i_TS_RESP_bio(BIO *bio, TS_RESP **a);
1332 +int i2d_TS_RESP_bio(BIO *bio, TS_RESP *a);
1333
1334 TS_STATUS_INFO *TS_STATUS_INFO_new(void);
1335 void TS_STATUS_INFO_free(TS_STATUS_INFO *a);
1336 @@ -325,10 +331,12 @@ TS_TST_INFO *d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **pp,
1337 long length);
1338 TS_TST_INFO *TS_TST_INFO_dup(TS_TST_INFO *a);
1339
1340 +#ifndef OPENSSL_NO_FP_API
1341 TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a);
1342 int i2d_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO *a);
1343 -TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *fp, TS_TST_INFO **a);
1344 -int i2d_TS_TST_INFO_bio(BIO *fp, TS_TST_INFO *a);
1345 +#endif
1346 +TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO **a);
1347 +int i2d_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO *a);
1348
1349 TS_ACCURACY *TS_ACCURACY_new(void);
1350 void TS_ACCURACY_free(TS_ACCURACY *a);
1351 @@ -728,15 +736,18 @@ int TS_MSG_IMPRINT_print_bio(BIO *bio, TS_MSG_IMPRINT *msg);
1352 * ts/ts_conf.c
1353 */
1354
1355 +#ifndef OPENSSL_NO_STDIO
1356 X509 *TS_CONF_load_cert(const char *file);
1357 STACK_OF(X509) *TS_CONF_load_certs(const char *file);
1358 EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass);
1359 +#endif
1360 const char *TS_CONF_get_tsa_section(CONF *conf, const char *section);
1361 int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb,
1362 TS_RESP_CTX *ctx);
1363 int TS_CONF_set_crypto_device(CONF *conf, const char *section,
1364 const char *device);
1365 int TS_CONF_set_default_engine(const char *name);
1366 +#ifndef OPENSSL_NO_STDIO
1367 int TS_CONF_set_signer_cert(CONF *conf, const char *section,
1368 const char *cert, TS_RESP_CTX *ctx);
1369 int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs,
1370 @@ -744,6 +755,7 @@ int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs,
1371 int TS_CONF_set_signer_key(CONF *conf, const char *section,
1372 const char *key, const char *pass,
1373 TS_RESP_CTX *ctx);
1374 +#endif
1375 int TS_CONF_set_def_policy(CONF *conf, const char *section,
1376 const char *policy, TS_RESP_CTX *ctx);
1377 int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx);
1378 @@ -784,6 +796,11 @@ void ERR_load_TS_strings(void);
1379 # define TS_F_TS_CHECK_SIGNING_CERTS 103
1380 # define TS_F_TS_CHECK_STATUS_INFO 104
1381 # define TS_F_TS_COMPUTE_IMPRINT 145
1382 +# define TS_F_TS_CONF_INVALID 151
1383 +# define TS_F_TS_CONF_LOAD_CERT 153
1384 +# define TS_F_TS_CONF_LOAD_CERTS 154
1385 +# define TS_F_TS_CONF_LOAD_KEY 155
1386 +# define TS_F_TS_CONF_LOOKUP_FAIL 152
1387 # define TS_F_TS_CONF_SET_DEFAULT_ENGINE 146
1388 # define TS_F_TS_GET_STATUS_TEXT 105
1389 # define TS_F_TS_MSG_IMPRINT_SET_ALGO 118
1390 @@ -822,6 +839,8 @@ void ERR_load_TS_strings(void);
1391 /* Reason codes. */
1392 # define TS_R_BAD_PKCS7_TYPE 132
1393 # define TS_R_BAD_TYPE 133
1394 +# define TS_R_CANNOT_LOAD_CERT 137
1395 +# define TS_R_CANNOT_LOAD_KEY 138
1396 # define TS_R_CERTIFICATE_VERIFY_ERROR 100
1397 # define TS_R_COULD_NOT_SET_ENGINE 127
1398 # define TS_R_COULD_NOT_SET_TIME 115
1399 @@ -854,6 +873,8 @@ void ERR_load_TS_strings(void);
1400 # define TS_R_UNACCEPTABLE_POLICY 125
1401 # define TS_R_UNSUPPORTED_MD_ALGORITHM 126
1402 # define TS_R_UNSUPPORTED_VERSION 113
1403 +# define TS_R_VAR_BAD_VALUE 135
1404 +# define TS_R_VAR_LOOKUP_FAILURE 136
1405 # define TS_R_WRONG_CONTENT_TYPE 114
1406
1407 #ifdef __cplusplus
1408 diff --git a/crypto/ts/ts_conf.c b/crypto/ts/ts_conf.c
1409 index 4716b23..c4416ba 100644
1410 --- a/crypto/ts/ts_conf.c
1411 +++ b/crypto/ts/ts_conf.c
1412 @@ -92,6 +92,7 @@
1413
1414 /* Function definitions for certificate and key loading. */
1415
1416 +#ifndef OPENSSL_NO_STDIO
1417 X509 *TS_CONF_load_cert(const char *file)
1418 {
1419 BIO *cert = NULL;
1420 @@ -102,7 +103,7 @@ X509 *TS_CONF_load_cert(const char *file)
1421 x = PEM_read_bio_X509_AUX(cert, NULL, NULL, NULL);
1422 end:
1423 if (x == NULL)
1424 - fprintf(stderr, "unable to load certificate: %s\n", file);
1425 + TSerr(TS_F_TS_CONF_LOAD_CERT, TS_R_CANNOT_LOAD_CERT);
1426 BIO_free(cert);
1427 return x;
1428 }
1429 @@ -129,7 +130,7 @@ STACK_OF(X509) *TS_CONF_load_certs(const char *file)
1430 }
1431 end:
1432 if (othercerts == NULL)
1433 - fprintf(stderr, "unable to load certificates: %s\n", file);
1434 + TSerr(TS_F_TS_CONF_LOAD_CERTS, TS_R_CANNOT_LOAD_CERT);
1435 sk_X509_INFO_pop_free(allcerts, X509_INFO_free);
1436 BIO_free(certs);
1437 return othercerts;
1438 @@ -145,21 +146,24 @@ EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass)
1439 pkey = PEM_read_bio_PrivateKey(key, NULL, NULL, (char *)pass);
1440 end:
1441 if (pkey == NULL)
1442 - fprintf(stderr, "unable to load private key: %s\n", file);
1443 + TSerr(TS_F_TS_CONF_LOAD_KEY, TS_R_CANNOT_LOAD_KEY);
1444 BIO_free(key);
1445 return pkey;
1446 }
1447 +#endif /* !OPENSSL_NO_STDIO */
1448
1449 /* Function definitions for handling configuration options. */
1450
1451 static void TS_CONF_lookup_fail(const char *name, const char *tag)
1452 {
1453 - fprintf(stderr, "variable lookup failed for %s::%s\n", name, tag);
1454 + TSerr(TS_F_TS_CONF_LOOKUP_FAIL, TS_R_VAR_LOOKUP_FAILURE);
1455 + ERR_add_error_data(3, name, "::", tag);
1456 }
1457
1458 static void TS_CONF_invalid(const char *name, const char *tag)
1459 {
1460 - fprintf(stderr, "invalid variable value for %s::%s\n", name, tag);
1461 + TSerr(TS_F_TS_CONF_INVALID, TS_R_VAR_BAD_VALUE);
1462 + ERR_add_error_data(3, name, "::", tag);
1463 }
1464
1465 const char *TS_CONF_get_tsa_section(CONF *conf, const char *section)
1466 @@ -237,6 +241,7 @@ int TS_CONF_set_default_engine(const char *name)
1467
1468 #endif
1469
1470 +#ifndef OPENSSL_NO_STDIO
1471 int TS_CONF_set_signer_cert(CONF *conf, const char *section,
1472 const char *cert, TS_RESP_CTX *ctx)
1473 {
1474 @@ -302,6 +307,7 @@ int TS_CONF_set_signer_key(CONF *conf, const char *section,
1475 EVP_PKEY_free(key_obj);
1476 return ret;
1477 }
1478 +#endif /* !OPENSSL_NO_STDIO */
1479
1480 int TS_CONF_set_def_policy(CONF *conf, const char *section,
1481 const char *policy, TS_RESP_CTX *ctx)
1482 diff --git a/crypto/ts/ts_err.c b/crypto/ts/ts_err.c
1483 index ff1abf4..3f5b78f 100644
1484 --- a/crypto/ts/ts_err.c
1485 +++ b/crypto/ts/ts_err.c
1486 @@ -1,6 +1,6 @@
1487 /* crypto/ts/ts_err.c */
1488 /* ====================================================================
1489 - * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
1490 + * Copyright (c) 1999-2015 The OpenSSL Project. All rights reserved.
1491 *
1492 * Redistribution and use in source and binary forms, with or without
1493 * modification, are permitted provided that the following conditions
1494 @@ -87,6 +87,11 @@ static ERR_STRING_DATA TS_str_functs[] = {
1495 {ERR_FUNC(TS_F_TS_CHECK_SIGNING_CERTS), "TS_CHECK_SIGNING_CERTS"},
1496 {ERR_FUNC(TS_F_TS_CHECK_STATUS_INFO), "TS_CHECK_STATUS_INFO"},
1497 {ERR_FUNC(TS_F_TS_COMPUTE_IMPRINT), "TS_COMPUTE_IMPRINT"},
1498 + {ERR_FUNC(TS_F_TS_CONF_INVALID), "ts_CONF_invalid"},
1499 + {ERR_FUNC(TS_F_TS_CONF_LOAD_CERT), "TS_CONF_load_cert"},
1500 + {ERR_FUNC(TS_F_TS_CONF_LOAD_CERTS), "TS_CONF_load_certs"},
1501 + {ERR_FUNC(TS_F_TS_CONF_LOAD_KEY), "TS_CONF_load_key"},
1502 + {ERR_FUNC(TS_F_TS_CONF_LOOKUP_FAIL), "ts_CONF_lookup_fail"},
1503 {ERR_FUNC(TS_F_TS_CONF_SET_DEFAULT_ENGINE), "TS_CONF_set_default_engine"},
1504 {ERR_FUNC(TS_F_TS_GET_STATUS_TEXT), "TS_GET_STATUS_TEXT"},
1505 {ERR_FUNC(TS_F_TS_MSG_IMPRINT_SET_ALGO), "TS_MSG_IMPRINT_set_algo"},
1506 @@ -132,6 +137,8 @@ static ERR_STRING_DATA TS_str_functs[] = {
1507 static ERR_STRING_DATA TS_str_reasons[] = {
1508 {ERR_REASON(TS_R_BAD_PKCS7_TYPE), "bad pkcs7 type"},
1509 {ERR_REASON(TS_R_BAD_TYPE), "bad type"},
1510 + {ERR_REASON(TS_R_CANNOT_LOAD_CERT), "cannot load certificate"},
1511 + {ERR_REASON(TS_R_CANNOT_LOAD_KEY), "cannot load private key"},
1512 {ERR_REASON(TS_R_CERTIFICATE_VERIFY_ERROR), "certificate verify error"},
1513 {ERR_REASON(TS_R_COULD_NOT_SET_ENGINE), "could not set engine"},
1514 {ERR_REASON(TS_R_COULD_NOT_SET_TIME), "could not set time"},
1515 @@ -170,6 +177,8 @@ static ERR_STRING_DATA TS_str_reasons[] = {
1516 {ERR_REASON(TS_R_UNACCEPTABLE_POLICY), "unacceptable policy"},
1517 {ERR_REASON(TS_R_UNSUPPORTED_MD_ALGORITHM), "unsupported md algorithm"},
1518 {ERR_REASON(TS_R_UNSUPPORTED_VERSION), "unsupported version"},
1519 + {ERR_REASON(TS_R_VAR_BAD_VALUE), "var bad value"},
1520 + {ERR_REASON(TS_R_VAR_LOOKUP_FAILURE), "cannot find config variable"},
1521 {ERR_REASON(TS_R_WRONG_CONTENT_TYPE), "wrong content type"},
1522 {0, NULL}
1523 };
1524 diff --git a/crypto/ui/ui_util.c b/crypto/ui/ui_util.c
1525 index 0f29011..80dd40e 100644
1526 --- a/crypto/ui/ui_util.c
1527 +++ b/crypto/ui/ui_util.c
1528 @@ -56,6 +56,10 @@
1529 #include <string.h>
1530 #include "ui_locl.h"
1531
1532 +#ifndef BUFSIZ
1533 +#define BUFSIZ 256
1534 +#endif
1535 +
1536 int UI_UTIL_read_pw_string(char *buf, int length, const char *prompt,
1537 int verify)
1538 {
1539 diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c
1540 index 9ee8f8d..64b052e 100644
1541 --- a/crypto/x509/by_dir.c
1542 +++ b/crypto/x509/by_dir.c
1543 @@ -69,6 +69,8 @@
1544 # include <sys/stat.h>
1545 #endif
1546
1547 +#ifndef OPENSSL_NO_STDIO
1548 +
1549 #include <openssl/lhash.h>
1550 #include <openssl/x509.h>
1551
1552 @@ -434,3 +436,5 @@ static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name,
1553 BUF_MEM_free(b);
1554 return (ok);
1555 }
1556 +
1557 +#endif /* OPENSSL_NO_STDIO */
1558 diff --git a/crypto/x509/x509_vfy.c b/crypto/x509/x509_vfy.c
1559 index 4d34dba..25e8a89 100644
1560 --- a/crypto/x509/x509_vfy.c
1561 +++ b/crypto/x509/x509_vfy.c
1562 @@ -950,6 +950,8 @@ static int check_crl_time(X509_STORE_CTX *ctx, X509_CRL *crl, int notify)
1563 ctx->current_crl = crl;
1564 if (ctx->param->flags & X509_V_FLAG_USE_CHECK_TIME)
1565 ptime = &ctx->param->check_time;
1566 + else if (ctx->param->flags & X509_V_FLAG_NO_CHECK_TIME)
1567 + return 1;
1568 else
1569 ptime = NULL;
1570
1571 @@ -1673,6 +1675,8 @@ static int check_cert_time(X509_STORE_CTX *ctx, X509 *x)
1572
1573 if (ctx->param->flags & X509_V_FLAG_USE_CHECK_TIME)
1574 ptime = &ctx->param->check_time;
1575 + else if (ctx->param->flags & X509_V_FLAG_NO_CHECK_TIME)
1576 + return 1;
1577 else
1578 ptime = NULL;
1579
1580 diff --git a/crypto/x509/x509_vfy.h b/crypto/x509/x509_vfy.h
1581 index 2663e1c..3790ef5 100644
1582 --- a/crypto/x509/x509_vfy.h
1583 +++ b/crypto/x509/x509_vfy.h
1584 @@ -438,6 +438,8 @@ void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth);
1585 * will force the behaviour to match that of previous versions.
1586 */
1587 # define X509_V_FLAG_NO_ALT_CHAINS 0x100000
1588 +/* Do not check certificate/CRL validity against current time */
1589 +# define X509_V_FLAG_NO_CHECK_TIME 0x200000
1590
1591 # define X509_VP_FLAG_DEFAULT 0x1
1592 # define X509_VP_FLAG_OVERWRITE 0x2
1593 @@ -490,9 +492,10 @@ void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx);
1594 X509_STORE *X509_STORE_CTX_get0_store(X509_STORE_CTX *ctx);
1595
1596 X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m);
1597 -
1598 +#ifndef OPENSSL_NO_STDIO
1599 X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void);
1600 X509_LOOKUP_METHOD *X509_LOOKUP_file(void);
1601 +#endif
1602
1603 int X509_STORE_add_cert(X509_STORE *ctx, X509 *x);
1604 int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x);
1605 diff --git a/crypto/x509v3/ext_dat.h b/crypto/x509v3/ext_dat.h
1606 index c3a6fce..09ebbca 100644
1607 --- a/crypto/x509v3/ext_dat.h
1608 +++ b/crypto/x509v3/ext_dat.h
1609 @@ -127,8 +127,10 @@ static const X509V3_EXT_METHOD *standard_exts[] = {
1610 &v3_idp,
1611 &v3_alt[2],
1612 &v3_freshest_crl,
1613 +#ifndef OPENSSL_NO_SCT
1614 &v3_ct_scts[0],
1615 &v3_ct_scts[1],
1616 +#endif
1617 };
1618
1619 /* Number of standard extensions */
1620 diff --git a/crypto/x509v3/v3_pci.c b/crypto/x509v3/v3_pci.c
1621 index 34cad53..12f12a7 100644
1622 --- a/crypto/x509v3/v3_pci.c
1623 +++ b/crypto/x509v3/v3_pci.c
1624 @@ -149,6 +149,7 @@ static int process_pci_value(CONF_VALUE *val,
1625 goto err;
1626 }
1627 OPENSSL_free(tmp_data2);
1628 +#ifndef OPENSSL_NO_STDIO
1629 } else if (strncmp(val->value, "file:", 5) == 0) {
1630 unsigned char buf[2048];
1631 int n;
1632 @@ -181,6 +182,7 @@ static int process_pci_value(CONF_VALUE *val,
1633 X509V3_conf_err(val);
1634 goto err;
1635 }
1636 +#endif /* !OPENSSL_NO_STDIO */
1637 } else if (strncmp(val->value, "text:", 5) == 0) {
1638 val_len = strlen(val->value + 5);
1639 tmp_data = OPENSSL_realloc((*policy)->data,
1640 diff --git a/crypto/x509v3/v3_scts.c b/crypto/x509v3/v3_scts.c
1641 index 0b7c681..1895b8f 100644
1642 --- a/crypto/x509v3/v3_scts.c
1643 +++ b/crypto/x509v3/v3_scts.c
1644 @@ -61,6 +61,7 @@
1645 #include <openssl/asn1.h>
1646 #include <openssl/x509v3.h>
1647
1648 +#ifndef OPENSSL_NO_SCT
1649 /* Signature and hash algorithms from RFC 5246 */
1650 #define TLSEXT_hash_sha256 4
1651
1652 @@ -332,3 +333,4 @@ static int i2r_SCT_LIST(X509V3_EXT_METHOD *method, STACK_OF(SCT) *sct_list,
1653
1654 return 1;
1655 }
1656 +#endif
1657 diff --git a/crypto/x509v3/x509v3.h b/crypto/x509v3/x509v3.h
1658 index f5c6156..a2e78aa 100644
1659 --- a/crypto/x509v3/x509v3.h
1660 +++ b/crypto/x509v3/x509v3.h
1661 @@ -688,8 +688,9 @@ void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent,
1662 int ml);
1663 int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag,
1664 int indent);
1665 +#ifndef OPENSSL_NO_FP_API
1666 int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent);
1667 -
1668 +#endif
1669 int X509V3_extensions_print(BIO *out, char *title,
1670 STACK_OF(X509_EXTENSION) *exts,
1671 unsigned long flag, int indent);
1672 diff --git a/demos/engines/cluster_labs/hw_cluster_labs_err.h b/demos/engines/cluster_labs/hw_cluster_labs_err.h
1673 index 3300e11..e9e58d5 100644
1674 --- a/demos/engines/cluster_labs/hw_cluster_labs_err.h
1675 +++ b/demos/engines/cluster_labs/hw_cluster_labs_err.h
1676 @@ -67,7 +67,7 @@ extern "C" {
1677 static void ERR_load_CL_strings(void);
1678 static void ERR_unload_CL_strings(void);
1679 static void ERR_CL_error(int function, int reason, char *file, int line);
1680 -# define CLerr(f,r) ERR_CL_error((f),(r),__FILE__,__LINE__)
1681 +# define CLerr(f,r) ERR_CL_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1682
1683 /* Error codes for the CL functions. */
1684
1685 diff --git a/demos/engines/ibmca/hw_ibmca_err.h b/demos/engines/ibmca/hw_ibmca_err.h
1686 index c17e0c9..10d0212 100644
1687 --- a/demos/engines/ibmca/hw_ibmca_err.h
1688 +++ b/demos/engines/ibmca/hw_ibmca_err.h
1689 @@ -67,7 +67,7 @@ extern "C" {
1690 static void ERR_load_IBMCA_strings(void);
1691 static void ERR_unload_IBMCA_strings(void);
1692 static void ERR_IBMCA_error(int function, int reason, char *file, int line);
1693 -# define IBMCAerr(f,r) ERR_IBMCA_error((f),(r),__FILE__,__LINE__)
1694 +# define IBMCAerr(f,r) ERR_IBMCA_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1695
1696 /* Error codes for the IBMCA functions. */
1697
1698 diff --git a/demos/engines/rsaref/rsaref_err.h b/demos/engines/rsaref/rsaref_err.h
1699 index 4356815..598836f 100644
1700 --- a/demos/engines/rsaref/rsaref_err.h
1701 +++ b/demos/engines/rsaref/rsaref_err.h
1702 @@ -68,7 +68,7 @@ extern "C" {
1703 static void ERR_load_RSAREF_strings(void);
1704 static void ERR_unload_RSAREF_strings(void);
1705 static void ERR_RSAREF_error(int function, int reason, char *file, int line);
1706 -# define RSAREFerr(f,r) ERR_RSAREF_error((f),(r),__FILE__,__LINE__)
1707 +# define RSAREFerr(f,r) ERR_RSAREF_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1708 /* Error codes for the RSAREF functions. */
1709
1710 /* Function codes. */
1711 diff --git a/demos/engines/zencod/hw_zencod_err.h b/demos/engines/zencod/hw_zencod_err.h
1712 index f4a8358..94d3293 100644
1713 --- a/demos/engines/zencod/hw_zencod_err.h
1714 +++ b/demos/engines/zencod/hw_zencod_err.h
1715 @@ -67,7 +67,7 @@ extern "C" {
1716 static void ERR_load_ZENCOD_strings(void);
1717 static void ERR_unload_ZENCOD_strings(void);
1718 static void ERR_ZENCOD_error(int function, int reason, char *file, int line);
1719 -# define ZENCODerr(f,r) ERR_ZENCOD_error((f),(r),__FILE__,__LINE__)
1720 +# define ZENCODerr(f,r) ERR_ZENCOD_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1721
1722 /* Error codes for the ZENCOD functions. */
1723
1724 diff --git a/doc/crypto/X509_VERIFY_PARAM_set_flags.pod b/doc/crypto/X509_VERIFY_PARAM_set_flags.pod
1725 index 44792f9..7f95d58 100644
1726 --- a/doc/crypto/X509_VERIFY_PARAM_set_flags.pod
1727 +++ b/doc/crypto/X509_VERIFY_PARAM_set_flags.pod
1728 @@ -203,6 +203,10 @@ chain found is not trusted, then OpenSSL will continue to check to see if an
1729 alternative chain can be found that is trusted. With this flag set the behaviour
1730 will match that of OpenSSL versions prior to 1.0.2b.
1731
1732 +The B<X509_V_FLAG_NO_CHECK_TIME> flag suppresses checking the validity period
1733 +of certificates and CRLs against the current time. If X509_VERIFY_PARAM_set_time()
1734 +is used to specify a verification time, the check is not suppressed.
1735 +
1736 =head1 NOTES
1737
1738 The above functions should be used to manipulate verification parameters
1739 diff --git a/doc/crypto/threads.pod b/doc/crypto/threads.pod
1740 index dc0e939..fe123bb 100644
1741 --- a/doc/crypto/threads.pod
1742 +++ b/doc/crypto/threads.pod
1743 @@ -51,15 +51,15 @@ CRYPTO_destroy_dynlockid, CRYPTO_lock - OpenSSL thread support
1744 void CRYPTO_lock(int mode, int n, const char *file, int line);
1745
1746 #define CRYPTO_w_lock(type) \
1747 - CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
1748 + CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,OPENSSL_FILE,OPENSSL_LINE)
1749 #define CRYPTO_w_unlock(type) \
1750 - CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
1751 + CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,OPENSSL_FILE,OPENSSL_LINE)
1752 #define CRYPTO_r_lock(type) \
1753 - CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__)
1754 + CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,OPENSSL_FILE,OPENSSL_LINE)
1755 #define CRYPTO_r_unlock(type) \
1756 - CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__)
1757 + CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,OPENSSL_FILE,OPENSSL_LINE)
1758 #define CRYPTO_add(addr,amount,type) \
1759 - CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__)
1760 + CRYPTO_add_lock(addr,amount,type,OPENSSL_FILE,OPENSSL_LINE)
1761
1762 =head1 DESCRIPTION
1763
1764 diff --git a/e_os.h b/e_os.h
1765 index 1fa36c1..3e9dae2 100644
1766 --- a/e_os.h
1767 +++ b/e_os.h
1768 @@ -136,7 +136,7 @@ extern "C" {
1769 # define MSDOS
1770 # endif
1771
1772 -# if defined(MSDOS) && !defined(GETPID_IS_MEANINGLESS)
1773 +# if (defined(MSDOS) || defined(OPENSSL_SYS_UEFI)) && !defined(GETPID_IS_MEANINGLESS)
1774 # define GETPID_IS_MEANINGLESS
1775 # endif
1776
1777 diff --git a/e_os2.h b/e_os2.h
1778 index 7be9989..909e22f 100644
1779 --- a/e_os2.h
1780 +++ b/e_os2.h
1781 @@ -97,7 +97,14 @@ extern "C" {
1782 * For 32 bit environment, there seems to be the CygWin environment and then
1783 * all the others that try to do the same thing Microsoft does...
1784 */
1785 -# if defined(OPENSSL_SYSNAME_UWIN)
1786 +/*
1787 + * UEFI lives here because it might be built with a Microsoft toolchain and
1788 + * we need to avoid the false positive match on Windows.
1789 + */
1790 +# if defined(OPENSSL_SYSNAME_UEFI)
1791 +# undef OPENSSL_SYS_UNIX
1792 +# define OPENSSL_SYS_UEFI
1793 +# elif defined(OPENSSL_SYSNAME_UWIN)
1794 # undef OPENSSL_SYS_UNIX
1795 # define OPENSSL_SYS_WIN32_UWIN
1796 # else
1797 diff --git a/engines/ccgost/e_gost_err.h b/engines/ccgost/e_gost_err.h
1798 index a2018ec..9eacdcf 100644
1799 --- a/engines/ccgost/e_gost_err.h
1800 +++ b/engines/ccgost/e_gost_err.h
1801 @@ -67,7 +67,7 @@ extern "C" {
1802 void ERR_load_GOST_strings(void);
1803 void ERR_unload_GOST_strings(void);
1804 void ERR_GOST_error(int function, int reason, char *file, int line);
1805 -# define GOSTerr(f,r) ERR_GOST_error((f),(r),__FILE__,__LINE__)
1806 +# define GOSTerr(f,r) ERR_GOST_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1807
1808 /* Error codes for the GOST functions. */
1809
1810 diff --git a/engines/e_4758cca_err.h b/engines/e_4758cca_err.h
1811 index 2f29d96..47a2635 100644
1812 --- a/engines/e_4758cca_err.h
1813 +++ b/engines/e_4758cca_err.h
1814 @@ -67,7 +67,7 @@ extern "C" {
1815 static void ERR_load_CCA4758_strings(void);
1816 static void ERR_unload_CCA4758_strings(void);
1817 static void ERR_CCA4758_error(int function, int reason, char *file, int line);
1818 -# define CCA4758err(f,r) ERR_CCA4758_error((f),(r),__FILE__,__LINE__)
1819 +# define CCA4758err(f,r) ERR_CCA4758_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1820
1821 /* Error codes for the CCA4758 functions. */
1822
1823 diff --git a/engines/e_aep_err.h b/engines/e_aep_err.h
1824 index 2ed0114..1f8fa5b 100644
1825 --- a/engines/e_aep_err.h
1826 +++ b/engines/e_aep_err.h
1827 @@ -67,7 +67,7 @@ extern "C" {
1828 static void ERR_load_AEPHK_strings(void);
1829 static void ERR_unload_AEPHK_strings(void);
1830 static void ERR_AEPHK_error(int function, int reason, char *file, int line);
1831 -# define AEPHKerr(f,r) ERR_AEPHK_error((f),(r),__FILE__,__LINE__)
1832 +# define AEPHKerr(f,r) ERR_AEPHK_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1833
1834 /* Error codes for the AEPHK functions. */
1835
1836 diff --git a/engines/e_atalla_err.h b/engines/e_atalla_err.h
1837 index 7b71eff..d958496 100644
1838 --- a/engines/e_atalla_err.h
1839 +++ b/engines/e_atalla_err.h
1840 @@ -67,7 +67,7 @@ extern "C" {
1841 static void ERR_load_ATALLA_strings(void);
1842 static void ERR_unload_ATALLA_strings(void);
1843 static void ERR_ATALLA_error(int function, int reason, char *file, int line);
1844 -# define ATALLAerr(f,r) ERR_ATALLA_error((f),(r),__FILE__,__LINE__)
1845 +# define ATALLAerr(f,r) ERR_ATALLA_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1846
1847 /* Error codes for the ATALLA functions. */
1848
1849 diff --git a/engines/e_capi_err.h b/engines/e_capi_err.h
1850 index b5d06dc..cfe46b1 100644
1851 --- a/engines/e_capi_err.h
1852 +++ b/engines/e_capi_err.h
1853 @@ -67,7 +67,7 @@ extern "C" {
1854 static void ERR_load_CAPI_strings(void);
1855 static void ERR_unload_CAPI_strings(void);
1856 static void ERR_CAPI_error(int function, int reason, char *file, int line);
1857 -# define CAPIerr(f,r) ERR_CAPI_error((f),(r),__FILE__,__LINE__)
1858 +# define CAPIerr(f,r) ERR_CAPI_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1859
1860 /* Error codes for the CAPI functions. */
1861
1862 diff --git a/engines/e_chil_err.h b/engines/e_chil_err.h
1863 index d86a4ce..3d961b9 100644
1864 --- a/engines/e_chil_err.h
1865 +++ b/engines/e_chil_err.h
1866 @@ -67,7 +67,7 @@ extern "C" {
1867 static void ERR_load_HWCRHK_strings(void);
1868 static void ERR_unload_HWCRHK_strings(void);
1869 static void ERR_HWCRHK_error(int function, int reason, char *file, int line);
1870 -# define HWCRHKerr(f,r) ERR_HWCRHK_error((f),(r),__FILE__,__LINE__)
1871 +# define HWCRHKerr(f,r) ERR_HWCRHK_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1872
1873 /* Error codes for the HWCRHK functions. */
1874
1875 diff --git a/engines/e_cswift_err.h b/engines/e_cswift_err.h
1876 index fde3a82..7c20691 100644
1877 --- a/engines/e_cswift_err.h
1878 +++ b/engines/e_cswift_err.h
1879 @@ -67,7 +67,7 @@ extern "C" {
1880 static void ERR_load_CSWIFT_strings(void);
1881 static void ERR_unload_CSWIFT_strings(void);
1882 static void ERR_CSWIFT_error(int function, int reason, char *file, int line);
1883 -# define CSWIFTerr(f,r) ERR_CSWIFT_error((f),(r),__FILE__,__LINE__)
1884 +# define CSWIFTerr(f,r) ERR_CSWIFT_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1885
1886 /* Error codes for the CSWIFT functions. */
1887
1888 diff --git a/engines/e_gmp_err.h b/engines/e_gmp_err.h
1889 index 637abbc..ccaf3da 100644
1890 --- a/engines/e_gmp_err.h
1891 +++ b/engines/e_gmp_err.h
1892 @@ -67,7 +67,7 @@ extern "C" {
1893 static void ERR_load_GMP_strings(void);
1894 static void ERR_unload_GMP_strings(void);
1895 static void ERR_GMP_error(int function, int reason, char *file, int line);
1896 -# define GMPerr(f,r) ERR_GMP_error((f),(r),__FILE__,__LINE__)
1897 +# define GMPerr(f,r) ERR_GMP_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1898
1899 /* Error codes for the GMP functions. */
1900
1901 diff --git a/engines/e_nuron_err.h b/engines/e_nuron_err.h
1902 index aa7849c..e607d3e 100644
1903 --- a/engines/e_nuron_err.h
1904 +++ b/engines/e_nuron_err.h
1905 @@ -67,7 +67,7 @@ extern "C" {
1906 static void ERR_load_NURON_strings(void);
1907 static void ERR_unload_NURON_strings(void);
1908 static void ERR_NURON_error(int function, int reason, char *file, int line);
1909 -# define NURONerr(f,r) ERR_NURON_error((f),(r),__FILE__,__LINE__)
1910 +# define NURONerr(f,r) ERR_NURON_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1911
1912 /* Error codes for the NURON functions. */
1913
1914 diff --git a/engines/e_sureware_err.h b/engines/e_sureware_err.h
1915 index bef8623..54f2848 100644
1916 --- a/engines/e_sureware_err.h
1917 +++ b/engines/e_sureware_err.h
1918 @@ -68,7 +68,7 @@ static void ERR_load_SUREWARE_strings(void);
1919 static void ERR_unload_SUREWARE_strings(void);
1920 static void ERR_SUREWARE_error(int function, int reason, char *file,
1921 int line);
1922 -# define SUREWAREerr(f,r) ERR_SUREWARE_error((f),(r),__FILE__,__LINE__)
1923 +# define SUREWAREerr(f,r) ERR_SUREWARE_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1924
1925 /* Error codes for the SUREWARE functions. */
1926
1927 diff --git a/engines/e_ubsec_err.h b/engines/e_ubsec_err.h
1928 index c8aec7c..67110ed 100644
1929 --- a/engines/e_ubsec_err.h
1930 +++ b/engines/e_ubsec_err.h
1931 @@ -67,7 +67,7 @@ extern "C" {
1932 static void ERR_load_UBSEC_strings(void);
1933 static void ERR_unload_UBSEC_strings(void);
1934 static void ERR_UBSEC_error(int function, int reason, char *file, int line);
1935 -# define UBSECerr(f,r) ERR_UBSEC_error((f),(r),__FILE__,__LINE__)
1936 +# define UBSECerr(f,r) ERR_UBSEC_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
1937
1938 /* Error codes for the UBSEC functions. */
1939
1940 diff --git a/makevms.com b/makevms.com
1941 index f6b3ff2..1dcbe36 100755
1942 --- a/makevms.com
1943 +++ b/makevms.com
1944 @@ -293,6 +293,7 @@ $ CONFIG_LOGICALS := AES,-
1945 RFC3779,-
1946 RIPEMD,-
1947 RSA,-
1948 + SCT,-
1949 SCTP,-
1950 SEED,-
1951 SHA,-
1952 diff --git a/ssl/d1_both.c b/ssl/d1_both.c
1953 index d1fc716..d5f661a 100644
1954 --- a/ssl/d1_both.c
1955 +++ b/ssl/d1_both.c
1956 @@ -1053,7 +1053,7 @@ int dtls1_send_change_cipher_spec(SSL *s, int a, int b)
1957 int dtls1_read_failed(SSL *s, int code)
1958 {
1959 if (code > 0) {
1960 - fprintf(stderr, "invalid state reached %s:%d", __FILE__, __LINE__);
1961 + fprintf(stderr, "dtls1_read_failed(); invalid state reached\n");
1962 return 1;
1963 }
1964
1965 diff --git a/ssl/ssl_asn1.c b/ssl/ssl_asn1.c
1966 index 35cc27c..a1f5335 100644
1967 --- a/ssl/ssl_asn1.c
1968 +++ b/ssl/ssl_asn1.c
1969 @@ -418,7 +418,7 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,
1970 if (ssl_version == SSL2_VERSION) {
1971 if (os.length != 3) {
1972 c.error = SSL_R_CIPHER_CODE_WRONG_LENGTH;
1973 - c.line = __LINE__;
1974 + c.line = OPENSSL_LINE;
1975 goto err;
1976 }
1977 id = 0x02000000L |
1978 @@ -429,14 +429,14 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,
1979 || ssl_version == DTLS1_BAD_VER) {
1980 if (os.length != 2) {
1981 c.error = SSL_R_CIPHER_CODE_WRONG_LENGTH;
1982 - c.line = __LINE__;
1983 + c.line = OPENSSL_LINE;
1984 goto err;
1985 }
1986 id = 0x03000000L |
1987 ((unsigned long)os.data[0] << 8L) | (unsigned long)os.data[1];
1988 } else {
1989 c.error = SSL_R_UNKNOWN_SSL_VERSION;
1990 - c.line = __LINE__;
1991 + c.line = OPENSSL_LINE;
1992 goto err;
1993 }
1994
1995 @@ -526,7 +526,7 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp,
1996 if (os.data != NULL) {
1997 if (os.length > SSL_MAX_SID_CTX_LENGTH) {
1998 c.error = SSL_R_BAD_LENGTH;
1999 - c.line = __LINE__;
2000 + c.line = OPENSSL_LINE;
2001 goto err;
2002 } else {
2003 ret->sid_ctx_length = os.length;
2004 diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c
2005 index a73f866..d534c0a 100644
2006 --- a/ssl/ssl_cert.c
2007 +++ b/ssl/ssl_cert.c
2008 @@ -855,12 +855,13 @@ int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x)
2009 return (add_client_CA(&(ctx->client_CA), x));
2010 }
2011
2012 +#ifndef OPENSSL_NO_STDIO
2013 +
2014 static int xname_cmp(const X509_NAME *const *a, const X509_NAME *const *b)
2015 {
2016 return (X509_NAME_cmp(*a, *b));
2017 }
2018
2019 -#ifndef OPENSSL_NO_STDIO
2020 /**
2021 * Load CA certs from a file into a ::STACK. Note that it is somewhat misnamed;
2022 * it doesn't really have anything to do with clients (except that a common use
2023 @@ -928,7 +929,6 @@ STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file)
2024 ERR_clear_error();
2025 return (ret);
2026 }
2027 -#endif
2028
2029 /**
2030 * Add a file of certs to a stack.
2031 @@ -1048,6 +1048,7 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
2032 CRYPTO_w_unlock(CRYPTO_LOCK_READDIR);
2033 return ret;
2034 }
2035 +#endif /* !OPENSSL_NO_STDIO */
2036
2037 /* Add a certificate to a BUF_MEM structure */
2038
2039 diff --git a/ssl/ssl_conf.c b/ssl/ssl_conf.c
2040 index 8d3709d..2bb403b 100644
2041 --- a/ssl/ssl_conf.c
2042 +++ b/ssl/ssl_conf.c
2043 @@ -370,6 +370,7 @@ static int cmd_Options(SSL_CONF_CTX *cctx, const char *value)
2044 return CONF_parse_list(value, ',', 1, ssl_set_option_list, cctx);
2045 }
2046
2047 +#ifndef OPENSSL_NO_STDIO
2048 static int cmd_Certificate(SSL_CONF_CTX *cctx, const char *value)
2049 {
2050 int rv = 1;
2051 @@ -436,7 +437,9 @@ static int cmd_DHParameters(SSL_CONF_CTX *cctx, const char *value)
2052 BIO_free(in);
2053 return rv > 0;
2054 }
2055 -#endif
2056 +#endif /* !OPENSSL_NO_DH */
2057 +#endif /* !OPENSSL_NO_STDIO */
2058 +
2059 typedef struct {
2060 int (*cmd) (SSL_CONF_CTX *cctx, const char *value);
2061 const char *str_file;
2062 @@ -462,12 +465,14 @@ static const ssl_conf_cmd_tbl ssl_conf_cmds[] = {
2063 SSL_CONF_CMD_STRING(CipherString, "cipher"),
2064 SSL_CONF_CMD_STRING(Protocol, NULL),
2065 SSL_CONF_CMD_STRING(Options, NULL),
2066 +#ifndef OPENSSL_NO_STDIO
2067 SSL_CONF_CMD(Certificate, "cert", SSL_CONF_TYPE_FILE),
2068 SSL_CONF_CMD(PrivateKey, "key", SSL_CONF_TYPE_FILE),
2069 SSL_CONF_CMD(ServerInfoFile, NULL, SSL_CONF_TYPE_FILE),
2070 #ifndef OPENSSL_NO_DH
2071 SSL_CONF_CMD(DHParameters, "dhparam", SSL_CONF_TYPE_FILE)
2072 #endif
2073 +#endif
2074 };
2075
2076 static int ssl_conf_cmd_skip_prefix(SSL_CONF_CTX *cctx, const char **pcmd)
2077 diff --git a/ssl/t1_enc.c b/ssl/t1_enc.c
2078 index 514fcb3..2a54cc9 100644
2079 --- a/ssl/t1_enc.c
2080 +++ b/ssl/t1_enc.c
2081 @@ -780,9 +780,7 @@ int tls1_enc(SSL *s, int send)
2082 * we can't write into the input stream: Can this ever
2083 * happen?? (steve)
2084 */
2085 - fprintf(stderr,
2086 - "%s:%d: rec->data != rec->input\n",
2087 - __FILE__, __LINE__);
2088 + fprintf(stderr, "tls1_enc: rec->data != rec->input\n");
2089 else if (RAND_bytes(rec->input, ivlen) <= 0)
2090 return -1;
2091 }
2092 diff --git a/test/cms-test.pl b/test/cms-test.pl
2093 index baa3b59..1ee3f02 100644
2094 --- a/test/cms-test.pl
2095 +++ b/test/cms-test.pl
2096 @@ -100,6 +100,13 @@ my $no_ec2m;
2097 my $no_ecdh;
2098 my $ossl8 = `$ossl_path version -v` =~ /0\.9\.8/;
2099
2100 +system ("$ossl_path no-cms > $null_path");
2101 +if ($? == 0)
2102 + {
2103 + print "CMS disabled\n";
2104 + exit 0;
2105 + }
2106 +
2107 system ("$ossl_path no-ec > $null_path");
2108 if ($? == 0)
2109 {
2110 diff --git a/util/libeay.num b/util/libeay.num
2111 index e5b3c6e..8d4185c 100755
2112 --- a/util/libeay.num
2113 +++ b/util/libeay.num
2114 @@ -4370,7 +4370,7 @@ DH_compute_key_padded 4732 EXIST::FUNCTION:DH
2115 ECDSA_METHOD_set_sign 4733 EXIST::FUNCTION:ECDSA
2116 CMS_RecipientEncryptedKey_cert_cmp 4734 EXIST:!VMS:FUNCTION:CMS
2117 CMS_RecipEncryptedKey_cert_cmp 4734 EXIST:VMS:FUNCTION:CMS
2118 -DH_KDF_X9_42 4735 EXIST::FUNCTION:DH
2119 +DH_KDF_X9_42 4735 EXIST::FUNCTION:CMS,DH
2120 RSA_OAEP_PARAMS_free 4736 EXIST::FUNCTION:RSA
2121 EVP_des_ede3_wrap 4737 EXIST::FUNCTION:DES
2122 RSA_OAEP_PARAMS_it 4738 EXIST:!EXPORT_VAR_AS_FUNCTION:VARIABLE:RSA
2123 diff --git a/util/mkdef.pl b/util/mkdef.pl
2124 index c57c7f7..d4c3386 100755
2125 --- a/util/mkdef.pl
2126 +++ b/util/mkdef.pl
2127 @@ -97,6 +97,8 @@ my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF",
2128 "FP_API", "STDIO", "SOCK", "KRB5", "DGRAM",
2129 # Engines
2130 "STATIC_ENGINE", "ENGINE", "HW", "GMP",
2131 + # X.509v3 Signed Certificate Timestamps
2132 + "SCT",
2133 # RFC3779
2134 "RFC3779",
2135 # TLS
2136 @@ -142,7 +144,7 @@ my $no_md2; my $no_md4; my $no_md5; my $no_sha; my $no_ripemd; my $no_mdc2;
2137 my $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=0; my $no_aes; my $no_krb5;
2138 my $no_ec; my $no_ecdsa; my $no_ecdh; my $no_engine; my $no_hw;
2139 my $no_fp_api; my $no_static_engine=1; my $no_gmp; my $no_deprecated;
2140 -my $no_rfc3779; my $no_psk; my $no_tlsext; my $no_cms; my $no_capieng;
2141 +my $no_sct; my $no_rfc3779; my $no_psk; my $no_tlsext; my $no_cms; my $no_capieng;
2142 my $no_jpake; my $no_srp; my $no_ssl2; my $no_ec2m; my $no_nistp_gcc;
2143 my $no_nextprotoneg; my $no_sctp; my $no_srtp; my $no_ssl_trace;
2144 my $no_unit_test; my $no_ssl3_method;
2145 @@ -233,6 +235,7 @@ foreach (@ARGV, split(/ /, $options))
2146 elsif (/^no-engine$/) { $no_engine=1; }
2147 elsif (/^no-hw$/) { $no_hw=1; }
2148 elsif (/^no-gmp$/) { $no_gmp=1; }
2149 + elsif (/^no-sct$/) { $no_sct=1; }
2150 elsif (/^no-rfc3779$/) { $no_rfc3779=1; }
2151 elsif (/^no-tlsext$/) { $no_tlsext=1; }
2152 elsif (/^no-cms$/) { $no_cms=1; }
2153 @@ -1206,6 +1209,7 @@ sub is_valid
2154 if ($keyword eq "FP_API" && $no_fp_api) { return 0; }
2155 if ($keyword eq "STATIC_ENGINE" && $no_static_engine) { return 0; }
2156 if ($keyword eq "GMP" && $no_gmp) { return 0; }
2157 + if ($keyword eq "SCT" && $no_sct) { return 0; }
2158 if ($keyword eq "RFC3779" && $no_rfc3779) { return 0; }
2159 if ($keyword eq "TLSEXT" && $no_tlsext) { return 0; }
2160 if ($keyword eq "PSK" && $no_psk) { return 0; }
2161 diff --git a/util/mkerr.pl b/util/mkerr.pl
2162 index 09ebebe..cd57ade 100644
2163 --- a/util/mkerr.pl
2164 +++ b/util/mkerr.pl
2165 @@ -89,7 +89,7 @@ Options:
2166 void ERR_load_<LIB>_strings(void);
2167 void ERR_unload_<LIB>_strings(void);
2168 void ERR_<LIB>_error(int f, int r, char *fn, int ln);
2169 - #define <LIB>err(f,r) ERR_<LIB>_error(f,r,__FILE__,__LINE__)
2170 + #define <LIB>err(f,r) ERR_<LIB>_error(f,r,OPENSSL_FILE,OPENSSL_LINE)
2171 while the code facilitates the use of these in an environment
2172 where the error support routines are dynamically loaded at
2173 runtime.
2174 @@ -474,7 +474,7 @@ EOF
2175 ${staticloader}void ERR_load_${lib}_strings(void);
2176 ${staticloader}void ERR_unload_${lib}_strings(void);
2177 ${staticloader}void ERR_${lib}_error(int function, int reason, char *file, int line);
2178 -# define ${lib}err(f,r) ERR_${lib}_error((f),(r),__FILE__,__LINE__)
2179 +# define ${lib}err(f,r) ERR_${lib}_error((f),(r),OPENSSL_FILE,OPENSSL_LINE)
2180
2181 EOF
2182 }