From: David Woodhouse <[email protected]> This updates to a version of the OpenSSL changes which is being submitted upstream for inclusion in HEAD (which will be OpenSSL 1.1.x) and hopefully also 1.0.2.
Generated from the OpenSSL_1_0_2-stable branch of git repository at http://git.infradead.org/users/dwmw2/openssl.git/ Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: David Woodhouse <[email protected]> --- .../Library/OpensslLib/EDKII_openssl-1.0.2d.patch | 2271 ++++++++++++++++++-- CryptoPkg/Library/OpensslLib/Patch-HOWTO.txt | 4 +- 2 files changed, 2073 insertions(+), 202 deletions(-) diff --git a/CryptoPkg/Library/OpensslLib/EDKII_openssl-1.0.2d.patch b/CryptoPkg/Library/OpensslLib/EDKII_openssl-1.0.2d.patch index 72065cc..59e3339 100644 --- a/CryptoPkg/Library/OpensslLib/EDKII_openssl-1.0.2d.patch +++ b/CryptoPkg/Library/OpensslLib/EDKII_openssl-1.0.2d.patch @@ -1,70 +1,1139 @@ -diff U3 crypto/bio/bio.h crypto/bio/bio.h ---- crypto/bio/bio.h Thu Jun 11 21:50:12 2015 -+++ crypto/bio/bio.h Fri Jun 12 11:00:52 2015 -@@ -646,10 +646,10 @@ - int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix, - asn1_ps_func **psuffix_free); - --# ifndef OPENSSL_NO_FP_API - BIO_METHOD *BIO_s_file(void); - BIO *BIO_new_file(const char *filename, const char *mode); - BIO *BIO_new_fp(FILE *stream, int close_flag); -+# ifndef OPENSSL_NO_FP_API - # define BIO_s_file_internal BIO_s_file +commit 46f1267cc700f8cc6f05905f0d21b70ac819869e +Author: David Woodhouse <[email protected]> +Date: Mon Jul 27 11:05:14 2015 +0100 + + RT3969: Add OPENSSL_SYS_UEFI + + This provides support for building in the EDK II reference implementation + of UEFI. Most UEFI firmware in existence uses OpenSSL for implementing + the core cryptographic functionality needed for Secure Boot. + + This has always previously been handled with external patches to OpenSSL + but we are now making a concerted effort to eliminate those. + + In this mode, we don't actually use the OpenSSL makefiles; we process + the MINFO file generated by 'make files' and incorporate it into the + EDK2 build system. + + Since EDK II builds for various targets with varying word size and we + need to have a single prepackaged configuration, we deliberately don't + hard-code the setting of SIXTY_FOUR_BIT vs. THIRTY_TWO_BIT in + opensslconf.h. We bypass that for OPENSSL_SYS_UEFI and allow EDK II + itself to set those, depending on the architecture. + + For x86_64, EDK II sets SIXTY_FOUR_BIT and thus uses 'long long' for the + 64-bit type, even when building with GCC where 'long' is also 64-bit. We + do this because the Microsoft toolchain has 32-bit 'long'. + + (cherry picked from commit 2186d4ad25d230880505808bf0d688ac8f7079ab) + +commit 5844b803ead2fd0661f221135cac49e5b996f920 +Author: David Woodhouse <[email protected]> +Date: Thu Aug 6 13:54:45 2015 +0100 + + RT3992: Allow RFC6962 Signed Certificate Timestamps to be disabled + + This code does open-coded division on 64-bit quantities and thus when + building with GCC on 32-bit platforms will require functions such as + __umoddi3 and __udivdi3 from libgcc. + + In constrained environments such as firmware, those functions may not + be available. So make it possible to compile out SCT support, which in + fact (in the case of UEFI) we don't need anyway. + + (cherry picked from commit 03ac2e3a1052c73e030884c2df501c0fe6715e8c) + +commit 9aaf92c14d168e93ffb8ba0e27189865d215a149 +Author: David Woodhouse <[email protected]> +Date: Fri Jul 31 08:49:50 2015 +0100 + + RT3951: Add X509_V_FLAG_NO_CHECK_TIME to suppress time check + + In some environments, such as firmware, the current system time is entirely + meaningless. Provide a clean mechanism to suppress the checks against it. + + (cherry picked from commit a4132a64d1d5759683f567e1f1bebc0e26bfe9d6) + +commit 6f5c5f28b32a552f61a9deb9384aefa660a3df54 +Author: David Bar <[email protected]> +Date: Wed Jul 22 12:04:05 2015 +0100 + + RT3674: Fix no-cms build failure + + This fixes multiple problems with CMS-related code, including the + RFC2631 DH key derivation which depends on CMS, not being correctly + protected by #ifndef OPENSSL_NO_CMS. + + (cherry picked from commit 7157c7a68963c98a1ed3bf6f44f93180e514068e) + +commit 578454c25a09071bf004a7704465919e0367527b +Author: David Woodhouse <[email protected]> +Date: Fri Jul 24 10:15:04 2015 +0100 + + RT3955: Reduce stack usage in PKCS7_verify() and PKCS7_decrypt() + + Some environments, such as 32-bit UEFI, have strict limits on stack size. + Using a 4KiB buffer on the stack for reading from the bio is somewhat + excessive, so reduce it to 256 bytes. This might incur a slight performance + penalty but it should be negligible. + + (cherry picked from commit 235cb35ae36f39a1a91197e7b43b6b8523b44ab3) + +commit d3207f75bcb19902b516e9770ebe30111eabe5a2 +Author: David Woodhouse <[email protected]> +Date: Thu Jul 30 11:45:25 2015 +0100 + + RT3628: Allow filenames to be eliminated from compiled library + + Although I explicitly don't care about the tinfoil-hat reason given in + the initial opening of RT#3628, that "paths usually contain private + information", there *are* situations where it's useful to eliminate the + filenames from the compiled binary. + + The two reasons we do care about in the context of firmware such as EDK2 + are that it allows for a smaller footprint, and it is also a necessary + component of a binary-reproducible build. + + To that end, introduce OPENSSL_FILE and OPENSSL_LINE macros, defining + them to __FILE__ and __LINE__ respectively in the normal case, but to + "" and 0 when OPENSSL_NO_FILENAMES is set. + + This is mostly a naïve invocation of + $ sed 's/__\([FL]I[NL]E\)__/OPENSSL_\1/g' -i `git grep -l __LINE__` + but with a few instances change to just print the function name instead + (although those probably need to die anyway) and test cases left untouched. + + (cherry picked from commit bb0174be1e4390c0c7ce08160721871402e710c4) + +commit d18ac0635aeefde3ba5d7e2ec941d644f9c96e9f +Author: Rich Salz <[email protected]> +Date: Thu Jun 4 10:14:28 2015 -0400 + + Set error code, no fprintf stderr, on errors. + + Reviewed-by: Richard Levitte <[email protected]> + (cherry picked from commit c0cf5b84dd32480965da7ff1e11d11a1ec9c4662) + +commit 53e78a8054d3296b3fe8ea69f391f8697943fde0 +Author: David Woodhouse <[email protected]> +Date: Wed Jul 29 12:10:14 2015 +0100 + + Include <stdio.h> for sscanf() even with no-stdio + + This isn't actually stdio or file access per se; it merely lives in + <stdio.h>. + + We rely on sscanf() to parse the OPENSSL_ia32cap environment variable, + since it can be larger than a 'long'. And we don't rely on the + availability of strtoull(). + + Fixing that without using sscanf() is... distinctly non-trivial. So I'm + prepared to live with claiming that it's acceptable to use sscanf() even + when OPENSSL_NO_STDIO is set. + + Anyone who disagrees can do so in 'diff -up' form. + + (cherry picked from commit 35aef953f7b5091ac3ea8235166decd44036124c) + +commit d49d946b3018d2195721715a8dd9fb6951690842 +Author: David Woodhouse <[email protected]> +Date: Wed Jul 29 12:07:03 2015 +0100 + + Make OPENSSL_showfatal do nothing with no-stdio + + Without stdio, there's nothing we can do. There is some merit in + allowing platforms to provide their own BIO for "stderr". Soee platforms + do have a debug console that they could hook that up to, while they + don't have true stdio or file access. But for now, just make it do + nothing if OPENSSL_NO_STDIO is set. + + (cherry picked from commit 66cfd3a4212d5c2c705337fc4aa62e26cb2633e3) + +commit f31c427ceda97b617595b3505ced81cc97b5df84 +Author: David Woodhouse <[email protected]> +Date: Wed Jul 29 11:53:57 2015 +0100 + + Kill OPENSSL_stderr() for no-stdio build + + It isn't used within OpenSSL. It's private now so it can't be used from + outside either. It's utterly pointless because it only ever returns + 'stderr' anyway. And it breaks the build with OPENSSL_NO_STDIO. + + Perhaps we should have OPENSSL_std{in,out,err} that return a BIO* instead, + and then we can output to those. In firmware environments where there's + no true stdio or FILE*, we *do* often have a way to print messages to the + console, and those BIOs could do the right thing. + + That might actually give us a way to fix OPENSSL_showfatal() (qv). + + (cherry picked from commit 3e339687f58b1aa1ee46eab2f7d80873c2709076) + (made conditional on OPENSSL_NO_STDIO to avoid removing it in stable branch) + +commit a7cef84ba7918b797209ae5d671119fbe27cfce3 +Author: David Woodhouse <[email protected]> +Date: Tue Jul 28 21:29:17 2015 +0100 + + Remove file-based functionality from ssl/ for no-stdio build + + The function prototypes were already gone, but not the functions themselves. + + (cherry picked from commit 6d75a908d93c0f415e2e4f85481353cdaaa075a8) + +commit 2c1894a35f819fd8344ad2571bb205e38baf6bf2 +Author: David Woodhouse <[email protected]> +Date: Tue Jul 28 21:26:23 2015 +0100 + + Remove unviable conf functionality from no-stdio build + + Rip out anything which requires file access. It couldn't have worked + anyway; let's be honest about its absence. + + (cherry picked from commit 0eeb1b8451426422a584b44afb16ecfc0fbcba83) + +commit c4524b244db79bf76de47382fd69c34170da9ccd +Author: David Woodhouse <[email protected]> +Date: Tue Jul 28 21:24:58 2015 +0100 + + Add fallback definition of BUFSIZ for no-stdio build + + This is in <stdio.h>, and might not be present from the system includes + if OPENSSL_NO_STDIO is set. Define it ourselves to a reasonable value + in that case, in the places where we're (ab)using it. + + (cherry picked from commit b64acbb3ec629f013b6084b3d76d878738e7b082) + +commit ac66b9b7e9bcee04414e1f538b26e92c327f18d8 +Author: David Woodhouse <[email protected]> +Date: Tue Jul 28 21:14:22 2015 +0100 + + Disable file: values in pci_process_value() for no-stdio build + + (cherry picked from commit 623c9adebd81057e9f6c98f2877b4cdf6cd912d7) + +commit 4e747ea55debdd404defd483c8906c26d8fd1b27 +Author: David Woodhouse <[email protected]> +Date: Tue Jul 28 21:12:42 2015 +0100 + + Disable file-based TS_CONF_* functions for no-stdio build + + If we can't access files, none of this is usable. + + (cherry picked from commit 7283ecf465a81cedb3abca0bdb849473874a36ed) + +commit 355251d9e9de06d5182be796582e6309480a8505 +Author: David Woodhouse <[email protected]> +Date: Tue Jul 28 20:56:28 2015 +0100 + + Remove functions taking FILE * from header files for no-fp-api + + If OPENSSL_NO_FP_API is set, we don't include <stdio.h> and the FILE + type does not exist. So a whole bunch of function prototypes (for + functions that don't exist anyway) end up not compiling. Make them + go away. + + While at it, fix up a few 'BIO *fp' in function prototypes which in + my first attempt got those functions #ifdef'd out too... + + (cherry picked from commit 9991b0b1b222dbb55273f5688e56e0a3068a8c09) + +commit 4307c31e63782c4fb9120983596ccf4d3e2c4a37 +Author: David Woodhouse <[email protected]> +Date: Tue Jul 28 17:23:11 2015 +0100 + + Add missing DECLARE_PEM_write_fp_const for no-fp-api + + This was missing when OPENSSL_NO_FP_API was set, causing build errors. + + (cherry picked from commit 2f31379c706d426fe730ff84f1626121c23964d0) + +commit 988c3ac22622cb88cb76acc6a93fc3afe2cdc662 +Author: David Woodhouse <[email protected]> +Date: Tue Jul 28 17:09:48 2015 +0100 + + Disable X509_LOOKUP_hash_dir() with no-stdio + + If OEPNSSL_NO_STDIO is set, we have no file access. So the hash directory + can't work. + + X509_LOOKUP_file() was already compiled out, but its prototype was + still present in x509_vfy.h. Fix that too. + + (cherry picked from commit 460fd0b2581ffabcb40675352973f78e0a28231b) + +commit 0e425f229184d831bb755cde79e73b08a83fc0d2 +Author: David Woodhouse <[email protected]> +Date: Tue Jul 28 16:42:20 2015 +0100 + + Eliminate SRP_VBASE_init() and supporting functions for no-stdio + + This requires file access, so can't be used when OPENSSL_NO_STDIO is set. + Users will need to build the verifier manually instead. + + (cherry picked from commit 353110bd949f401ba011a43885f2706c659ab1cd) + +commit 7780ea886c6c42cd88247658b0fcd666f19fa074 +Author: David Woodhouse <[email protected]> +Date: Tue Jul 28 16:41:04 2015 +0100 + + Eliminate compiler warning for unused do_pk8pkey_fp() with no-fp-api + + When OPENSSL_NO_FP_API is set, this function isn't used and triggers a + compiler warning. Eliminate that. + + (cherry picked from commit 938c6001474a4e21ab346db7805d91cc2db29a20) + +commit b77ba53ebbe81596347987707fa57a77054c0a3d +Author: David Woodhouse <[email protected]> +Date: Tue Jul 28 16:39:37 2015 +0100 + + Disable TEST_ENG_OPENSSL_PKEY with no-fp-api + + If OPENSSL_NO_FP_API is set, then we can't do any file access so we can't + have that openssl_load_privkey() test. Disable it. + + (cherry picked from commit 1a23205d05e7487317f48ccaf9ae1626fa0775a3) + +commit dbc28e0be662e4be18511e172f1c3e11bbf43f13 +Author: David Woodhouse <[email protected]> +Date: Tue Jul 28 16:36:13 2015 +0100 + + Disable GOST engine when no-stdio + + The GOST engine is littered with printf() and fprintf() calls. Disable + it when OPENSSL_NO_STDIO is set. + + (cherry picked from commit 45ac490c7fef51612f04926ea4e9f047ecdf22b7) + +commit f3c95f289d0ffef1e1780f9aac761a9dcd8c41f9 +Author: David Woodhouse <[email protected]> +Date: Tue Jul 28 16:31:32 2015 +0100 + + Eliminate compiler warning for unused send_fp_chars() with no-fp-api + + When OPENSSL_NO_FP_API is set, this function isn't used and triggers a + compiler warning. Eliminate that. + + (cherry picked from commit 6368efa7f6e179fc7dd0daf191af5755c78e2c2e) +diff --git a/Configure b/Configure +index d99eed7..9562183 100755 +--- a/Configure ++++ b/Configure +@@ -601,6 +601,9 @@ my %table=( + # with itself, Applink is never engaged and can as well be omitted. + "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", + ++# UEFI ++"UEFI", "cc:-DL_ENDIAN -O:::UEFI::::", ++ + # UWIN + "UWIN", "cc:-DTERMIOS -DL_ENDIAN -O -Wall:::UWIN::BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:${no_asm}:win32", + +@@ -1078,7 +1081,7 @@ if (defined($disabled{"tls1"})) + } + + if (defined($disabled{"ec"}) || defined($disabled{"dsa"}) +- || defined($disabled{"dh"})) ++ || defined($disabled{"dh"}) || defined($disabled{"stdio"})) + { + $disabled{"gost"} = "forced"; + } +diff --git a/apps/apps.c b/apps/apps.c +index 7478fc3..c95321e 100644 +--- a/apps/apps.c ++++ b/apps/apps.c +@@ -2373,6 +2373,8 @@ int args_verify(char ***pargs, int *pargc, + flags |= X509_V_FLAG_PARTIAL_CHAIN; + else if (!strcmp(arg, "-no_alt_chains")) + flags |= X509_V_FLAG_NO_ALT_CHAINS; ++ else if (!strcmp(arg, "-no_check_time")) ++ flags |= X509_V_FLAG_NO_CHECK_TIME; + else + return 0; + +diff --git a/crypto/asn1/a_strex.c b/crypto/asn1/a_strex.c +index 35fd44c..9f39bff 100644 +--- a/crypto/asn1/a_strex.c ++++ b/crypto/asn1/a_strex.c +@@ -104,6 +104,7 @@ static int send_bio_chars(void *arg, const void *buf, int len) + return 1; + } + ++#ifndef OPENSSL_NO_FP_API + static int send_fp_chars(void *arg, const void *buf, int len) + { + if (!arg) +@@ -112,6 +113,7 @@ static int send_fp_chars(void *arg, const void *buf, int len) + return 0; + return 1; + } ++#endif + + typedef int char_io (void *arg, const void *buf, int len); + +diff --git a/crypto/asn1/asn1_mac.h b/crypto/asn1/asn1_mac.h +index abc6dc3..3a672e9 100644 +--- a/crypto/asn1/asn1_mac.h ++++ b/crypto/asn1/asn1_mac.h +@@ -70,7 +70,7 @@ extern "C" { # endif - BIO *BIO_new(BIO_METHOD *type); -diff U3 crypto/bio/bss_file.c crypto/bio/bss_file.c ---- crypto/bio/bss_file.c Thu Jun 11 21:01:06 2015 -+++ crypto/bio/bss_file.c Fri Jun 12 11:01:28 2015 -@@ -460,6 +460,23 @@ - return (ret); + + # define ASN1_MAC_H_err(f,r,line) \ +- ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),__FILE__,(line)) ++ ERR_PUT_error(ASN1_MAC_ERR_LIB,(f),(r),OPENSSL_FILE,(line)) + + # define M_ASN1_D2I_vars(a,type,func) \ + ASN1_const_CTX c; \ +@@ -81,7 +81,7 @@ extern "C" { + c.error=ERR_R_NESTED_ASN1_ERROR; \ + if ((a == NULL) || ((*a) == NULL)) \ + { if ((ret=(type)func()) == NULL) \ +- { c.line=__LINE__; goto err; } } \ ++ { c.line=OPENSSL_LINE; goto err; } } \ + else ret=(*a); + + # define M_ASN1_D2I_Init() \ +@@ -90,7 +90,7 @@ extern "C" { + + # define M_ASN1_D2I_Finish_2(a) \ + if (!asn1_const_Finish(&c)) \ +- { c.line=__LINE__; goto err; } \ ++ { c.line=OPENSSL_LINE; goto err; } \ + *(const unsigned char **)pp=c.p; \ + if (a != NULL) (*a)=ret; \ + return(ret); +@@ -105,7 +105,7 @@ err:\ + + # define M_ASN1_D2I_start_sequence() \ + if (!asn1_GetSequence(&c,&length)) \ +- { c.line=__LINE__; goto err; } ++ { c.line=OPENSSL_LINE; goto err; } + /* Begin reading ASN1 without a surrounding sequence */ + # define M_ASN1_D2I_begin() \ + c.slen = length; +@@ -129,21 +129,21 @@ err:\ + # define M_ASN1_D2I_get(b, func) \ + c.q=c.p; \ + if (func(&(b),&c.p,c.slen) == NULL) \ +- {c.line=__LINE__; goto err; } \ ++ {c.line=OPENSSL_LINE; goto err; } \ + c.slen-=(c.p-c.q); + + /* Don't use this with d2i_ASN1_BOOLEAN() */ + # define M_ASN1_D2I_get_x(type,b,func) \ + c.q=c.p; \ + if (((D2I_OF(type))func)(&(b),&c.p,c.slen) == NULL) \ +- {c.line=__LINE__; goto err; } \ ++ {c.line=OPENSSL_LINE; goto err; } \ + c.slen-=(c.p-c.q); + + /* use this instead () */ + # define M_ASN1_D2I_get_int(b,func) \ + c.q=c.p; \ + if (func(&(b),&c.p,c.slen) < 0) \ +- {c.line=__LINE__; goto err; } \ ++ {c.line=OPENSSL_LINE; goto err; } \ + c.slen-=(c.p-c.q); + + # define M_ASN1_D2I_get_opt(b,func,type) \ +@@ -164,7 +164,7 @@ err:\ + M_ASN1_next=(_tmp& V_ASN1_CONSTRUCTED)|type; \ + c.q=c.p; \ + if (func(&(b),&c.p,c.slen) == NULL) \ +- {c.line=__LINE__; M_ASN1_next_prev = _tmp; goto err; } \ ++ {c.line=OPENSSL_LINE; M_ASN1_next_prev = _tmp; goto err; } \ + c.slen-=(c.p-c.q);\ + M_ASN1_next_prev=_tmp; + +@@ -258,20 +258,20 @@ err:\ + c.q=c.p; \ + if (d2i_ASN1_SET(&(r),&c.p,c.slen,(char *(*)())func,\ + (void (*)())free_func,a,b) == NULL) \ +- { c.line=__LINE__; goto err; } \ ++ { c.line=OPENSSL_LINE; goto err; } \ + c.slen-=(c.p-c.q); + + # define M_ASN1_D2I_get_imp_set_type(type,r,func,free_func,a,b) \ + c.q=c.p; \ + if (d2i_ASN1_SET_OF_##type(&(r),&c.p,c.slen,func,\ + free_func,a,b) == NULL) \ +- { c.line=__LINE__; goto err; } \ ++ { c.line=OPENSSL_LINE; goto err; } \ + c.slen-=(c.p-c.q); + + # define M_ASN1_D2I_get_set_strings(r,func,a,b) \ + c.q=c.p; \ + if (d2i_ASN1_STRING_SET(&(r),&c.p,c.slen,a,b) == NULL) \ +- { c.line=__LINE__; goto err; } \ ++ { c.line=OPENSSL_LINE; goto err; } \ + c.slen-=(c.p-c.q); + + # define M_ASN1_D2I_get_EXP_opt(r,func,tag) \ +@@ -285,16 +285,16 @@ err:\ + Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \ + if (Tinf & 0x80) \ + { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \ +- c.line=__LINE__; goto err; } \ ++ c.line=OPENSSL_LINE; goto err; } \ + if (Tinf == (V_ASN1_CONSTRUCTED+1)) \ + Tlen = c.slen - (c.p - c.q) - 2; \ + if (func(&(r),&c.p,Tlen) == NULL) \ +- { c.line=__LINE__; goto err; } \ ++ { c.line=OPENSSL_LINE; goto err; } \ + if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \ + Tlen = c.slen - (c.p - c.q); \ + if(!ASN1_const_check_infinite_end(&c.p, Tlen)) \ + { c.error=ERR_R_MISSING_ASN1_EOS; \ +- c.line=__LINE__; goto err; } \ ++ c.line=OPENSSL_LINE; goto err; } \ + }\ + c.slen-=(c.p-c.q); \ + } +@@ -310,18 +310,18 @@ err:\ + Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \ + if (Tinf & 0x80) \ + { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \ +- c.line=__LINE__; goto err; } \ ++ c.line=OPENSSL_LINE; goto err; } \ + if (Tinf == (V_ASN1_CONSTRUCTED+1)) \ + Tlen = c.slen - (c.p - c.q) - 2; \ + if (d2i_ASN1_SET(&(r),&c.p,Tlen,(char *(*)())func, \ + (void (*)())free_func, \ + b,V_ASN1_UNIVERSAL) == NULL) \ +- { c.line=__LINE__; goto err; } \ ++ { c.line=OPENSSL_LINE; goto err; } \ + if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \ + Tlen = c.slen - (c.p - c.q); \ + if(!ASN1_check_infinite_end(&c.p, Tlen)) \ + { c.error=ERR_R_MISSING_ASN1_EOS; \ +- c.line=__LINE__; goto err; } \ ++ c.line=OPENSSL_LINE; goto err; } \ + }\ + c.slen-=(c.p-c.q); \ + } +@@ -337,17 +337,17 @@ err:\ + Tinf=ASN1_get_object(&c.p,&Tlen,&Ttag,&Tclass,c.slen); \ + if (Tinf & 0x80) \ + { c.error=ERR_R_BAD_ASN1_OBJECT_HEADER; \ +- c.line=__LINE__; goto err; } \ ++ c.line=OPENSSL_LINE; goto err; } \ + if (Tinf == (V_ASN1_CONSTRUCTED+1)) \ + Tlen = c.slen - (c.p - c.q) - 2; \ + if (d2i_ASN1_SET_OF_##type(&(r),&c.p,Tlen,func, \ + free_func,b,V_ASN1_UNIVERSAL) == NULL) \ +- { c.line=__LINE__; goto err; } \ ++ { c.line=OPENSSL_LINE; goto err; } \ + if (Tinf == (V_ASN1_CONSTRUCTED+1)) { \ + Tlen = c.slen - (c.p - c.q); \ + if(!ASN1_check_infinite_end(&c.p, Tlen)) \ + { c.error=ERR_R_MISSING_ASN1_EOS; \ +- c.line=__LINE__; goto err; } \ ++ c.line=OPENSSL_LINE; goto err; } \ + }\ + c.slen-=(c.p-c.q); \ + } +@@ -355,7 +355,7 @@ err:\ + /* New macros */ + # define M_ASN1_New_Malloc(ret,type) \ + if ((ret=(type *)OPENSSL_malloc(sizeof(type))) == NULL) \ +- { c.line=__LINE__; goto err2; } ++ { c.line=OPENSSL_LINE; goto err2; } + + # define M_ASN1_New(arg,func) \ + if (((arg)=func()) == NULL) return(NULL) +diff --git a/crypto/conf/conf.h b/crypto/conf/conf.h +index 8d926d5..41cf38e 100644 +--- a/crypto/conf/conf.h ++++ b/crypto/conf/conf.h +@@ -118,8 +118,10 @@ typedef void conf_finish_func (CONF_IMODULE *md); + + int CONF_set_default_method(CONF_METHOD *meth); + void CONF_set_nconf(CONF *conf, LHASH_OF(CONF_VALUE) *hash); ++# ifndef OPENSSL_NO_STDIO + LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, + long *eline); ++# endif + # ifndef OPENSSL_NO_FP_API + LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, + long *eline); +@@ -133,7 +135,9 @@ char *CONF_get_string(LHASH_OF(CONF_VALUE) *conf, const char *group, + long CONF_get_number(LHASH_OF(CONF_VALUE) *conf, const char *group, + const char *name); + void CONF_free(LHASH_OF(CONF_VALUE) *conf); ++#ifndef OPENSSL_NO_FP_API + int CONF_dump_fp(LHASH_OF(CONF_VALUE) *conf, FILE *out); ++#endif + int CONF_dump_bio(LHASH_OF(CONF_VALUE) *conf, BIO *out); + + void OPENSSL_config(const char *config_name); +@@ -160,7 +164,9 @@ CONF_METHOD *NCONF_XML(void); + void NCONF_free(CONF *conf); + void NCONF_free_data(CONF *conf); + ++# ifndef OPENSSL_NO_STDIO + int NCONF_load(CONF *conf, const char *file, long *eline); ++# endif + # ifndef OPENSSL_NO_FP_API + int NCONF_load_fp(CONF *conf, FILE *fp, long *eline); + # endif +@@ -170,7 +176,9 @@ STACK_OF(CONF_VALUE) *NCONF_get_section(const CONF *conf, + char *NCONF_get_string(const CONF *conf, const char *group, const char *name); + int NCONF_get_number_e(const CONF *conf, const char *group, const char *name, + long *result); ++#ifndef OPENSSL_NO_FP_API + int NCONF_dump_fp(const CONF *conf, FILE *out); ++#endif + int NCONF_dump_bio(const CONF *conf, BIO *out); + + # if 0 /* The following function has no error +@@ -184,8 +192,10 @@ long NCONF_get_number(CONF *conf, char *group, char *name); + + int CONF_modules_load(const CONF *cnf, const char *appname, + unsigned long flags); ++#ifndef OPENSSL_NO_STDIO + int CONF_modules_load_file(const char *filename, const char *appname, + unsigned long flags); ++#endif + void CONF_modules_unload(int all); + void CONF_modules_finish(void); + void CONF_modules_free(void); +diff --git a/crypto/conf/conf_def.c b/crypto/conf/conf_def.c +index faca9ae..2eefdcf 100644 +--- a/crypto/conf/conf_def.c ++++ b/crypto/conf/conf_def.c +@@ -182,6 +182,10 @@ static int def_destroy_data(CONF *conf) + + static int def_load(CONF *conf, const char *name, long *line) + { ++#ifdef OPENSSL_NO_STDIO ++ CONFerr(CONF_F_DEF_LOAD, ERR_R_SYS_LIB); ++ return 0; ++#else + int ret; + BIO *in = NULL; + +@@ -202,6 +206,7 @@ static int def_load(CONF *conf, const char *name, long *line) + BIO_free(in); + + return ret; ++#endif } -+# else -+ -+BIO_METHOD *BIO_s_file(void) -+{ -+ return NULL; -+} + static int def_load_bio(CONF *conf, BIO *in, long *line) +diff --git a/crypto/conf/conf_lib.c b/crypto/conf/conf_lib.c +index 5281384..952b545 100644 +--- a/crypto/conf/conf_lib.c ++++ b/crypto/conf/conf_lib.c +@@ -90,6 +90,7 @@ int CONF_set_default_method(CONF_METHOD *meth) + return 1; + } + ++#ifndef OPENSSL_NO_STDIO + LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, + long *eline) + { +@@ -111,6 +112,7 @@ LHASH_OF(CONF_VALUE) *CONF_load(LHASH_OF(CONF_VALUE) *conf, const char *file, + + return ltmp; + } ++#endif + + #ifndef OPENSSL_NO_FP_API + LHASH_OF(CONF_VALUE) *CONF_load_fp(LHASH_OF(CONF_VALUE) *conf, FILE *fp, +@@ -255,6 +257,7 @@ void NCONF_free_data(CONF *conf) + conf->meth->destroy_data(conf); + } + ++#ifndef OPENSSL_NO_STDIO + int NCONF_load(CONF *conf, const char *file, long *eline) + { + if (conf == NULL) { +@@ -264,6 +267,7 @@ int NCONF_load(CONF *conf, const char *file, long *eline) + + return conf->meth->load(conf, file, eline); + } ++#endif + + #ifndef OPENSSL_NO_FP_API + int NCONF_load_fp(CONF *conf, FILE *fp, long *eline) +diff --git a/crypto/conf/conf_mod.c b/crypto/conf/conf_mod.c +index 9acfca4..5e0a482 100644 +--- a/crypto/conf/conf_mod.c ++++ b/crypto/conf/conf_mod.c +@@ -159,6 +159,7 @@ int CONF_modules_load(const CONF *cnf, const char *appname, + + } + ++#ifndef OPENSSL_NO_STDIO + int CONF_modules_load_file(const char *filename, const char *appname, + unsigned long flags) + { +@@ -194,6 +195,7 @@ int CONF_modules_load_file(const char *filename, const char *appname, + + return ret; + } ++#endif + + static int module_run(const CONF *cnf, char *name, char *value, + unsigned long flags) +diff --git a/crypto/conf/conf_sap.c b/crypto/conf/conf_sap.c +index 544fe97..f48536d 100644 +--- a/crypto/conf/conf_sap.c ++++ b/crypto/conf/conf_sap.c +@@ -87,9 +87,11 @@ void OPENSSL_config(const char *config_name) + ENGINE_load_builtin_engines(); + #endif + ERR_clear_error(); ++#ifndef OPENSSL_NO_STDIO + CONF_modules_load_file(NULL, config_name, + CONF_MFLAGS_DEFAULT_SECTION | + CONF_MFLAGS_IGNORE_MISSING_FILE); ++#endif + } + + void OPENSSL_no_config() +diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c +index ca0e3cc..a8ce495 100644 +--- a/crypto/cryptlib.c ++++ b/crypto/cryptlib.c +@@ -263,7 +263,7 @@ int CRYPTO_get_new_dynlockid(void) + return (0); + } + pointer->references = 1; +- pointer->data = dynlock_create_callback(__FILE__, __LINE__); ++ pointer->data = dynlock_create_callback(OPENSSL_FILE, OPENSSL_LINE); + if (pointer->data == NULL) { + OPENSSL_free(pointer); + CRYPTOerr(CRYPTO_F_CRYPTO_GET_NEW_DYNLOCKID, ERR_R_MALLOC_FAILURE); +@@ -289,7 +289,7 @@ int CRYPTO_get_new_dynlockid(void) + CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); + + if (i == -1) { +- dynlock_destroy_callback(pointer->data, __FILE__, __LINE__); ++ dynlock_destroy_callback(pointer->data, OPENSSL_FILE, OPENSSL_LINE); + OPENSSL_free(pointer); + } else + i += 1; /* to avoid 0 */ +@@ -328,7 +328,7 @@ void CRYPTO_destroy_dynlockid(int i) + CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK); + + if (pointer) { +- dynlock_destroy_callback(pointer->data, __FILE__, __LINE__); ++ dynlock_destroy_callback(pointer->data, OPENSSL_FILE, OPENSSL_LINE); + OPENSSL_free(pointer); + } + } +@@ -670,6 +670,7 @@ unsigned long *OPENSSL_ia32cap_loc(void) + } + + # if defined(OPENSSL_CPUID_OBJ) && !defined(OPENSSL_NO_ASM) && !defined(I386_ONLY) ++#include <stdio.h> + # define OPENSSL_CPUID_SETUP + # if defined(_WIN32) + typedef unsigned __int64 IA32CAP; +@@ -964,11 +965,13 @@ void OPENSSL_showfatal(const char *fmta, ...) + #else + void OPENSSL_showfatal(const char *fmta, ...) + { ++#ifndef OPENSSL_NO_STDIO + va_list ap; + + va_start(ap, fmta); + vfprintf(stderr, fmta, ap); + va_end(ap); ++#endif + } + + int OPENSSL_isservice(void) +@@ -995,10 +998,12 @@ void OpenSSLDie(const char *file, int line, const char *assertion) + #endif + } + ++#ifndef OPENSSL_NO_STDIO + void *OPENSSL_stderr(void) + { + return stderr; + } ++#endif + + int CRYPTO_memcmp(const void *in_a, const void *in_b, size_t len) + { +diff --git a/crypto/cryptlib.h b/crypto/cryptlib.h +index fba180a..3e3ea5e 100644 +--- a/crypto/cryptlib.h ++++ b/crypto/cryptlib.h +@@ -101,7 +101,9 @@ extern "C" { + void OPENSSL_cpuid_setup(void); + extern unsigned int OPENSSL_ia32cap_P[]; + void OPENSSL_showfatal(const char *fmta, ...); ++#ifndef OPENSSL_NO_STDIO + void *OPENSSL_stderr(void); ++#endif + extern int OPENSSL_NONPIC_relocated; + + #ifdef __cplusplus +diff --git a/crypto/crypto.h b/crypto/crypto.h +index c450d7a..063d78e 100644 +--- a/crypto/crypto.h ++++ b/crypto/crypto.h +@@ -235,15 +235,15 @@ typedef struct openssl_item_st { + # ifndef OPENSSL_NO_LOCKING + # ifndef CRYPTO_w_lock + # define CRYPTO_w_lock(type) \ +- CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__) ++ CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,OPENSSL_FILE,OPENSSL_LINE) + # define CRYPTO_w_unlock(type) \ +- CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__) ++ CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,OPENSSL_FILE,OPENSSL_LINE) + # define CRYPTO_r_lock(type) \ +- CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__) ++ CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,OPENSSL_FILE,OPENSSL_LINE) + # define CRYPTO_r_unlock(type) \ +- CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__) ++ CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,OPENSSL_FILE,OPENSSL_LINE) + # define CRYPTO_add(addr,amount,type) \ +- CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__) ++ CRYPTO_add_lock(addr,amount,type,OPENSSL_FILE,OPENSSL_LINE) + # endif + # else + # define CRYPTO_w_lock(a) +@@ -378,19 +378,19 @@ int CRYPTO_is_mem_check_on(void); + # define MemCheck_off() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE) + # define is_MemCheck_on() CRYPTO_is_mem_check_on() + +-# define OPENSSL_malloc(num) CRYPTO_malloc((int)num,__FILE__,__LINE__) +-# define OPENSSL_strdup(str) CRYPTO_strdup((str),__FILE__,__LINE__) ++# define OPENSSL_malloc(num) CRYPTO_malloc((int)num,OPENSSL_FILE,OPENSSL_LINE) ++# define OPENSSL_strdup(str) CRYPTO_strdup((str),OPENSSL_FILE,OPENSSL_LINE) + # define OPENSSL_realloc(addr,num) \ +- CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__) ++ CRYPTO_realloc((char *)addr,(int)num,OPENSSL_FILE,OPENSSL_LINE) + # define OPENSSL_realloc_clean(addr,old_num,num) \ +- CRYPTO_realloc_clean(addr,old_num,num,__FILE__,__LINE__) ++ CRYPTO_realloc_clean(addr,old_num,num,OPENSSL_FILE,OPENSSL_LINE) + # define OPENSSL_remalloc(addr,num) \ +- CRYPTO_remalloc((char **)addr,(int)num,__FILE__,__LINE__) ++ CRYPTO_remalloc((char **)addr,(int)num,OPENSSL_FILE,OPENSSL_LINE) + # define OPENSSL_freeFunc CRYPTO_free + # define OPENSSL_free(addr) CRYPTO_free(addr) + + # define OPENSSL_malloc_locked(num) \ +- CRYPTO_malloc_locked((int)num,__FILE__,__LINE__) ++ CRYPTO_malloc_locked((int)num,OPENSSL_FILE,OPENSSL_LINE) + # define OPENSSL_free_locked(addr) CRYPTO_free_locked(addr) + + const char *SSLeay_version(int type); +@@ -545,7 +545,7 @@ void CRYPTO_set_mem_debug_options(long bits); + long CRYPTO_get_mem_debug_options(void); + + # define CRYPTO_push_info(info) \ +- CRYPTO_push_info_(info, __FILE__, __LINE__); ++ CRYPTO_push_info_(info, OPENSSL_FILE, OPENSSL_LINE); + int CRYPTO_push_info_(const char *info, const char *file, int line); + int CRYPTO_pop_info(void); + int CRYPTO_remove_all_info(void); +@@ -588,7 +588,7 @@ void CRYPTO_mem_leaks_cb(CRYPTO_MEM_LEAK_CB *cb); + + /* die if we have to */ + void OpenSSLDie(const char *file, int line, const char *assertion); +-# define OPENSSL_assert(e) (void)((e) ? 0 : (OpenSSLDie(__FILE__, __LINE__, #e),1)) ++# define OPENSSL_assert(e) (void)((e) ? 0 : (OpenSSLDie(OPENSSL_FILE, OPENSSL_LINE, #e),1)) + + unsigned long *OPENSSL_ia32cap_loc(void); + # define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc())) +@@ -605,14 +605,14 @@ void OPENSSL_init(void); + # define fips_md_init_ctx(alg, cx) \ + int alg##_Init(cx##_CTX *c) \ + { \ +- if (FIPS_mode()) OpenSSLDie(__FILE__, __LINE__, \ ++ if (FIPS_mode()) OpenSSLDie(OPENSSL_FILE, OPENSSL_LINE, \ + "Low level API call to digest " #alg " forbidden in FIPS mode!"); \ + return private_##alg##_Init(c); \ + } \ + int private_##alg##_Init(cx##_CTX *c) + + # define fips_cipher_abort(alg) \ +- if (FIPS_mode()) OpenSSLDie(__FILE__, __LINE__, \ ++ if (FIPS_mode()) OpenSSLDie(OPENSSL_FILE, OPENSSL_LINE, \ + "Low level API call to cipher " #alg " forbidden in FIPS mode!") + + # else +diff --git a/crypto/des/read2pwd.c b/crypto/des/read2pwd.c +index 01e275f..7633139 100644 +--- a/crypto/des/read2pwd.c ++++ b/crypto/des/read2pwd.c +@@ -114,6 +114,10 @@ + #include <openssl/ui.h> + #include <openssl/crypto.h> + ++#ifndef BUFSIZ ++#define BUFSIZ 256 ++#endif + -+BIO *BIO_new_file(const char *filename, const char *mode) -+{ -+ return NULL; -+} + int DES_read_password(DES_cblock *key, const char *prompt, int verify) + { + int ok; +diff --git a/crypto/dh/dh.h b/crypto/dh/dh.h +index b177673..8ef29d1 100644 +--- a/crypto/dh/dh.h ++++ b/crypto/dh/dh.h +@@ -239,11 +239,13 @@ DH *DH_get_1024_160(void); + DH *DH_get_2048_224(void); + DH *DH_get_2048_256(void); + ++# ifndef OPENSSL_NO_CMS + /* RFC2631 KDF */ + int DH_KDF_X9_42(unsigned char *out, size_t outlen, + const unsigned char *Z, size_t Zlen, + ASN1_OBJECT *key_oid, + const unsigned char *ukm, size_t ukmlen, const EVP_MD *md); ++# endif + + # define EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, len) \ + EVP_PKEY_CTX_ctrl(ctx, EVP_PKEY_DH, EVP_PKEY_OP_PARAMGEN, \ +diff --git a/crypto/dh/dh_kdf.c b/crypto/dh/dh_kdf.c +index a882cb2..437eac4 100644 +--- a/crypto/dh/dh_kdf.c ++++ b/crypto/dh/dh_kdf.c +@@ -51,6 +51,8 @@ + * ==================================================================== + */ + ++#include <openssl/opensslconf.h> ++#ifndef OPENSSL_NO_CMS + #include <string.h> + #include <openssl/dh.h> + #include <openssl/evp.h> +@@ -185,3 +187,4 @@ int DH_KDF_X9_42(unsigned char *out, size_t outlen, + EVP_MD_CTX_cleanup(&mctx); + return rv; + } ++#endif /* !OPENSSL_NO_CMS */ +diff --git a/crypto/dh/dh_pmeth.c b/crypto/dh/dh_pmeth.c +index b58e3fa..4aa8d56 100644 +--- a/crypto/dh/dh_pmeth.c ++++ b/crypto/dh/dh_pmeth.c +@@ -205,12 +205,20 @@ static int pkey_dh_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2) + return 1; + + case EVP_PKEY_CTRL_DH_KDF_TYPE: +- if (p1 == -2) ++ switch (p1) { ++ case -2: + return dctx->kdf_type; +- if (p1 != EVP_PKEY_DH_KDF_NONE && p1 != EVP_PKEY_DH_KDF_X9_42) + -+BIO *BIO_new_fp(FILE *stream, int close_flag) -+{ -+ return NULL; -+} ++#ifndef OPENSSL_NO_CMS ++ case EVP_PKEY_DH_KDF_X9_42: ++#endif ++ case EVP_PKEY_DH_KDF_NONE: ++ dctx->kdf_type = p1; ++ return 1; + - # endif /* OPENSSL_NO_STDIO */ ++ default: + return -2; +- dctx->kdf_type = p1; +- return 1; ++ } - #endif /* HEADER_BSS_FILE_C */ -diff U3 crypto/dh/dh_pmeth.c crypto/dh/dh_pmeth.c ---- crypto/dh/dh_pmeth.c Thu Jun 11 21:50:12 2015 -+++ crypto/dh/dh_pmeth.c Fri Jun 12 11:08:48 2015 -@@ -449,6 +449,9 @@ + case EVP_PKEY_CTRL_DH_KDF_MD: + dctx->kdf_md = p2; +@@ -438,7 +446,9 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned char *key, + } + dh = ctx->pkey->pkey.dh; + dhpub = ctx->peerkey->pkey.dh->pub_key; +- if (dctx->kdf_type == EVP_PKEY_DH_KDF_NONE) { ++ ++ switch (dctx->kdf_type) { ++ case EVP_PKEY_DH_KDF_NONE: + if (key == NULL) { + *keylen = DH_size(dh); + return 1; +@@ -448,7 +458,9 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned char *key, + return ret; *keylen = ret; return 1; - } else if (dctx->kdf_type == EVP_PKEY_DH_KDF_X9_42) { -+#ifdef OPENSSL_NO_CMS -+ return 0; -+#else +- } else if (dctx->kdf_type == EVP_PKEY_DH_KDF_X9_42) { ++ ++#ifndef OPENSSL_NO_CMS ++ case EVP_PKEY_DH_KDF_X9_42: { unsigned char *Z = NULL; size_t Zlen = 0; if (!dctx->kdf_outlen || !dctx->kdf_oid) -@@ -478,6 +481,7 @@ - OPENSSL_free(Z); +@@ -479,7 +491,11 @@ static int pkey_dh_derive(EVP_PKEY_CTX *ctx, unsigned char *key, } return ret; -+#endif } - return 1; +- return 1; ++#endif /* !OPENSSL_NO_CMS */ ++ ++ default: ++ return 0; ++ } } -diff U3 crypto/pem/pem.h crypto/pem/pem.h ---- crypto/pem/pem.h Thu Jun 11 21:50:12 2015 -+++ crypto/pem/pem.h Fri Jun 12 10:58:18 2015 -@@ -324,6 +324,7 @@ + + const EVP_PKEY_METHOD dh_pkey_meth = { +diff --git a/crypto/ec/ec_ameth.c b/crypto/ec/ec_ameth.c +index 83e208c..4869098 100644 +--- a/crypto/ec/ec_ameth.c ++++ b/crypto/ec/ec_ameth.c +@@ -67,8 +67,10 @@ + #include <openssl/asn1t.h> + #include "asn1_locl.h" + ++#ifndef OPENSSL_NO_CMS + static int ecdh_cms_decrypt(CMS_RecipientInfo *ri); + static int ecdh_cms_encrypt(CMS_RecipientInfo *ri); ++#endif + + static int eckey_param2type(int *pptype, void **ppval, EC_KEY *ec_key) + { +diff --git a/crypto/engine/eng_int.h b/crypto/engine/eng_int.h +index 46f163b..b4a72a0 100644 +--- a/crypto/engine/eng_int.h ++++ b/crypto/engine/eng_int.h +@@ -88,7 +88,7 @@ extern "C" { + (unsigned int)(e), (isfunct ? "funct" : "struct"), \ + ((isfunct) ? ((e)->funct_ref - (diff)) : ((e)->struct_ref - (diff))), \ + ((isfunct) ? (e)->funct_ref : (e)->struct_ref), \ +- (__FILE__), (__LINE__)); ++ (OPENSSL_FILE), (OPENSSL_LINE)); + + # else + +@@ -136,7 +136,7 @@ ENGINE *engine_table_select(ENGINE_TABLE **table, int nid); + # else + ENGINE *engine_table_select_tmp(ENGINE_TABLE **table, int nid, const char *f, + int l); +-# define engine_table_select(t,n) engine_table_select_tmp(t,n,__FILE__,__LINE__) ++# define engine_table_select(t,n) engine_table_select_tmp(t,n,OPENSSL_FILE,OPENSSL_LINE) + # endif + typedef void (engine_table_doall_cb) (int nid, STACK_OF(ENGINE) *sk, + ENGINE *def, void *arg); +diff --git a/crypto/engine/eng_openssl.c b/crypto/engine/eng_openssl.c +index 34b0029..cf622bb 100644 +--- a/crypto/engine/eng_openssl.c ++++ b/crypto/engine/eng_openssl.c +@@ -86,7 +86,9 @@ + * this is no longer automatic in ENGINE_load_builtin_engines(). + */ + #define TEST_ENG_OPENSSL_RC4 ++#ifndef OPENSSL_NO_FP_API + #define TEST_ENG_OPENSSL_PKEY ++#endif + /* #define TEST_ENG_OPENSSL_RC4_OTHERS */ + #define TEST_ENG_OPENSSL_RC4_P_INIT + /* #define TEST_ENG_OPENSSL_RC4_P_CIPHER */ +diff --git a/crypto/err/err.h b/crypto/err/err.h +index 585aa8b..04c6cfc 100644 +--- a/crypto/err/err.h ++++ b/crypto/err/err.h +@@ -200,39 +200,39 @@ typedef struct err_state_st { + + # define ERR_LIB_USER 128 + +-# define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),__FILE__,__LINE__) +-# define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),__FILE__,__LINE__) +-# define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),__FILE__,__LINE__) +-# define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),__FILE__,__LINE__) +-# define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),__FILE__,__LINE__) +-# define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),__FILE__,__LINE__) +-# define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),__FILE__,__LINE__) +-# define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),__FILE__,__LINE__) +-# define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),__FILE__,__LINE__) +-# define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),__FILE__,__LINE__) +-# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),__FILE__,__LINE__) +-# define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),__FILE__,__LINE__) +-# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),__FILE__,__LINE__) +-# define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),__FILE__,__LINE__) +-# define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),__FILE__,__LINE__) +-# define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),__FILE__,__LINE__) +-# define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),__FILE__,__LINE__) +-# define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),__FILE__,__LINE__) +-# define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),__FILE__,__LINE__) +-# define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),__FILE__,__LINE__) +-# define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),__FILE__,__LINE__) +-# define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),__FILE__,__LINE__) +-# define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),__FILE__,__LINE__) +-# define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),__FILE__,__LINE__) +-# define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),__FILE__,__LINE__) +-# define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),__FILE__,__LINE__) +-# define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),__FILE__,__LINE__) +-# define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),__FILE__,__LINE__) +-# define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),__FILE__,__LINE__) +-# define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),__FILE__,__LINE__) +-# define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),__FILE__,__LINE__) +-# define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),__FILE__,__LINE__) +-# define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),__FILE__,__LINE__) ++# define SYSerr(f,r) ERR_PUT_error(ERR_LIB_SYS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define BNerr(f,r) ERR_PUT_error(ERR_LIB_BN,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define RSAerr(f,r) ERR_PUT_error(ERR_LIB_RSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define DHerr(f,r) ERR_PUT_error(ERR_LIB_DH,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define EVPerr(f,r) ERR_PUT_error(ERR_LIB_EVP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define BUFerr(f,r) ERR_PUT_error(ERR_LIB_BUF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define OBJerr(f,r) ERR_PUT_error(ERR_LIB_OBJ,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define PEMerr(f,r) ERR_PUT_error(ERR_LIB_PEM,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define DSAerr(f,r) ERR_PUT_error(ERR_LIB_DSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define X509err(f,r) ERR_PUT_error(ERR_LIB_X509,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define ASN1err(f,r) ERR_PUT_error(ERR_LIB_ASN1,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define CONFerr(f,r) ERR_PUT_error(ERR_LIB_CONF,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define CRYPTOerr(f,r) ERR_PUT_error(ERR_LIB_CRYPTO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define ECerr(f,r) ERR_PUT_error(ERR_LIB_EC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define SSLerr(f,r) ERR_PUT_error(ERR_LIB_SSL,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define BIOerr(f,r) ERR_PUT_error(ERR_LIB_BIO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define RANDerr(f,r) ERR_PUT_error(ERR_LIB_RAND,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define DSOerr(f,r) ERR_PUT_error(ERR_LIB_DSO,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define ENGINEerr(f,r) ERR_PUT_error(ERR_LIB_ENGINE,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define TSerr(f,r) ERR_PUT_error(ERR_LIB_TS,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),OPENSSL_FILE,OPENSSL_LINE) ++# define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),OPENSSL_FILE,OPENSSL_LINE) + + /* + * Borland C seems too stupid to be able to shift and do longs in the +diff --git a/crypto/opensslconf.h.in b/crypto/opensslconf.h.in +index 814309b..bff44d3 100644 +--- a/crypto/opensslconf.h.in ++++ b/crypto/opensslconf.h.in +@@ -1,5 +1,15 @@ + /* crypto/opensslconf.h.in */ + ++#ifndef OPENSSL_FILE ++#ifdef OPENSSL_NO_FILENAMES ++#define OPENSSL_FILE "" ++#define OPENSSL_LINE 0 ++#else ++#define OPENSSL_FILE __FILE__ ++#define OPENSSL_LINE __LINE__ ++#endif ++#endif ++ + /* Generate 80386 code? */ + #undef I386_ONLY + +@@ -56,7 +66,7 @@ + #endif + #endif + +-#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) ++#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) && !defined(OPENSSL_SYSNAME_UEFI) + #define CONFIG_HEADER_BN_H + #undef BN_LLONG + +diff --git a/crypto/pem/pem.h b/crypto/pem/pem.h +index d3b23fc..87b0b6a 100644 +--- a/crypto/pem/pem.h ++++ b/crypto/pem/pem.h +@@ -324,6 +324,7 @@ int PEM_write_bio_##name(BIO *bp, type *x, const EVP_CIPHER *enc, \ # define DECLARE_PEM_read_fp(name, type) /**/ # define DECLARE_PEM_write_fp(name, type) /**/ @@ -72,49 +1141,96 @@ diff U3 crypto/pem/pem.h crypto/pem/pem.h # define DECLARE_PEM_write_cb_fp(name, type) /**/ # else -diff U3 crypto/pkcs7/pk7_smime.c crypto/pkcs7/pk7_smime.c ---- crypto/pkcs7/pk7_smime.c Thu Jun 11 21:01:06 2015 -+++ crypto/pkcs7/pk7_smime.c Fri Jun 12 11:23:38 2015 -@@ -254,7 +254,8 @@ +@@ -417,6 +418,7 @@ int PEM_X509_INFO_write_bio(BIO *bp, X509_INFO *xi, EVP_CIPHER *enc, + pem_password_cb *cd, void *u); + # endif + ++#ifndef OPENSSL_NO_FP_API + int PEM_read(FILE *fp, char **name, char **header, + unsigned char **data, long *len); + int PEM_write(FILE *fp, const char *name, const char *hdr, +@@ -428,6 +430,7 @@ int PEM_ASN1_write(i2d_of_void *i2d, const char *name, FILE *fp, + int klen, pem_password_cb *callback, void *u); + STACK_OF(X509_INFO) *PEM_X509_INFO_read(FILE *fp, STACK_OF(X509_INFO) *sk, + pem_password_cb *cb, void *u); ++#endif + + int PEM_SealInit(PEM_ENCODE_SEAL_CTX *ctx, EVP_CIPHER *type, + EVP_MD *md_type, unsigned char **ek, int *ekl, +@@ -494,6 +497,7 @@ int i2d_PKCS8PrivateKey_nid_bio(BIO *bp, EVP_PKEY *x, int nid, + EVP_PKEY *d2i_PKCS8PrivateKey_bio(BIO *bp, EVP_PKEY **x, pem_password_cb *cb, + void *u); + ++#ifndef OPENSSL_NO_FP_API + int i2d_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, + char *kstr, int klen, + pem_password_cb *cb, void *u); +@@ -510,7 +514,7 @@ EVP_PKEY *d2i_PKCS8PrivateKey_fp(FILE *fp, EVP_PKEY **x, pem_password_cb *cb, + int PEM_write_PKCS8PrivateKey(FILE *fp, EVP_PKEY *x, const EVP_CIPHER *enc, + char *kstr, int klen, pem_password_cb *cd, + void *u); +- ++#endif + EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x); + int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x); + +diff --git a/crypto/pem/pem_pk8.c b/crypto/pem/pem_pk8.c +index 5747c73..fe465cc 100644 +--- a/crypto/pem/pem_pk8.c ++++ b/crypto/pem/pem_pk8.c +@@ -69,10 +69,12 @@ + static int do_pk8pkey(BIO *bp, EVP_PKEY *x, int isder, + int nid, const EVP_CIPHER *enc, + char *kstr, int klen, pem_password_cb *cb, void *u); ++ ++#ifndef OPENSSL_NO_FP_API + static int do_pk8pkey_fp(FILE *bp, EVP_PKEY *x, int isder, + int nid, const EVP_CIPHER *enc, + char *kstr, int klen, pem_password_cb *cb, void *u); +- ++#endif + /* + * These functions write a private key in PKCS#8 format: it is a "drop in" + * replacement for PEM_write_bio_PrivateKey() and friends. As usual if 'enc' +diff --git a/crypto/pkcs7/pk7_smime.c b/crypto/pkcs7/pk7_smime.c +index dbd4100..9cfa140 100644 +--- a/crypto/pkcs7/pk7_smime.c ++++ b/crypto/pkcs7/pk7_smime.c +@@ -254,7 +254,7 @@ int PKCS7_verify(PKCS7 *p7, STACK_OF(X509) *certs, X509_STORE *store, STACK_OF(PKCS7_SIGNER_INFO) *sinfos; PKCS7_SIGNER_INFO *si; X509_STORE_CTX cert_ctx; - char buf[4096]; -+ char *buf = NULL; -+ int bufsiz; ++ char buf[256]; int i, j = 0, k, ret = 0; BIO *p7bio; BIO *tmpin, *tmpout; -@@ -365,9 +366,14 @@ - } else - tmpout = out; +@@ -519,7 +519,7 @@ int PKCS7_decrypt(PKCS7 *p7, EVP_PKEY *pkey, X509 *cert, BIO *data, int flags) + { + BIO *tmpmem; + int ret, i; +- char buf[4096]; ++ char buf[256]; -+ bufsiz = 4096; -+ buf = OPENSSL_malloc(bufsiz); -+ if (buf == NULL) { -+ goto err; -+ } - /* We now have to 'read' from p7bio to calculate digests etc. */ - for (;;) { -- i = BIO_read(p7bio, buf, sizeof(buf)); -+ i = BIO_read(p7bio, buf, bufsiz); - if (i <= 0) - break; - if (tmpout) -@@ -406,6 +412,10 @@ - BIO_free_all(p7bio); - - sk_X509_free(signers); -+ -+ if (buf != NULL) { -+ OPENSSL_free(buf); -+ } + if (!p7) { + PKCS7err(PKCS7_F_PKCS7_DECRYPT, PKCS7_R_INVALID_NULL_POINTER); +diff --git a/crypto/rand/rand_egd.c b/crypto/rand/rand_egd.c +index 737aebf..f23f348 100644 +--- a/crypto/rand/rand_egd.c ++++ b/crypto/rand/rand_egd.c +@@ -95,7 +95,7 @@ + * RAND_egd() is a wrapper for RAND_egd_bytes() with numbytes=255. + */ - return ret; - } -diff U3 crypto/rand/rand_unix.c crypto/rand/rand_unix.c ---- crypto/rand/rand_unix.c Thu Jun 11 21:01:06 2015 -+++ crypto/rand/rand_unix.c Fri Jun 12 10:51:21 2015 +-#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) ++#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) + int RAND_query_egd_bytes(const char *path, unsigned char *buf, int bytes) + { + return (-1); +diff --git a/crypto/rand/rand_unix.c b/crypto/rand/rand_unix.c +index 266111e..f60fac6 100644 +--- a/crypto/rand/rand_unix.c ++++ b/crypto/rand/rand_unix.c @@ -116,7 +116,7 @@ #include <openssl/rand.h> #include "rand_lcl.h" @@ -124,7 +1240,7 @@ diff U3 crypto/rand/rand_unix.c crypto/rand/rand_unix.c # include <sys/types.h> # include <sys/time.h> -@@ -439,7 +439,7 @@ +@@ -439,7 +439,7 @@ int RAND_poll(void) * defined(OPENSSL_SYS_VXWORKS) || * defined(OPENSSL_SYS_NETWARE)) */ @@ -133,9 +1249,10 @@ diff U3 crypto/rand/rand_unix.c crypto/rand/rand_unix.c int RAND_poll(void) { return 0; -diff U3 crypto/rsa/rsa_ameth.c crypto/rsa/rsa_ameth.c ---- crypto/rsa/rsa_ameth.c Thu Jun 11 21:50:12 2015 -+++ crypto/rsa/rsa_ameth.c Fri Jun 12 10:45:38 2015 +diff --git a/crypto/rsa/rsa_ameth.c b/crypto/rsa/rsa_ameth.c +index ca3922e..113a268 100644 +--- a/crypto/rsa/rsa_ameth.c ++++ b/crypto/rsa/rsa_ameth.c @@ -68,10 +68,12 @@ #endif #include "asn1_locl.h" @@ -149,7 +1266,7 @@ diff U3 crypto/rsa/rsa_ameth.c crypto/rsa/rsa_ameth.c static int rsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey) { -@@ -665,6 +667,7 @@ +@@ -665,6 +667,7 @@ static int rsa_pss_to_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pkctx, return rv; } @@ -157,7 +1274,7 @@ diff U3 crypto/rsa/rsa_ameth.c crypto/rsa/rsa_ameth.c static int rsa_cms_verify(CMS_SignerInfo *si) { int nid, nid2; -@@ -683,6 +686,7 @@ +@@ -683,6 +686,7 @@ static int rsa_cms_verify(CMS_SignerInfo *si) } return 0; } @@ -165,7 +1282,7 @@ diff U3 crypto/rsa/rsa_ameth.c crypto/rsa/rsa_ameth.c /* * Customised RSA item verification routine. This is called when a signature -@@ -705,6 +709,7 @@ +@@ -705,6 +709,7 @@ static int rsa_item_verify(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, return -1; } @@ -173,7 +1290,7 @@ diff U3 crypto/rsa/rsa_ameth.c crypto/rsa/rsa_ameth.c static int rsa_cms_sign(CMS_SignerInfo *si) { int pad_mode = RSA_PKCS1_PADDING; -@@ -729,6 +734,7 @@ +@@ -729,6 +734,7 @@ static int rsa_cms_sign(CMS_SignerInfo *si) X509_ALGOR_set0(alg, OBJ_nid2obj(NID_rsassaPss), V_ASN1_SEQUENCE, os); return 1; } @@ -181,7 +1298,7 @@ diff U3 crypto/rsa/rsa_ameth.c crypto/rsa/rsa_ameth.c static int rsa_item_sign(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, X509_ALGOR *alg1, X509_ALGOR *alg2, -@@ -785,6 +791,7 @@ +@@ -785,6 +791,7 @@ static RSA_OAEP_PARAMS *rsa_oaep_decode(const X509_ALGOR *alg, return pss; } @@ -189,29 +1306,352 @@ diff U3 crypto/rsa/rsa_ameth.c crypto/rsa/rsa_ameth.c static int rsa_cms_decrypt(CMS_RecipientInfo *ri) { EVP_PKEY_CTX *pkctx; -@@ -857,7 +864,9 @@ - X509_ALGOR_free(maskHash); +@@ -920,6 +927,7 @@ static int rsa_cms_encrypt(CMS_RecipientInfo *ri) + ASN1_STRING_free(os); return rv; } +#endif -+#ifndef OPENSSL_NO_CMS - static int rsa_cms_encrypt(CMS_RecipientInfo *ri) + const EVP_PKEY_ASN1_METHOD rsa_asn1_meths[] = { + { +diff --git a/crypto/srp/srp.h b/crypto/srp/srp.h +index d072536..73b945f 100644 +--- a/crypto/srp/srp.h ++++ b/crypto/srp/srp.h +@@ -114,7 +114,9 @@ DECLARE_STACK_OF(SRP_gN) + + SRP_VBASE *SRP_VBASE_new(char *seed_key); + int SRP_VBASE_free(SRP_VBASE *vb); ++#ifndef OPENSSL_NO_STDIO + int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file); ++#endif + SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username); + char *SRP_create_verifier(const char *user, const char *pass, char **salt, + char **verifier, const char *N, const char *g); +diff --git a/crypto/srp/srp_vfy.c b/crypto/srp/srp_vfy.c +index 50f75d7..28bc419 100644 +--- a/crypto/srp/srp_vfy.c ++++ b/crypto/srp/srp_vfy.c +@@ -225,6 +225,7 @@ static int SRP_user_pwd_set_ids(SRP_user_pwd *vinfo, const char *id, + return (info == NULL || NULL != (vinfo->info = BUF_strdup(info))); + } + ++#ifndef OPENSSL_NO_STDIO + static int SRP_user_pwd_set_sv(SRP_user_pwd *vinfo, const char *s, + const char *v) { - const EVP_MD *md, *mgf1md; -@@ -920,6 +929,7 @@ - ASN1_STRING_free(os); - return rv; +@@ -239,6 +240,7 @@ static int SRP_user_pwd_set_sv(SRP_user_pwd *vinfo, const char *s, + len = t_fromb64(tmp, s); + return ((vinfo->s = BN_bin2bn(tmp, len, NULL)) != NULL); } +#endif - const EVP_PKEY_ASN1_METHOD rsa_asn1_meths[] = { - { + static int SRP_user_pwd_set_sv_BN(SRP_user_pwd *vinfo, BIGNUM *s, BIGNUM *v) + { +@@ -279,6 +281,7 @@ int SRP_VBASE_free(SRP_VBASE *vb) + return 0; + } + ++#ifndef OPENSSL_NO_STDIO + static SRP_gN_cache *SRP_gN_new_init(const char *ch) + { + unsigned char tmp[MAX_LEN]; +@@ -310,6 +313,7 @@ static void SRP_gN_free(SRP_gN_cache *gN_cache) + BN_free(gN_cache->bn); + OPENSSL_free(gN_cache); + } ++#endif + + static SRP_gN *SRP_get_gN_by_id(const char *id, STACK_OF(SRP_gN) *gN_tab) + { +@@ -326,6 +330,7 @@ static SRP_gN *SRP_get_gN_by_id(const char *id, STACK_OF(SRP_gN) *gN_tab) + return SRP_get_default_gN(id); + } + ++#ifndef OPENSSL_NO_STDIO + static BIGNUM *SRP_gN_place_bn(STACK_OF(SRP_gN_cache) *gN_cache, char *ch) + { + int i; +@@ -467,6 +472,7 @@ int SRP_VBASE_init(SRP_VBASE *vb, char *verifier_file) + return error_code; + + } ++#endif + + SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username) + { +diff --git a/crypto/ts/ts.h b/crypto/ts/ts.h +index 16eccbb..a9fe40e 100644 +--- a/crypto/ts/ts.h ++++ b/crypto/ts/ts.h +@@ -281,8 +281,10 @@ TS_REQ *d2i_TS_REQ(TS_REQ **a, const unsigned char **pp, long length); + + TS_REQ *TS_REQ_dup(TS_REQ *a); + ++#ifndef OPENSSL_NO_FP_API + TS_REQ *d2i_TS_REQ_fp(FILE *fp, TS_REQ **a); + int i2d_TS_REQ_fp(FILE *fp, TS_REQ *a); ++#endif + TS_REQ *d2i_TS_REQ_bio(BIO *fp, TS_REQ **a); + int i2d_TS_REQ_bio(BIO *fp, TS_REQ *a); + +@@ -294,10 +296,12 @@ TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT(TS_MSG_IMPRINT **a, + + TS_MSG_IMPRINT *TS_MSG_IMPRINT_dup(TS_MSG_IMPRINT *a); + ++#ifndef OPENSSL_NO_FP_API + TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT **a); + int i2d_TS_MSG_IMPRINT_fp(FILE *fp, TS_MSG_IMPRINT *a); +-TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *fp, TS_MSG_IMPRINT **a); +-int i2d_TS_MSG_IMPRINT_bio(BIO *fp, TS_MSG_IMPRINT *a); ++#endif ++TS_MSG_IMPRINT *d2i_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT **a); ++int i2d_TS_MSG_IMPRINT_bio(BIO *bio, TS_MSG_IMPRINT *a); + + TS_RESP *TS_RESP_new(void); + void TS_RESP_free(TS_RESP *a); +@@ -306,10 +310,12 @@ TS_RESP *d2i_TS_RESP(TS_RESP **a, const unsigned char **pp, long length); + TS_TST_INFO *PKCS7_to_TS_TST_INFO(PKCS7 *token); + TS_RESP *TS_RESP_dup(TS_RESP *a); + ++#ifndef OPENSSL_NO_FP_API + TS_RESP *d2i_TS_RESP_fp(FILE *fp, TS_RESP **a); + int i2d_TS_RESP_fp(FILE *fp, TS_RESP *a); +-TS_RESP *d2i_TS_RESP_bio(BIO *fp, TS_RESP **a); +-int i2d_TS_RESP_bio(BIO *fp, TS_RESP *a); ++#endif ++TS_RESP *d2i_TS_RESP_bio(BIO *bio, TS_RESP **a); ++int i2d_TS_RESP_bio(BIO *bio, TS_RESP *a); + + TS_STATUS_INFO *TS_STATUS_INFO_new(void); + void TS_STATUS_INFO_free(TS_STATUS_INFO *a); +@@ -325,10 +331,12 @@ TS_TST_INFO *d2i_TS_TST_INFO(TS_TST_INFO **a, const unsigned char **pp, + long length); + TS_TST_INFO *TS_TST_INFO_dup(TS_TST_INFO *a); + ++#ifndef OPENSSL_NO_FP_API + TS_TST_INFO *d2i_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO **a); + int i2d_TS_TST_INFO_fp(FILE *fp, TS_TST_INFO *a); +-TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *fp, TS_TST_INFO **a); +-int i2d_TS_TST_INFO_bio(BIO *fp, TS_TST_INFO *a); ++#endif ++TS_TST_INFO *d2i_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO **a); ++int i2d_TS_TST_INFO_bio(BIO *bio, TS_TST_INFO *a); + + TS_ACCURACY *TS_ACCURACY_new(void); + void TS_ACCURACY_free(TS_ACCURACY *a); +@@ -728,15 +736,18 @@ int TS_MSG_IMPRINT_print_bio(BIO *bio, TS_MSG_IMPRINT *msg); + * ts/ts_conf.c + */ + ++#ifndef OPENSSL_NO_STDIO + X509 *TS_CONF_load_cert(const char *file); + STACK_OF(X509) *TS_CONF_load_certs(const char *file); + EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass); ++#endif + const char *TS_CONF_get_tsa_section(CONF *conf, const char *section); + int TS_CONF_set_serial(CONF *conf, const char *section, TS_serial_cb cb, + TS_RESP_CTX *ctx); + int TS_CONF_set_crypto_device(CONF *conf, const char *section, + const char *device); + int TS_CONF_set_default_engine(const char *name); ++#ifndef OPENSSL_NO_STDIO + int TS_CONF_set_signer_cert(CONF *conf, const char *section, + const char *cert, TS_RESP_CTX *ctx); + int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs, +@@ -744,6 +755,7 @@ int TS_CONF_set_certs(CONF *conf, const char *section, const char *certs, + int TS_CONF_set_signer_key(CONF *conf, const char *section, + const char *key, const char *pass, + TS_RESP_CTX *ctx); ++#endif + int TS_CONF_set_def_policy(CONF *conf, const char *section, + const char *policy, TS_RESP_CTX *ctx); + int TS_CONF_set_policies(CONF *conf, const char *section, TS_RESP_CTX *ctx); +@@ -784,6 +796,11 @@ void ERR_load_TS_strings(void); + # define TS_F_TS_CHECK_SIGNING_CERTS 103 + # define TS_F_TS_CHECK_STATUS_INFO 104 + # define TS_F_TS_COMPUTE_IMPRINT 145 ++# define TS_F_TS_CONF_INVALID 151 ++# define TS_F_TS_CONF_LOAD_CERT 153 ++# define TS_F_TS_CONF_LOAD_CERTS 154 ++# define TS_F_TS_CONF_LOAD_KEY 155 ++# define TS_F_TS_CONF_LOOKUP_FAIL 152 + # define TS_F_TS_CONF_SET_DEFAULT_ENGINE 146 + # define TS_F_TS_GET_STATUS_TEXT 105 + # define TS_F_TS_MSG_IMPRINT_SET_ALGO 118 +@@ -822,6 +839,8 @@ void ERR_load_TS_strings(void); + /* Reason codes. */ + # define TS_R_BAD_PKCS7_TYPE 132 + # define TS_R_BAD_TYPE 133 ++# define TS_R_CANNOT_LOAD_CERT 137 ++# define TS_R_CANNOT_LOAD_KEY 138 + # define TS_R_CERTIFICATE_VERIFY_ERROR 100 + # define TS_R_COULD_NOT_SET_ENGINE 127 + # define TS_R_COULD_NOT_SET_TIME 115 +@@ -854,6 +873,8 @@ void ERR_load_TS_strings(void); + # define TS_R_UNACCEPTABLE_POLICY 125 + # define TS_R_UNSUPPORTED_MD_ALGORITHM 126 + # define TS_R_UNSUPPORTED_VERSION 113 ++# define TS_R_VAR_BAD_VALUE 135 ++# define TS_R_VAR_LOOKUP_FAILURE 136 + # define TS_R_WRONG_CONTENT_TYPE 114 + + #ifdef __cplusplus +diff --git a/crypto/ts/ts_conf.c b/crypto/ts/ts_conf.c +index 4716b23..c4416ba 100644 +--- a/crypto/ts/ts_conf.c ++++ b/crypto/ts/ts_conf.c +@@ -92,6 +92,7 @@ + + /* Function definitions for certificate and key loading. */ + ++#ifndef OPENSSL_NO_STDIO + X509 *TS_CONF_load_cert(const char *file) + { + BIO *cert = NULL; +@@ -102,7 +103,7 @@ X509 *TS_CONF_load_cert(const char *file) + x = PEM_read_bio_X509_AUX(cert, NULL, NULL, NULL); + end: + if (x == NULL) +- fprintf(stderr, "unable to load certificate: %s\n", file); ++ TSerr(TS_F_TS_CONF_LOAD_CERT, TS_R_CANNOT_LOAD_CERT); + BIO_free(cert); + return x; + } +@@ -129,7 +130,7 @@ STACK_OF(X509) *TS_CONF_load_certs(const char *file) + } + end: + if (othercerts == NULL) +- fprintf(stderr, "unable to load certificates: %s\n", file); ++ TSerr(TS_F_TS_CONF_LOAD_CERTS, TS_R_CANNOT_LOAD_CERT); + sk_X509_INFO_pop_free(allcerts, X509_INFO_free); + BIO_free(certs); + return othercerts; +@@ -145,21 +146,24 @@ EVP_PKEY *TS_CONF_load_key(const char *file, const char *pass) + pkey = PEM_read_bio_PrivateKey(key, NULL, NULL, (char *)pass); + end: + if (pkey == NULL) +- fprintf(stderr, "unable to load private key: %s\n", file); ++ TSerr(TS_F_TS_CONF_LOAD_KEY, TS_R_CANNOT_LOAD_KEY); + BIO_free(key); + return pkey; + } ++#endif /* !OPENSSL_NO_STDIO */ + + /* Function definitions for handling configuration options. */ + + static void TS_CONF_lookup_fail(const char *name, const char *tag) + { +- fprintf(stderr, "variable lookup failed for %s::%s\n", name, tag); ++ TSerr(TS_F_TS_CONF_LOOKUP_FAIL, TS_R_VAR_LOOKUP_FAILURE); ++ ERR_add_error_data(3, name, "::", tag); + } + + static void TS_CONF_invalid(const char *name, const char *tag) + { +- fprintf(stderr, "invalid variable value for %s::%s\n", name, tag); ++ TSerr(TS_F_TS_CONF_INVALID, TS_R_VAR_BAD_VALUE); ++ ERR_add_error_data(3, name, "::", tag); + } + + const char *TS_CONF_get_tsa_section(CONF *conf, const char *section) +@@ -237,6 +241,7 @@ int TS_CONF_set_default_engine(const char *name) + + #endif + ++#ifndef OPENSSL_NO_STDIO + int TS_CONF_set_signer_cert(CONF *conf, const char *section, + const char *cert, TS_RESP_CTX *ctx) + { +@@ -302,6 +307,7 @@ int TS_CONF_set_signer_key(CONF *conf, const char *section, + EVP_PKEY_free(key_obj); + return ret; + } ++#endif /* !OPENSSL_NO_STDIO */ + + int TS_CONF_set_def_policy(CONF *conf, const char *section, + const char *policy, TS_RESP_CTX *ctx) +diff --git a/crypto/ts/ts_err.c b/crypto/ts/ts_err.c +index ff1abf4..3f5b78f 100644 +--- a/crypto/ts/ts_err.c ++++ b/crypto/ts/ts_err.c +@@ -1,6 +1,6 @@ + /* crypto/ts/ts_err.c */ + /* ==================================================================== +- * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. ++ * Copyright (c) 1999-2015 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions +@@ -87,6 +87,11 @@ static ERR_STRING_DATA TS_str_functs[] = { + {ERR_FUNC(TS_F_TS_CHECK_SIGNING_CERTS), "TS_CHECK_SIGNING_CERTS"}, + {ERR_FUNC(TS_F_TS_CHECK_STATUS_INFO), "TS_CHECK_STATUS_INFO"}, + {ERR_FUNC(TS_F_TS_COMPUTE_IMPRINT), "TS_COMPUTE_IMPRINT"}, ++ {ERR_FUNC(TS_F_TS_CONF_INVALID), "ts_CONF_invalid"}, ++ {ERR_FUNC(TS_F_TS_CONF_LOAD_CERT), "TS_CONF_load_cert"}, ++ {ERR_FUNC(TS_F_TS_CONF_LOAD_CERTS), "TS_CONF_load_certs"}, ++ {ERR_FUNC(TS_F_TS_CONF_LOAD_KEY), "TS_CONF_load_key"}, ++ {ERR_FUNC(TS_F_TS_CONF_LOOKUP_FAIL), "ts_CONF_lookup_fail"}, + {ERR_FUNC(TS_F_TS_CONF_SET_DEFAULT_ENGINE), "TS_CONF_set_default_engine"}, + {ERR_FUNC(TS_F_TS_GET_STATUS_TEXT), "TS_GET_STATUS_TEXT"}, + {ERR_FUNC(TS_F_TS_MSG_IMPRINT_SET_ALGO), "TS_MSG_IMPRINT_set_algo"}, +@@ -132,6 +137,8 @@ static ERR_STRING_DATA TS_str_functs[] = { + static ERR_STRING_DATA TS_str_reasons[] = { + {ERR_REASON(TS_R_BAD_PKCS7_TYPE), "bad pkcs7 type"}, + {ERR_REASON(TS_R_BAD_TYPE), "bad type"}, ++ {ERR_REASON(TS_R_CANNOT_LOAD_CERT), "cannot load certificate"}, ++ {ERR_REASON(TS_R_CANNOT_LOAD_KEY), "cannot load private key"}, + {ERR_REASON(TS_R_CERTIFICATE_VERIFY_ERROR), "certificate verify error"}, + {ERR_REASON(TS_R_COULD_NOT_SET_ENGINE), "could not set engine"}, + {ERR_REASON(TS_R_COULD_NOT_SET_TIME), "could not set time"}, +@@ -170,6 +177,8 @@ static ERR_STRING_DATA TS_str_reasons[] = { + {ERR_REASON(TS_R_UNACCEPTABLE_POLICY), "unacceptable policy"}, + {ERR_REASON(TS_R_UNSUPPORTED_MD_ALGORITHM), "unsupported md algorithm"}, + {ERR_REASON(TS_R_UNSUPPORTED_VERSION), "unsupported version"}, ++ {ERR_REASON(TS_R_VAR_BAD_VALUE), "var bad value"}, ++ {ERR_REASON(TS_R_VAR_LOOKUP_FAILURE), "cannot find config variable"}, + {ERR_REASON(TS_R_WRONG_CONTENT_TYPE), "wrong content type"}, + {0, NULL} + }; +diff --git a/crypto/ui/ui_util.c b/crypto/ui/ui_util.c +index f65f80d..b18e2a2 100644 +--- a/crypto/ui/ui_util.c ++++ b/crypto/ui/ui_util.c +@@ -56,6 +56,10 @@ + #include <string.h> + #include "ui_locl.h" + ++#ifndef BUFSIZ ++#define BUFSIZ 256 ++#endif ++ + int UI_UTIL_read_pw_string(char *buf, int length, const char *prompt, + int verify) + { +diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c +index 9ee8f8d..64b052e 100644 +--- a/crypto/x509/by_dir.c ++++ b/crypto/x509/by_dir.c +@@ -69,6 +69,8 @@ + # include <sys/stat.h> + #endif + ++#ifndef OPENSSL_NO_STDIO ++ + #include <openssl/lhash.h> + #include <openssl/x509.h> + +@@ -434,3 +436,5 @@ static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name, + BUF_MEM_free(b); + return (ok); + } ++ ++#endif /* OPENSSL_NO_STDIO */ diff --git a/crypto/x509/x509_vfy.c b/crypto/x509/x509_vfy.c -index df012dd..29b3297 100644 ---- crypto/x509/x509_vfy.c Thu Jun 11 21:52:58 2015 -+++ crypto/x509/x509_vfy.c Fri Jun 12 11:29:37 2015 -@@ -950,6 +950,8 @@ static int check_crl_time(X509_STORE_CTX *ctx, X509_CRL *crl, int notify) +index a2f1dbe..0f293aa 100644 +--- a/crypto/x509/x509_vfy.c ++++ b/crypto/x509/x509_vfy.c +@@ -935,6 +935,8 @@ static int check_crl_time(X509_STORE_CTX *ctx, X509_CRL *crl, int notify) ctx->current_crl = crl; if (ctx->param->flags & X509_V_FLAG_USE_CHECK_TIME) ptime = &ctx->param->check_time; @@ -220,7 +1660,7 @@ index df012dd..29b3297 100644 else ptime = NULL; -@@ -1670,6 +1672,8 @@ int x509_check_cert_time(X509_STORE_CTX *ctx, X509 *x, int quiet) +@@ -1658,6 +1660,8 @@ static int check_cert_time(X509_STORE_CTX *ctx, X509 *x) if (ctx->param->flags & X509_V_FLAG_USE_CHECK_TIME) ptime = &ctx->param->check_time; @@ -229,11 +1669,11 @@ index df012dd..29b3297 100644 else ptime = NULL; -diff --git a/include/openssl/x509_vfy.h b/include/openssl/x509_vfy.h -index 8e0a225..c78ba98 100644 ---- crypto/x509/x509_vfy.h -+++ crypto/x509/x509_vfy.h -@@ -407,6 +407,8 @@ void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); +diff --git a/crypto/x509/x509_vfy.h b/crypto/x509/x509_vfy.h +index bd8613c..da00908 100644 +--- a/crypto/x509/x509_vfy.h ++++ b/crypto/x509/x509_vfy.h +@@ -438,6 +438,8 @@ void X509_STORE_CTX_set_depth(X509_STORE_CTX *ctx, int depth); * will force the behaviour to match that of previous versions. */ # define X509_V_FLAG_NO_ALT_CHAINS 0x100000 @@ -242,107 +1682,181 @@ index 8e0a225..c78ba98 100644 # define X509_VP_FLAG_DEFAULT 0x1 # define X509_VP_FLAG_OVERWRITE 0x2 -diff U3 crypto/x509v3/ext_dat.h crypto/x509v3/ext_dat.h ---- crypto/x509v3/ext_dat.h Thu Jun 11 21:50:12 2015 -+++ crypto/x509v3/ext_dat.h Fri Jun 12 11:11:03 2015 -@@ -127,8 +127,10 @@ +@@ -490,9 +492,10 @@ void X509_STORE_CTX_cleanup(X509_STORE_CTX *ctx); + X509_STORE *X509_STORE_CTX_get0_store(X509_STORE_CTX *ctx); + + X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m); +- ++#ifndef OPENSSL_NO_STDIO + X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void); + X509_LOOKUP_METHOD *X509_LOOKUP_file(void); ++#endif + + int X509_STORE_add_cert(X509_STORE *ctx, X509 *x); + int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x); +diff --git a/crypto/x509v3/ext_dat.h b/crypto/x509v3/ext_dat.h +index c3a6fce..09ebbca 100644 +--- a/crypto/x509v3/ext_dat.h ++++ b/crypto/x509v3/ext_dat.h +@@ -127,8 +127,10 @@ static const X509V3_EXT_METHOD *standard_exts[] = { &v3_idp, &v3_alt[2], &v3_freshest_crl, -+#ifndef OPENSSL_SYS_UEFI ++#ifndef OPENSSL_NO_SCT &v3_ct_scts[0], &v3_ct_scts[1], +#endif }; /* Number of standard extensions */ -diff U3 crypto/crypto.h crypto/crypto.h ---- crypto/crypto.h Thu Jun 11 21:01:06 2015 -+++ crypto/crypto.h Fri Jun 12 11:33:27 2015 -@@ -235,15 +235,15 @@ - # ifndef OPENSSL_NO_LOCKING - # ifndef CRYPTO_w_lock - # define CRYPTO_w_lock(type) \ -- CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__) -+ CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,NULL,0) - # define CRYPTO_w_unlock(type) \ -- CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__) -+ CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,NULL,0) - # define CRYPTO_r_lock(type) \ -- CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__) -+ CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,NULL,0) - # define CRYPTO_r_unlock(type) \ -- CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__) -+ CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,NULL,0) - # define CRYPTO_add(addr,amount,type) \ -- CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__) -+ CRYPTO_add_lock(addr,amount,type,NULL,0) - # endif - # else - # define CRYPTO_w_lock(a) -@@ -378,19 +378,19 @@ - # define MemCheck_off() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE) - # define is_MemCheck_on() CRYPTO_is_mem_check_on() +diff --git a/crypto/x509v3/v3_pci.c b/crypto/x509v3/v3_pci.c +index 48ac095..f51cb63 100644 +--- a/crypto/x509v3/v3_pci.c ++++ b/crypto/x509v3/v3_pci.c +@@ -149,6 +149,7 @@ static int process_pci_value(CONF_VALUE *val, + goto err; + } + OPENSSL_free(tmp_data2); ++#ifndef OPENSSL_NO_STDIO + } else if (strncmp(val->value, "file:", 5) == 0) { + unsigned char buf[2048]; + int n; +@@ -181,6 +182,7 @@ static int process_pci_value(CONF_VALUE *val, + X509V3_conf_err(val); + goto err; + } ++#endif /* !OPENSSL_NO_STDIO */ + } else if (strncmp(val->value, "text:", 5) == 0) { + val_len = strlen(val->value + 5); + tmp_data = OPENSSL_realloc((*policy)->data, +diff --git a/crypto/x509v3/v3_scts.c b/crypto/x509v3/v3_scts.c +index 6e0b8d6..7f3f659 100644 +--- a/crypto/x509v3/v3_scts.c ++++ b/crypto/x509v3/v3_scts.c +@@ -61,6 +61,7 @@ + #include <openssl/asn1.h> + #include <openssl/x509v3.h> --# define OPENSSL_malloc(num) CRYPTO_malloc((int)num,__FILE__,__LINE__) --# define OPENSSL_strdup(str) CRYPTO_strdup((str),__FILE__,__LINE__) -+# define OPENSSL_malloc(num) CRYPTO_malloc((int)num,NULL,0) -+# define OPENSSL_strdup(str) CRYPTO_strdup((str),NULL,0) - # define OPENSSL_realloc(addr,num) \ -- CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__) -+ CRYPTO_realloc((char *)addr,(int)num,NULL,0) - # define OPENSSL_realloc_clean(addr,old_num,num) \ -- CRYPTO_realloc_clean(addr,old_num,num,__FILE__,__LINE__) -+ CRYPTO_realloc_clean(addr,old_num,num,NULL,0) - # define OPENSSL_remalloc(addr,num) \ -- CRYPTO_remalloc((char **)addr,(int)num,__FILE__,__LINE__) -+ CRYPTO_remalloc((char **)addr,(int)num,NULL,0) - # define OPENSSL_freeFunc CRYPTO_free - # define OPENSSL_free(addr) CRYPTO_free(addr) ++#ifndef OPENSSL_NO_SCT + /* Signature and hash algorithms from RFC 5246 */ + #define TLSEXT_hash_sha256 4 - # define OPENSSL_malloc_locked(num) \ -- CRYPTO_malloc_locked((int)num,__FILE__,__LINE__) -+ CRYPTO_malloc_locked((int)num,NULL,0) - # define OPENSSL_free_locked(addr) CRYPTO_free_locked(addr) +@@ -330,3 +331,4 @@ static int i2r_SCT_LIST(X509V3_EXT_METHOD *method, STACK_OF(SCT) *sct_list, - const char *SSLeay_version(int type); -@@ -545,7 +545,7 @@ - long CRYPTO_get_mem_debug_options(void); + return 1; + } ++#endif +diff --git a/crypto/x509v3/x509v3.h b/crypto/x509v3/x509v3.h +index f5c6156..a2e78aa 100644 +--- a/crypto/x509v3/x509v3.h ++++ b/crypto/x509v3/x509v3.h +@@ -688,8 +688,9 @@ void X509V3_EXT_val_prn(BIO *out, STACK_OF(CONF_VALUE) *val, int indent, + int ml); + int X509V3_EXT_print(BIO *out, X509_EXTENSION *ext, unsigned long flag, + int indent); ++#ifndef OPENSSL_NO_FP_API + int X509V3_EXT_print_fp(FILE *out, X509_EXTENSION *ext, int flag, int indent); +- ++#endif + int X509V3_extensions_print(BIO *out, char *title, + STACK_OF(X509_EXTENSION) *exts, + unsigned long flag, int indent); +diff --git a/demos/engines/cluster_labs/hw_cluster_labs_err.h b/demos/engines/cluster_labs/hw_cluster_labs_err.h +index 3300e11..e9e58d5 100644 +--- a/demos/engines/cluster_labs/hw_cluster_labs_err.h ++++ b/demos/engines/cluster_labs/hw_cluster_labs_err.h +@@ -67,7 +67,7 @@ extern "C" { + static void ERR_load_CL_strings(void); + static void ERR_unload_CL_strings(void); + static void ERR_CL_error(int function, int reason, char *file, int line); +-# define CLerr(f,r) ERR_CL_error((f),(r),__FILE__,__LINE__) ++# define CLerr(f,r) ERR_CL_error((f),(r),OPENSSL_FILE,OPENSSL_LINE) - # define CRYPTO_push_info(info) \ -- CRYPTO_push_info_(info, __FILE__, __LINE__); -+ CRYPTO_push_info_(info, NULL, 0); - int CRYPTO_push_info_(const char *info, const char *file, int line); - int CRYPTO_pop_info(void); - int CRYPTO_remove_all_info(void); -@@ -588,7 +588,7 @@ + /* Error codes for the CL functions. */ - /* die if we have to */ - void OpenSSLDie(const char *file, int line, const char *assertion); --# define OPENSSL_assert(e) (void)((e) ? 0 : (OpenSSLDie(__FILE__, __LINE__, #e),1)) -+# define OPENSSL_assert(e) (void)((e) ? 0 : (OpenSSLDie(NULL, 0, #e),1)) +diff --git a/demos/engines/ibmca/hw_ibmca_err.h b/demos/engines/ibmca/hw_ibmca_err.h +index c17e0c9..10d0212 100644 +--- a/demos/engines/ibmca/hw_ibmca_err.h ++++ b/demos/engines/ibmca/hw_ibmca_err.h +@@ -67,7 +67,7 @@ extern "C" { + static void ERR_load_IBMCA_strings(void); + static void ERR_unload_IBMCA_strings(void); + static void ERR_IBMCA_error(int function, int reason, char *file, int line); +-# define IBMCAerr(f,r) ERR_IBMCA_error((f),(r),__FILE__,__LINE__) ++# define IBMCAerr(f,r) ERR_IBMCA_error((f),(r),OPENSSL_FILE,OPENSSL_LINE) - unsigned long *OPENSSL_ia32cap_loc(void); - # define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc())) -@@ -605,14 +605,14 @@ - # define fips_md_init_ctx(alg, cx) \ - int alg##_Init(cx##_CTX *c) \ - { \ -- if (FIPS_mode()) OpenSSLDie(__FILE__, __LINE__, \ -+ if (FIPS_mode()) OpenSSLDie(NULL, 0, \ - "Low level API call to digest " #alg " forbidden in FIPS mode!"); \ - return private_##alg##_Init(c); \ - } \ - int private_##alg##_Init(cx##_CTX *c) + /* Error codes for the IBMCA functions. */ - # define fips_cipher_abort(alg) \ -- if (FIPS_mode()) OpenSSLDie(__FILE__, __LINE__, \ -+ if (FIPS_mode()) OpenSSLDie(NULL, 0, \ - "Low level API call to cipher " #alg " forbidden in FIPS mode!") +diff --git a/demos/engines/rsaref/rsaref_err.h b/demos/engines/rsaref/rsaref_err.h +index 4356815..598836f 100644 +--- a/demos/engines/rsaref/rsaref_err.h ++++ b/demos/engines/rsaref/rsaref_err.h +@@ -68,7 +68,7 @@ extern "C" { + static void ERR_load_RSAREF_strings(void); + static void ERR_unload_RSAREF_strings(void); + static void ERR_RSAREF_error(int function, int reason, char *file, int line); +-# define RSAREFerr(f,r) ERR_RSAREF_error((f),(r),__FILE__,__LINE__) ++# define RSAREFerr(f,r) ERR_RSAREF_error((f),(r),OPENSSL_FILE,OPENSSL_LINE) + /* Error codes for the RSAREF functions. */ - # else ---- e_os.h -+++ e_os.h + /* Function codes. */ +diff --git a/demos/engines/zencod/hw_zencod_err.h b/demos/engines/zencod/hw_zencod_err.h +index f4a8358..94d3293 100644 +--- a/demos/engines/zencod/hw_zencod_err.h ++++ b/demos/engines/zencod/hw_zencod_err.h +@@ -67,7 +67,7 @@ extern "C" { + static void ERR_load_ZENCOD_strings(void); + static void ERR_unload_ZENCOD_strings(void); + static void ERR_ZENCOD_error(int function, int reason, char *file, int line); +-# define ZENCODerr(f,r) ERR_ZENCOD_error((f),(r),__FILE__,__LINE__) ++# define ZENCODerr(f,r) ERR_ZENCOD_error((f),(r),OPENSSL_FILE,OPENSSL_LINE) + + /* Error codes for the ZENCOD functions. */ + +diff --git a/doc/crypto/X509_VERIFY_PARAM_set_flags.pod b/doc/crypto/X509_VERIFY_PARAM_set_flags.pod +index 44792f9..7f95d58 100644 +--- a/doc/crypto/X509_VERIFY_PARAM_set_flags.pod ++++ b/doc/crypto/X509_VERIFY_PARAM_set_flags.pod +@@ -203,6 +203,10 @@ chain found is not trusted, then OpenSSL will continue to check to see if an + alternative chain can be found that is trusted. With this flag set the behaviour + will match that of OpenSSL versions prior to 1.0.2b. + ++The B<X509_V_FLAG_NO_CHECK_TIME> flag suppresses checking the validity period ++of certificates and CRLs against the current time. If X509_VERIFY_PARAM_set_time() ++is used to specify a verification time, the check is not suppressed. ++ + =head1 NOTES + + The above functions should be used to manipulate verification parameters +diff --git a/doc/crypto/threads.pod b/doc/crypto/threads.pod +index dc0e939..fe123bb 100644 +--- a/doc/crypto/threads.pod ++++ b/doc/crypto/threads.pod +@@ -51,15 +51,15 @@ CRYPTO_destroy_dynlockid, CRYPTO_lock - OpenSSL thread support + void CRYPTO_lock(int mode, int n, const char *file, int line); + + #define CRYPTO_w_lock(type) \ +- CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__) ++ CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,OPENSSL_FILE,OPENSSL_LINE) + #define CRYPTO_w_unlock(type) \ +- CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__) ++ CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,OPENSSL_FILE,OPENSSL_LINE) + #define CRYPTO_r_lock(type) \ +- CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__) ++ CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,OPENSSL_FILE,OPENSSL_LINE) + #define CRYPTO_r_unlock(type) \ +- CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__) ++ CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,OPENSSL_FILE,OPENSSL_LINE) + #define CRYPTO_add(addr,amount,type) \ +- CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__) ++ CRYPTO_add_lock(addr,amount,type,OPENSSL_FILE,OPENSSL_LINE) + + =head1 DESCRIPTION + +diff --git a/e_os.h b/e_os.h +index 45fef69..1749ee0 100644 +--- a/e_os.h ++++ b/e_os.h @@ -136,7 +136,7 @@ extern "C" { # define MSDOS # endif @@ -352,8 +1866,10 @@ diff U3 crypto/crypto.h crypto/crypto.h # define GETPID_IS_MEANINGLESS # endif ---- e_os2.h 2015-07-09 12:57:15.000000000 +0100 -+++ e_os2.h 2015-08-12 09:27:56.044693680 +0100 +diff --git a/e_os2.h b/e_os2.h +index 7be9989..909e22f 100644 +--- a/e_os2.h ++++ b/e_os2.h @@ -97,7 +97,14 @@ extern "C" { * For 32 bit environment, there seems to be the CygWin environment and then * all the others that try to do the same thing Microsoft does... @@ -370,3 +1886,358 @@ diff U3 crypto/crypto.h crypto/crypto.h # undef OPENSSL_SYS_UNIX # define OPENSSL_SYS_WIN32_UWIN # else +diff --git a/engines/ccgost/e_gost_err.h b/engines/ccgost/e_gost_err.h +index a2018ec..9eacdcf 100644 +--- a/engines/ccgost/e_gost_err.h ++++ b/engines/ccgost/e_gost_err.h +@@ -67,7 +67,7 @@ extern "C" { + void ERR_load_GOST_strings(void); + void ERR_unload_GOST_strings(void); + void ERR_GOST_error(int function, int reason, char *file, int line); +-# define GOSTerr(f,r) ERR_GOST_error((f),(r),__FILE__,__LINE__) ++# define GOSTerr(f,r) ERR_GOST_error((f),(r),OPENSSL_FILE,OPENSSL_LINE) + + /* Error codes for the GOST functions. */ + +diff --git a/engines/e_4758cca_err.h b/engines/e_4758cca_err.h +index 2f29d96..47a2635 100644 +--- a/engines/e_4758cca_err.h ++++ b/engines/e_4758cca_err.h +@@ -67,7 +67,7 @@ extern "C" { + static void ERR_load_CCA4758_strings(void); + static void ERR_unload_CCA4758_strings(void); + static void ERR_CCA4758_error(int function, int reason, char *file, int line); +-# define CCA4758err(f,r) ERR_CCA4758_error((f),(r),__FILE__,__LINE__) ++# define CCA4758err(f,r) ERR_CCA4758_error((f),(r),OPENSSL_FILE,OPENSSL_LINE) + + /* Error codes for the CCA4758 functions. */ + +diff --git a/engines/e_aep_err.h b/engines/e_aep_err.h +index 2ed0114..1f8fa5b 100644 +--- a/engines/e_aep_err.h ++++ b/engines/e_aep_err.h +@@ -67,7 +67,7 @@ extern "C" { + static void ERR_load_AEPHK_strings(void); + static void ERR_unload_AEPHK_strings(void); + static void ERR_AEPHK_error(int function, int reason, char *file, int line); +-# define AEPHKerr(f,r) ERR_AEPHK_error((f),(r),__FILE__,__LINE__) ++# define AEPHKerr(f,r) ERR_AEPHK_error((f),(r),OPENSSL_FILE,OPENSSL_LINE) + + /* Error codes for the AEPHK functions. */ + +diff --git a/engines/e_atalla_err.h b/engines/e_atalla_err.h +index 7b71eff..d958496 100644 +--- a/engines/e_atalla_err.h ++++ b/engines/e_atalla_err.h +@@ -67,7 +67,7 @@ extern "C" { + static void ERR_load_ATALLA_strings(void); + static void ERR_unload_ATALLA_strings(void); + static void ERR_ATALLA_error(int function, int reason, char *file, int line); +-# define ATALLAerr(f,r) ERR_ATALLA_error((f),(r),__FILE__,__LINE__) ++# define ATALLAerr(f,r) ERR_ATALLA_error((f),(r),OPENSSL_FILE,OPENSSL_LINE) + + /* Error codes for the ATALLA functions. */ + +diff --git a/engines/e_capi_err.h b/engines/e_capi_err.h +index b5d06dc..cfe46b1 100644 +--- a/engines/e_capi_err.h ++++ b/engines/e_capi_err.h +@@ -67,7 +67,7 @@ extern "C" { + static void ERR_load_CAPI_strings(void); + static void ERR_unload_CAPI_strings(void); + static void ERR_CAPI_error(int function, int reason, char *file, int line); +-# define CAPIerr(f,r) ERR_CAPI_error((f),(r),__FILE__,__LINE__) ++# define CAPIerr(f,r) ERR_CAPI_error((f),(r),OPENSSL_FILE,OPENSSL_LINE) + + /* Error codes for the CAPI functions. */ + +diff --git a/engines/e_chil_err.h b/engines/e_chil_err.h +index d86a4ce..3d961b9 100644 +--- a/engines/e_chil_err.h ++++ b/engines/e_chil_err.h +@@ -67,7 +67,7 @@ extern "C" { + static void ERR_load_HWCRHK_strings(void); + static void ERR_unload_HWCRHK_strings(void); + static void ERR_HWCRHK_error(int function, int reason, char *file, int line); +-# define HWCRHKerr(f,r) ERR_HWCRHK_error((f),(r),__FILE__,__LINE__) ++# define HWCRHKerr(f,r) ERR_HWCRHK_error((f),(r),OPENSSL_FILE,OPENSSL_LINE) + + /* Error codes for the HWCRHK functions. */ + +diff --git a/engines/e_cswift_err.h b/engines/e_cswift_err.h +index fde3a82..7c20691 100644 +--- a/engines/e_cswift_err.h ++++ b/engines/e_cswift_err.h +@@ -67,7 +67,7 @@ extern "C" { + static void ERR_load_CSWIFT_strings(void); + static void ERR_unload_CSWIFT_strings(void); + static void ERR_CSWIFT_error(int function, int reason, char *file, int line); +-# define CSWIFTerr(f,r) ERR_CSWIFT_error((f),(r),__FILE__,__LINE__) ++# define CSWIFTerr(f,r) ERR_CSWIFT_error((f),(r),OPENSSL_FILE,OPENSSL_LINE) + + /* Error codes for the CSWIFT functions. */ + +diff --git a/engines/e_gmp_err.h b/engines/e_gmp_err.h +index 637abbc..ccaf3da 100644 +--- a/engines/e_gmp_err.h ++++ b/engines/e_gmp_err.h +@@ -67,7 +67,7 @@ extern "C" { + static void ERR_load_GMP_strings(void); + static void ERR_unload_GMP_strings(void); + static void ERR_GMP_error(int function, int reason, char *file, int line); +-# define GMPerr(f,r) ERR_GMP_error((f),(r),__FILE__,__LINE__) ++# define GMPerr(f,r) ERR_GMP_error((f),(r),OPENSSL_FILE,OPENSSL_LINE) + + /* Error codes for the GMP functions. */ + +diff --git a/engines/e_nuron_err.h b/engines/e_nuron_err.h +index aa7849c..e607d3e 100644 +--- a/engines/e_nuron_err.h ++++ b/engines/e_nuron_err.h +@@ -67,7 +67,7 @@ extern "C" { + static void ERR_load_NURON_strings(void); + static void ERR_unload_NURON_strings(void); + static void ERR_NURON_error(int function, int reason, char *file, int line); +-# define NURONerr(f,r) ERR_NURON_error((f),(r),__FILE__,__LINE__) ++# define NURONerr(f,r) ERR_NURON_error((f),(r),OPENSSL_FILE,OPENSSL_LINE) + + /* Error codes for the NURON functions. */ + +diff --git a/engines/e_sureware_err.h b/engines/e_sureware_err.h +index bef8623..54f2848 100644 +--- a/engines/e_sureware_err.h ++++ b/engines/e_sureware_err.h +@@ -68,7 +68,7 @@ static void ERR_load_SUREWARE_strings(void); + static void ERR_unload_SUREWARE_strings(void); + static void ERR_SUREWARE_error(int function, int reason, char *file, + int line); +-# define SUREWAREerr(f,r) ERR_SUREWARE_error((f),(r),__FILE__,__LINE__) ++# define SUREWAREerr(f,r) ERR_SUREWARE_error((f),(r),OPENSSL_FILE,OPENSSL_LINE) + + /* Error codes for the SUREWARE functions. */ + +diff --git a/engines/e_ubsec_err.h b/engines/e_ubsec_err.h +index c8aec7c..67110ed 100644 +--- a/engines/e_ubsec_err.h ++++ b/engines/e_ubsec_err.h +@@ -67,7 +67,7 @@ extern "C" { + static void ERR_load_UBSEC_strings(void); + static void ERR_unload_UBSEC_strings(void); + static void ERR_UBSEC_error(int function, int reason, char *file, int line); +-# define UBSECerr(f,r) ERR_UBSEC_error((f),(r),__FILE__,__LINE__) ++# define UBSECerr(f,r) ERR_UBSEC_error((f),(r),OPENSSL_FILE,OPENSSL_LINE) + + /* Error codes for the UBSEC functions. */ + +diff --git a/makevms.com b/makevms.com +index f6b3ff2..1dcbe36 100755 +--- a/makevms.com ++++ b/makevms.com +@@ -293,6 +293,7 @@ $ CONFIG_LOGICALS := AES,- + RFC3779,- + RIPEMD,- + RSA,- ++ SCT,- + SCTP,- + SEED,- + SHA,- +diff --git a/ssl/d1_both.c b/ssl/d1_both.c +index b4ee7ab..32494dd 100644 +--- a/ssl/d1_both.c ++++ b/ssl/d1_both.c +@@ -1025,7 +1025,7 @@ int dtls1_send_change_cipher_spec(SSL *s, int a, int b) + int dtls1_read_failed(SSL *s, int code) + { + if (code > 0) { +- fprintf(stderr, "invalid state reached %s:%d", __FILE__, __LINE__); ++ fprintf(stderr, "dtls1_read_failed(); invalid state reached\n"); + return 1; + } + +diff --git a/ssl/ssl_asn1.c b/ssl/ssl_asn1.c +index 39d48ea..a97b3dd 100644 +--- a/ssl/ssl_asn1.c ++++ b/ssl/ssl_asn1.c +@@ -415,7 +415,7 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, + if (ssl_version == SSL2_VERSION) { + if (os.length != 3) { + c.error = SSL_R_CIPHER_CODE_WRONG_LENGTH; +- c.line = __LINE__; ++ c.line = OPENSSL_LINE; + goto err; + } + id = 0x02000000L | +@@ -426,14 +426,14 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, + || ssl_version == DTLS1_BAD_VER) { + if (os.length != 2) { + c.error = SSL_R_CIPHER_CODE_WRONG_LENGTH; +- c.line = __LINE__; ++ c.line = OPENSSL_LINE; + goto err; + } + id = 0x03000000L | + ((unsigned long)os.data[0] << 8L) | (unsigned long)os.data[1]; + } else { + c.error = SSL_R_UNKNOWN_SSL_VERSION; +- c.line = __LINE__; ++ c.line = OPENSSL_LINE; + goto err; + } + +@@ -523,7 +523,7 @@ SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, + if (os.data != NULL) { + if (os.length > SSL_MAX_SID_CTX_LENGTH) { + c.error = SSL_R_BAD_LENGTH; +- c.line = __LINE__; ++ c.line = OPENSSL_LINE; + goto err; + } else { + ret->sid_ctx_length = os.length; +diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c +index 93a1eb9..9b57324 100644 +--- a/ssl/ssl_cert.c ++++ b/ssl/ssl_cert.c +@@ -855,12 +855,13 @@ int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *x) + return (add_client_CA(&(ctx->client_CA), x)); + } + ++#ifndef OPENSSL_NO_STDIO ++ + static int xname_cmp(const X509_NAME *const *a, const X509_NAME *const *b) + { + return (X509_NAME_cmp(*a, *b)); + } + +-#ifndef OPENSSL_NO_STDIO + /** + * Load CA certs from a file into a ::STACK. Note that it is somewhat misnamed; + * it doesn't really have anything to do with clients (except that a common use +@@ -928,7 +929,6 @@ STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file) + ERR_clear_error(); + return (ret); + } +-#endif + + /** + * Add a file of certs to a stack. +@@ -1048,6 +1048,7 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, + CRYPTO_w_unlock(CRYPTO_LOCK_READDIR); + return ret; + } ++#endif /* !OPENSSL_NO_STDIO */ + + /* Add a certificate to a BUF_MEM structure */ + +diff --git a/ssl/ssl_conf.c b/ssl/ssl_conf.c +index 5478840..c2ad7c9 100644 +--- a/ssl/ssl_conf.c ++++ b/ssl/ssl_conf.c +@@ -362,6 +362,7 @@ static int cmd_Options(SSL_CONF_CTX *cctx, const char *value) + return CONF_parse_list(value, ',', 1, ssl_set_option_list, cctx); + } + ++#ifndef OPENSSL_NO_STDIO + static int cmd_Certificate(SSL_CONF_CTX *cctx, const char *value) + { + int rv = 1; +@@ -428,7 +429,9 @@ static int cmd_DHParameters(SSL_CONF_CTX *cctx, const char *value) + BIO_free(in); + return rv > 0; + } +-#endif ++#endif /* !OPENSSL_NO_DH */ ++#endif /* !OPENSSL_NO_STDIO */ ++ + typedef struct { + int (*cmd) (SSL_CONF_CTX *cctx, const char *value); + const char *str_file; +@@ -454,12 +457,14 @@ static const ssl_conf_cmd_tbl ssl_conf_cmds[] = { + SSL_CONF_CMD_STRING(CipherString, "cipher"), + SSL_CONF_CMD_STRING(Protocol, NULL), + SSL_CONF_CMD_STRING(Options, NULL), ++#ifndef OPENSSL_NO_STDIO + SSL_CONF_CMD(Certificate, "cert", SSL_CONF_TYPE_FILE), + SSL_CONF_CMD(PrivateKey, "key", SSL_CONF_TYPE_FILE), + SSL_CONF_CMD(ServerInfoFile, NULL, SSL_CONF_TYPE_FILE), + #ifndef OPENSSL_NO_DH + SSL_CONF_CMD(DHParameters, "dhparam", SSL_CONF_TYPE_FILE) + #endif ++#endif + }; + + static int ssl_conf_cmd_skip_prefix(SSL_CONF_CTX *cctx, const char **pcmd) +diff --git a/ssl/t1_enc.c b/ssl/t1_enc.c +index e2a8f86..e5e8567 100644 +--- a/ssl/t1_enc.c ++++ b/ssl/t1_enc.c +@@ -770,9 +770,7 @@ int tls1_enc(SSL *s, int send) + * we can't write into the input stream: Can this ever + * happen?? (steve) + */ +- fprintf(stderr, +- "%s:%d: rec->data != rec->input\n", +- __FILE__, __LINE__); ++ fprintf(stderr, "tls1_enc: rec->data != rec->input\n"); + else if (RAND_bytes(rec->input, ivlen) <= 0) + return -1; + } +diff --git a/util/mkdef.pl b/util/mkdef.pl +index c57c7f7..d4c3386 100755 +--- a/util/mkdef.pl ++++ b/util/mkdef.pl +@@ -97,6 +97,8 @@ my @known_algorithms = ( "RC2", "RC4", "RC5", "IDEA", "DES", "BF", + "FP_API", "STDIO", "SOCK", "KRB5", "DGRAM", + # Engines + "STATIC_ENGINE", "ENGINE", "HW", "GMP", ++ # X.509v3 Signed Certificate Timestamps ++ "SCT", + # RFC3779 + "RFC3779", + # TLS +@@ -142,7 +144,7 @@ my $no_md2; my $no_md4; my $no_md5; my $no_sha; my $no_ripemd; my $no_mdc2; + my $no_rsa; my $no_dsa; my $no_dh; my $no_hmac=0; my $no_aes; my $no_krb5; + my $no_ec; my $no_ecdsa; my $no_ecdh; my $no_engine; my $no_hw; + my $no_fp_api; my $no_static_engine=1; my $no_gmp; my $no_deprecated; +-my $no_rfc3779; my $no_psk; my $no_tlsext; my $no_cms; my $no_capieng; ++my $no_sct; my $no_rfc3779; my $no_psk; my $no_tlsext; my $no_cms; my $no_capieng; + my $no_jpake; my $no_srp; my $no_ssl2; my $no_ec2m; my $no_nistp_gcc; + my $no_nextprotoneg; my $no_sctp; my $no_srtp; my $no_ssl_trace; + my $no_unit_test; my $no_ssl3_method; +@@ -233,6 +235,7 @@ foreach (@ARGV, split(/ /, $options)) + elsif (/^no-engine$/) { $no_engine=1; } + elsif (/^no-hw$/) { $no_hw=1; } + elsif (/^no-gmp$/) { $no_gmp=1; } ++ elsif (/^no-sct$/) { $no_sct=1; } + elsif (/^no-rfc3779$/) { $no_rfc3779=1; } + elsif (/^no-tlsext$/) { $no_tlsext=1; } + elsif (/^no-cms$/) { $no_cms=1; } +@@ -1206,6 +1209,7 @@ sub is_valid + if ($keyword eq "FP_API" && $no_fp_api) { return 0; } + if ($keyword eq "STATIC_ENGINE" && $no_static_engine) { return 0; } + if ($keyword eq "GMP" && $no_gmp) { return 0; } ++ if ($keyword eq "SCT" && $no_sct) { return 0; } + if ($keyword eq "RFC3779" && $no_rfc3779) { return 0; } + if ($keyword eq "TLSEXT" && $no_tlsext) { return 0; } + if ($keyword eq "PSK" && $no_psk) { return 0; } +diff --git a/util/mkerr.pl b/util/mkerr.pl +index 09ebebe..cd57ade 100644 +--- a/util/mkerr.pl ++++ b/util/mkerr.pl +@@ -89,7 +89,7 @@ Options: + void ERR_load_<LIB>_strings(void); + void ERR_unload_<LIB>_strings(void); + void ERR_<LIB>_error(int f, int r, char *fn, int ln); +- #define <LIB>err(f,r) ERR_<LIB>_error(f,r,__FILE__,__LINE__) ++ #define <LIB>err(f,r) ERR_<LIB>_error(f,r,OPENSSL_FILE,OPENSSL_LINE) + while the code facilitates the use of these in an environment + where the error support routines are dynamically loaded at + runtime. +@@ -474,7 +474,7 @@ EOF + ${staticloader}void ERR_load_${lib}_strings(void); + ${staticloader}void ERR_unload_${lib}_strings(void); + ${staticloader}void ERR_${lib}_error(int function, int reason, char *file, int line); +-# define ${lib}err(f,r) ERR_${lib}_error((f),(r),__FILE__,__LINE__) ++# define ${lib}err(f,r) ERR_${lib}_error((f),(r),OPENSSL_FILE,OPENSSL_LINE) + + EOF + } diff --git a/CryptoPkg/Library/OpensslLib/Patch-HOWTO.txt b/CryptoPkg/Library/OpensslLib/Patch-HOWTO.txt index 2cafae2..eba42b6 100644 --- a/CryptoPkg/Library/OpensslLib/Patch-HOWTO.txt +++ b/CryptoPkg/Library/OpensslLib/Patch-HOWTO.txt @@ -51,7 +51,7 @@ cryptography. This patch will enable openssl building under UEFI environment. Install Cygwin or get the patch utility binary from http://gnuwin32.sourceforge.net/packages/patch.htm 2) cd $(WORKSPACE)\CryptoPkg\Library\OpensslLib\openssl-1.0.2d - 3) patch -p0 -i ..\EDKII_openssl-1.0.2d.patch + 3) patch -p1 -i ..\EDKII_openssl-1.0.2d.patch 4) copy ..\opensslconf.h crypto 5) cd .. 6) Install.cmd @@ -61,5 +61,5 @@ cryptography. This patch will enable openssl building under UEFI environment. 1) Make sure the patch utility has been installed in your machine. Patch utility is available from http://directory.fsf.org/project/patch/ 2) cd $(WORKSPACE)/CryptoPkg/Library/OpensslLib/openssl-1.0.2d - 3) patch -p0 -i ../EDKII_openssl-1.0.2d.patch + 3) patch -p1 -i ../EDKII_openssl-1.0.2d.patch 4) cp ../opensslconf.h crypto -- 2.4.3 -- David Woodhouse Open Source Technology Centre [email protected] Intel Corporation
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

