1diff U3 crypto/bio/bio.h crypto/bio/bio.h
2--- crypto/bio/bio.h	Thu Jun 11 21:50:12 2015
3+++ crypto/bio/bio.h	Fri Jun 12 11:00:52 2015
4@@ -646,10 +646,10 @@
5 int BIO_asn1_get_suffix(BIO *b, asn1_ps_func **psuffix,
6                         asn1_ps_func **psuffix_free);
7
8-# ifndef OPENSSL_NO_FP_API
9 BIO_METHOD *BIO_s_file(void);
10 BIO *BIO_new_file(const char *filename, const char *mode);
11 BIO *BIO_new_fp(FILE *stream, int close_flag);
12+# ifndef OPENSSL_NO_FP_API
13 #  define BIO_s_file_internal    BIO_s_file
14 # endif
15 BIO *BIO_new(BIO_METHOD *type);
16diff U3 crypto/bio/bss_file.c crypto/bio/bss_file.c
17--- crypto/bio/bss_file.c	Thu Jun 11 21:01:06 2015
18+++ crypto/bio/bss_file.c	Fri Jun 12 11:01:28 2015
19@@ -467,6 +467,23 @@
20     return (ret);
21 }
22
23+# else
24+
25+BIO_METHOD *BIO_s_file(void)
26+{
27+    return NULL;
28+}
29+
30+BIO *BIO_new_file(const char *filename, const char *mode)
31+{
32+    return NULL;
33+}
34+
35+BIO *BIO_new_fp(FILE *stream, int close_flag)
36+{
37+    return NULL;
38+}
39+
40 # endif                         /* OPENSSL_NO_STDIO */
41
42 #endif                          /* HEADER_BSS_FILE_C */
43diff U3 crypto/dh/dh_pmeth.c crypto/dh/dh_pmeth.c
44--- crypto/dh/dh_pmeth.c	Thu Jun 11 21:50:12 2015
45+++ crypto/dh/dh_pmeth.c	Fri Jun 12 11:08:48 2015
46@@ -449,6 +449,9 @@
47         *keylen = ret;
48         return 1;
49     } else if (dctx->kdf_type == EVP_PKEY_DH_KDF_X9_42) {
50+#ifdef OPENSSL_NO_CMS
51+        return 0;
52+#else
53         unsigned char *Z = NULL;
54         size_t Zlen = 0;
55         if (!dctx->kdf_outlen || !dctx->kdf_oid)
56@@ -478,6 +481,7 @@
57             OPENSSL_free(Z);
58         }
59         return ret;
60+#endif
61     }
62     return 1;
63 }
64diff U3 crypto/pem/pem.h crypto/pem/pem.h
65--- crypto/pem/pem.h	Thu Jun 11 21:50:12 2015
66+++ crypto/pem/pem.h	Fri Jun 12 10:58:18 2015
67@@ -324,6 +324,7 @@
68
69 #  define DECLARE_PEM_read_fp(name, type) /**/
70 #  define DECLARE_PEM_write_fp(name, type) /**/
71+#  define DECLARE_PEM_write_fp_const(name, type) /**/
72 #  define DECLARE_PEM_write_cb_fp(name, type) /**/
73 # else
74
75diff U3 crypto/pkcs7/pk7_smime.c crypto/pkcs7/pk7_smime.c
76--- crypto/pkcs7/pk7_smime.c	Thu Jun 11 21:01:06 2015
77+++ crypto/pkcs7/pk7_smime.c	Fri Jun 12 11:23:38 2015
78@@ -254,7 +254,8 @@
79     STACK_OF(PKCS7_SIGNER_INFO) *sinfos;
80     PKCS7_SIGNER_INFO *si;
81     X509_STORE_CTX cert_ctx;
82-    char buf[4096];
83+    char *buf = NULL;
84+    int bufsiz;
85     int i, j = 0, k, ret = 0;
86     BIO *p7bio = NULL;
87     BIO *tmpin = NULL, *tmpout = NULL;
88@@ -275,12 +276,6 @@
89         return 0;
90     }
91
92-    /* Check for data and content: two sets of data */
93-    if (!PKCS7_get_detached(p7) && indata) {
94-        PKCS7err(PKCS7_F_PKCS7_VERIFY, PKCS7_R_CONTENT_AND_DATA_PRESENT);
95-        return 0;
96-    }
97-
98     sinfos = PKCS7_get_signer_info(p7);
99
100     if (!sinfos || !sk_PKCS7_SIGNER_INFO_num(sinfos)) {
101@@ -355,9 +350,14 @@
102     } else
103         tmpout = out;
104
105+    bufsiz = 4096;
106+    buf = OPENSSL_malloc(bufsiz);
107+    if (buf == NULL) {
108+        goto err;
109+    }
110     /* We now have to 'read' from p7bio to calculate digests etc. */
111     for (;;) {
112-        i = BIO_read(p7bio, buf, sizeof(buf));
113+        i = BIO_read(p7bio, buf, bufsiz);
114         if (i <= 0)
115             break;
116         if (tmpout)
117@@ -394,6 +394,10 @@
118     }
119     BIO_free_all(p7bio);
120     sk_X509_free(signers);
121+
122+    if (buf != NULL) {
123+      OPENSSL_free(buf);
124+    }
125     return ret;
126 }
127
128diff U3 crypto/rand/rand_unix.c crypto/rand/rand_unix.c
129--- crypto/rand/rand_unix.c	Thu Jun 11 21:01:06 2015
130+++ crypto/rand/rand_unix.c	Fri Jun 12 10:51:21 2015
131@@ -116,7 +116,7 @@
132 #include <openssl/rand.h>
133 #include "rand_lcl.h"
134
135-#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))
136+#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))
137
138 # include <sys/types.h>
139 # include <sys/time.h>
140@@ -439,7 +439,7 @@
141                                  * defined(OPENSSL_SYS_VXWORKS) ||
142                                  * defined(OPENSSL_SYS_NETWARE)) */
143
144-#if defined(OPENSSL_SYS_VXWORKS)
145+#if defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_UEFI)
146 int RAND_poll(void)
147 {
148     return 0;
149diff U3 crypto/rsa/rsa_ameth.c crypto/rsa/rsa_ameth.c
150--- crypto/rsa/rsa_ameth.c	Thu Jun 11 21:50:12 2015
151+++ crypto/rsa/rsa_ameth.c	Fri Jun 12 10:45:38 2015
152@@ -68,10 +68,12 @@
153 #endif
154 #include "asn1_locl.h"
155
156+#ifndef OPENSSL_NO_CMS
157 static int rsa_cms_sign(CMS_SignerInfo *si);
158 static int rsa_cms_verify(CMS_SignerInfo *si);
159 static int rsa_cms_decrypt(CMS_RecipientInfo *ri);
160 static int rsa_cms_encrypt(CMS_RecipientInfo *ri);
161+#endif
162
163 static int rsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
164 {
165@@ -665,6 +667,7 @@
166     return rv;
167 }
168
169+#ifndef OPENSSL_NO_CMS
170 static int rsa_cms_verify(CMS_SignerInfo *si)
171 {
172     int nid, nid2;
173@@ -683,6 +686,7 @@
174     }
175     return 0;
176 }
177+#endif
178
179 /*
180  * Customised RSA item verification routine. This is called when a signature
181@@ -705,6 +709,7 @@
182     return -1;
183 }
184
185+#ifndef OPENSSL_NO_CMS
186 static int rsa_cms_sign(CMS_SignerInfo *si)
187 {
188     int pad_mode = RSA_PKCS1_PADDING;
189@@ -729,6 +734,7 @@
190     X509_ALGOR_set0(alg, OBJ_nid2obj(NID_rsassaPss), V_ASN1_SEQUENCE, os);
191     return 1;
192 }
193+#endif
194
195 static int rsa_item_sign(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
196                          X509_ALGOR *alg1, X509_ALGOR *alg2,
197@@ -785,6 +791,7 @@
198     return pss;
199 }
200
201+#ifndef OPENSSL_NO_CMS
202 static int rsa_cms_decrypt(CMS_RecipientInfo *ri)
203 {
204     EVP_PKEY_CTX *pkctx;
205@@ -857,7 +864,9 @@
206         X509_ALGOR_free(maskHash);
207     return rv;
208 }
209+#endif
210
211+#ifndef OPENSSL_NO_CMS
212 static int rsa_cms_encrypt(CMS_RecipientInfo *ri)
213 {
214     const EVP_MD *md, *mgf1md;
215@@ -920,6 +929,7 @@
216         ASN1_STRING_free(os);
217     return rv;
218 }
219+#endif
220
221 const EVP_PKEY_ASN1_METHOD rsa_asn1_meths[] = {
222     {
223diff U3 crypto/x509/x509_vfy.c crypto/x509/x509_vfy.c
224--- crypto/x509/x509_vfy.c	Thu Jun 11 21:52:58 2015
225+++ crypto/x509/x509_vfy.c	Fri Jun 12 11:29:37 2015
226@@ -940,6 +940,8 @@
227         ctx->current_crl = crl;
228     if (ctx->param->flags & X509_V_FLAG_USE_CHECK_TIME)
229         ptime = &ctx->param->check_time;
230+    else if (ctx->param->flags & X509_V_FLAG_NO_CHECK_TIME)
231+        return 1;
232     else
233         ptime = NULL;
234
235@@ -1663,6 +1665,8 @@
236
237     if (ctx->param->flags & X509_V_FLAG_USE_CHECK_TIME)
238         ptime = &ctx->param->check_time;
239+    else if (ctx->param->flags & X509_V_FLAG_NO_CHECK_TIME)
240+        return 1;
241     else
242         ptime = NULL;
243
244diff U3 crypto/x509/x509_vfy.h crypto/x509/x509_vfy.h
245--- crypto/x509/x509_vfy.h	Thu Jul 09 19:57:16 2015
246+++ crypto/x509/x509_vfy.h	Thu Oct 29 14:05:57 2015
247@@ -438,6 +438,8 @@
248  * will force the behaviour to match that of previous versions.
249  */
250 # define X509_V_FLAG_NO_ALT_CHAINS               0x100000
251+/* Do not check certificate/CRL validity against current time */
252+# define X509_V_FLAG_NO_CHECK_TIME               0x200000
253
254 # define X509_VP_FLAG_DEFAULT                    0x1
255 # define X509_VP_FLAG_OVERWRITE                  0x2
256diff U3 crypto/x509v3/ext_dat.h crypto/x509v3/ext_dat.h
257--- crypto/x509v3/ext_dat.h	Thu Jun 11 21:50:12 2015
258+++ crypto/x509v3/ext_dat.h	Fri Jun 12 11:11:03 2015
259@@ -127,8 +127,10 @@
260     &v3_idp,
261     &v3_alt[2],
262     &v3_freshest_crl,
263+#ifndef OPENSSL_SYS_UEFI
264     &v3_ct_scts[0],
265     &v3_ct_scts[1],
266+#endif
267 };
268
269 /* Number of standard extensions */
270diff U3 crypto/crypto.h crypto/crypto.h
271--- crypto/crypto.h	Thu Jun 11 21:01:06 2015
272+++ crypto/crypto.h	Fri Jun 12 11:33:27 2015
273@@ -235,15 +235,15 @@
274 # ifndef OPENSSL_NO_LOCKING
275 #  ifndef CRYPTO_w_lock
276 #   define CRYPTO_w_lock(type)     \
277-        CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
278+        CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,NULL,0)
279 #   define CRYPTO_w_unlock(type)   \
280-        CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
281+        CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,NULL,0)
282 #   define CRYPTO_r_lock(type)     \
283-        CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__)
284+        CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,NULL,0)
285 #   define CRYPTO_r_unlock(type)   \
286-        CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__)
287+        CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,NULL,0)
288 #   define CRYPTO_add(addr,amount,type)    \
289-        CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__)
290+        CRYPTO_add_lock(addr,amount,type,NULL,0)
291 #  endif
292 # else
293 #  define CRYPTO_w_lock(a)
294@@ -378,19 +378,19 @@
295 # define MemCheck_off()  CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE)
296 # define is_MemCheck_on() CRYPTO_is_mem_check_on()
297
298-# define OPENSSL_malloc(num)     CRYPTO_malloc((int)num,__FILE__,__LINE__)
299-# define OPENSSL_strdup(str)     CRYPTO_strdup((str),__FILE__,__LINE__)
300+# define OPENSSL_malloc(num)     CRYPTO_malloc((int)num,NULL,0)
301+# define OPENSSL_strdup(str)     CRYPTO_strdup((str),NULL,0)
302 # define OPENSSL_realloc(addr,num) \
303-        CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__)
304+        CRYPTO_realloc((char *)addr,(int)num,NULL,0)
305 # define OPENSSL_realloc_clean(addr,old_num,num) \
306-        CRYPTO_realloc_clean(addr,old_num,num,__FILE__,__LINE__)
307+        CRYPTO_realloc_clean(addr,old_num,num,NULL,0)
308 # define OPENSSL_remalloc(addr,num) \
309-        CRYPTO_remalloc((char **)addr,(int)num,__FILE__,__LINE__)
310+        CRYPTO_remalloc((char **)addr,(int)num,NULL,0)
311 # define OPENSSL_freeFunc        CRYPTO_free
312 # define OPENSSL_free(addr)      CRYPTO_free(addr)
313
314 # define OPENSSL_malloc_locked(num) \
315-        CRYPTO_malloc_locked((int)num,__FILE__,__LINE__)
316+        CRYPTO_malloc_locked((int)num,NULL,0)
317 # define OPENSSL_free_locked(addr) CRYPTO_free_locked(addr)
318
319 const char *SSLeay_version(int type);
320@@ -545,7 +545,7 @@
321 long CRYPTO_get_mem_debug_options(void);
322
323 # define CRYPTO_push_info(info) \
324-        CRYPTO_push_info_(info, __FILE__, __LINE__);
325+        CRYPTO_push_info_(info, NULL, 0);
326 int CRYPTO_push_info_(const char *info, const char *file, int line);
327 int CRYPTO_pop_info(void);
328 int CRYPTO_remove_all_info(void);
329@@ -588,7 +588,7 @@
330
331 /* die if we have to */
332 void OpenSSLDie(const char *file, int line, const char *assertion);
333-# define OPENSSL_assert(e)       (void)((e) ? 0 : (OpenSSLDie(__FILE__, __LINE__, #e),1))
334+# define OPENSSL_assert(e)       (void)((e) ? 0 : (OpenSSLDie(NULL, 0, #e),1))
335
336 unsigned long *OPENSSL_ia32cap_loc(void);
337 # define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc()))
338@@ -605,14 +605,14 @@
339 #  define fips_md_init_ctx(alg, cx) \
340         int alg##_Init(cx##_CTX *c) \
341         { \
342-        if (FIPS_mode()) OpenSSLDie(__FILE__, __LINE__, \
343+        if (FIPS_mode()) OpenSSLDie(NULL, 0, \
344                 "Low level API call to digest " #alg " forbidden in FIPS mode!"); \
345         return private_##alg##_Init(c); \
346         } \
347         int private_##alg##_Init(cx##_CTX *c)
348
349 #  define fips_cipher_abort(alg) \
350-        if (FIPS_mode()) OpenSSLDie(__FILE__, __LINE__, \
351+        if (FIPS_mode()) OpenSSLDie(NULL, 0, \
352                 "Low level API call to cipher " #alg " forbidden in FIPS mode!")
353
354 # else
355diff U3 crypto/opensslconf.h crypto/opensslconf.h
356--- crypto/opensslconf.h	Thu Jun 11 21:55:38 2015
357+++ crypto/opensslconf.h	Fri Jun 12 10:28:27 2015
358@@ -5,15 +5,72 @@
359 extern "C" {
360 #endif
361 /* OpenSSL was configured with the following options: */
362+#ifndef OPENSSL_SYSNAME_UEFI
363+# define OPENSSL_SYSNAME_UEFI
364+#endif
365 #ifndef OPENSSL_DOING_MAKEDEPEND
366
367
368+#ifndef OPENSSL_NO_BF
369+# define OPENSSL_NO_BF
370+#endif
371+#ifndef OPENSSL_NO_CAMELLIA
372+# define OPENSSL_NO_CAMELLIA
373+#endif
374+#ifndef OPENSSL_NO_CAPIENG
375+# define OPENSSL_NO_CAPIENG
376+#endif
377+#ifndef OPENSSL_NO_CAST
378+# define OPENSSL_NO_CAST
379+#endif
380+#ifndef OPENSSL_NO_CMS
381+# define OPENSSL_NO_CMS
382+#endif
383+#ifndef OPENSSL_NO_DEPRECATED
384+# define OPENSSL_NO_DEPRECATED
385+#endif
386+#ifndef OPENSSL_NO_DGRAM
387+# define OPENSSL_NO_DGRAM
388+#endif
389+#ifndef OPENSSL_NO_DSA
390+# define OPENSSL_NO_DSA
391+#endif
392+#ifndef OPENSSL_NO_DYNAMIC_ENGINE
393+# define OPENSSL_NO_DYNAMIC_ENGINE
394+#endif
395+#ifndef OPENSSL_NO_EC
396+# define OPENSSL_NO_EC
397+#endif
398 #ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
399 # define OPENSSL_NO_EC_NISTP_64_GCC_128
400 #endif
401+#ifndef OPENSSL_NO_ECDH
402+# define OPENSSL_NO_ECDH
403+#endif
404+#ifndef OPENSSL_NO_ECDSA
405+# define OPENSSL_NO_ECDSA
406+#endif
407+#ifndef OPENSSL_NO_ENGINE
408+# define OPENSSL_NO_ENGINE
409+#endif
410+#ifndef OPENSSL_NO_ENGINES
411+# define OPENSSL_NO_ENGINES
412+#endif
413+#ifndef OPENSSL_NO_FILENAMES
414+# define OPENSSL_NO_FILENAMES
415+#endif
416+#ifndef OPENSSL_NO_FP_API
417+# define OPENSSL_NO_FP_API
418+#endif
419 #ifndef OPENSSL_NO_GMP
420 # define OPENSSL_NO_GMP
421 #endif
422+#ifndef OPENSSL_NO_GOST
423+# define OPENSSL_NO_GOST
424+#endif
425+#ifndef OPENSSL_NO_IDEA
426+# define OPENSSL_NO_IDEA
427+#endif
428 #ifndef OPENSSL_NO_JPAKE
429 # define OPENSSL_NO_JPAKE
430 #endif
431@@ -23,30 +80,90 @@
432 #ifndef OPENSSL_NO_LIBUNBOUND
433 # define OPENSSL_NO_LIBUNBOUND
434 #endif
435+#ifndef OPENSSL_NO_LOCKING
436+# define OPENSSL_NO_LOCKING
437+#endif
438 #ifndef OPENSSL_NO_MD2
439 # define OPENSSL_NO_MD2
440 #endif
441+#ifndef OPENSSL_NO_MDC2
442+# define OPENSSL_NO_MDC2
443+#endif
444+#ifndef OPENSSL_NO_POSIX_IO
445+# define OPENSSL_NO_POSIX_IO
446+#endif
447+#ifndef OPENSSL_NO_RC2
448+# define OPENSSL_NO_RC2
449+#endif
450 #ifndef OPENSSL_NO_RC5
451 # define OPENSSL_NO_RC5
452 #endif
453+#ifndef OPENSSL_NO_RCS
454+# define OPENSSL_NO_RCS
455+#endif
456 #ifndef OPENSSL_NO_RFC3779
457 # define OPENSSL_NO_RFC3779
458 #endif
459+#ifndef OPENSSL_NO_RIPEMD
460+# define OPENSSL_NO_RIPEMD
461+#endif
462+#ifndef OPENSSL_NO_SCRYPT
463+# define OPENSSL_NO_SCRYPT
464+#endif
465+#ifndef OPENSSL_NO_SCT
466+# define OPENSSL_NO_SCT
467+#endif
468 #ifndef OPENSSL_NO_SCTP
469 # define OPENSSL_NO_SCTP
470 #endif
471+#ifndef OPENSSL_NO_SEED
472+# define OPENSSL_NO_SEED
473+#endif
474+#ifndef OPENSSL_NO_SHA0
475+# define OPENSSL_NO_SHA0
476+#endif
477+#ifndef OPENSSL_NO_SOCK
478+# define OPENSSL_NO_SOCK
479+#endif
480+#ifndef OPENSSL_NO_SRP
481+# define OPENSSL_NO_SRP
482+#endif
483 #ifndef OPENSSL_NO_SSL_TRACE
484 # define OPENSSL_NO_SSL_TRACE
485 #endif
486+#ifndef OPENSSL_NO_SSL2
487+# define OPENSSL_NO_SSL2
488+#endif
489+#ifndef OPENSSL_NO_SSL3
490+# define OPENSSL_NO_SSL3
491+#endif
492+#ifndef OPENSSL_NO_STDIO
493+# define OPENSSL_NO_STDIO
494+#endif
495 #ifndef OPENSSL_NO_STORE
496 # define OPENSSL_NO_STORE
497 #endif
498+#ifndef OPENSSL_NO_UI
499+# define OPENSSL_NO_UI
500+#endif
501 #ifndef OPENSSL_NO_UNIT_TEST
502 # define OPENSSL_NO_UNIT_TEST
503 #endif
504+#ifndef OPENSSL_NO_WHIRLPOOL
505+# define OPENSSL_NO_WHIRLPOOL
506+#endif
507
508 #endif /* OPENSSL_DOING_MAKEDEPEND */
509
510+#ifndef OPENSSL_NO_ASM
511+# define OPENSSL_NO_ASM
512+#endif
513+#ifndef OPENSSL_NO_ERR
514+# define OPENSSL_NO_ERR
515+#endif
516+#ifndef OPENSSL_NO_HW
517+# define OPENSSL_NO_HW
518+#endif
519 #ifndef OPENSSL_NO_DYNAMIC_ENGINE
520 # define OPENSSL_NO_DYNAMIC_ENGINE
521 #endif
522@@ -56,12 +173,66 @@
523    who haven't had the time to do the appropriate changes in their
524    applications.  */
525 #ifdef OPENSSL_ALGORITHM_DEFINES
526+# if defined(OPENSSL_NO_BF) && !defined(NO_BF)
527+#  define NO_BF
528+# endif
529+# if defined(OPENSSL_NO_CAMELLIA) && !defined(NO_CAMELLIA)
530+#  define NO_CAMELLIA
531+# endif
532+# if defined(OPENSSL_NO_CAPIENG) && !defined(NO_CAPIENG)
533+#  define NO_CAPIENG
534+# endif
535+# if defined(OPENSSL_NO_CAST) && !defined(NO_CAST)
536+#  define NO_CAST
537+# endif
538+# if defined(OPENSSL_NO_CMS) && !defined(NO_CMS)
539+#  define NO_CMS
540+# endif
541+# if defined(OPENSSL_NO_DEPRECATED) && !defined(NO_DEPRECATED)
542+#  define NO_DEPRECATED
543+# endif
544+# if defined(OPENSSL_NO_DGRAM) && !defined(NO_DGRAM)
545+#  define NO_DGRAM
546+# endif
547+# if defined(OPENSSL_NO_DSA) && !defined(NO_DSA)
548+#  define NO_DSA
549+# endif
550+# if defined(OPENSSL_NO_DYNAMIC_ENGINE) && !defined(NO_DYNAMIC_ENGINE)
551+#  define NO_DYNAMIC_ENGINE
552+# endif
553+# if defined(OPENSSL_NO_EC) && !defined(NO_EC)
554+#  define NO_EC
555+# endif
556 # if defined(OPENSSL_NO_EC_NISTP_64_GCC_128) && !defined(NO_EC_NISTP_64_GCC_128)
557 #  define NO_EC_NISTP_64_GCC_128
558 # endif
559+# if defined(OPENSSL_NO_ECDH) && !defined(NO_ECDH)
560+#  define NO_ECDH
561+# endif
562+# if defined(OPENSSL_NO_ECDSA) && !defined(NO_ECDSA)
563+#  define NO_ECDSA
564+# endif
565+# if defined(OPENSSL_NO_ENGINE) && !defined(NO_ENGINE)
566+#  define NO_ENGINE
567+# endif
568+# if defined(OPENSSL_NO_ENGINES) && !defined(NO_ENGINES)
569+#  define NO_ENGINES
570+# endif
571+# if defined(OPENSSL_NO_FILENAMES) && !defined(NO_FILENAMES)
572+#  define NO_FILENAMES
573+# endif
574+# if defined(OPENSSL_NO_FP_API) && !defined(NO_FP_API)
575+#  define NO_FP_API
576+# endif
577 # if defined(OPENSSL_NO_GMP) && !defined(NO_GMP)
578 #  define NO_GMP
579 # endif
580+# if defined(OPENSSL_NO_GOST) && !defined(NO_GOST)
581+#  define NO_GOST
582+# endif
583+# if defined(OPENSSL_NO_IDEA) && !defined(NO_IDEA)
584+#  define NO_IDEA
585+# endif
586 # if defined(OPENSSL_NO_JPAKE) && !defined(NO_JPAKE)
587 #  define NO_JPAKE
588 # endif
589@@ -71,27 +242,78 @@
590 # if defined(OPENSSL_NO_LIBUNBOUND) && !defined(NO_LIBUNBOUND)
591 #  define NO_LIBUNBOUND
592 # endif
593+# if defined(OPENSSL_NO_LOCKING) && !defined(NO_LOCKING)
594+#  define NO_LOCKING
595+# endif
596 # if defined(OPENSSL_NO_MD2) && !defined(NO_MD2)
597 #  define NO_MD2
598 # endif
599+# if defined(OPENSSL_NO_MDC2) && !defined(NO_MDC2)
600+#  define NO_MDC2
601+# endif
602+# if defined(OPENSSL_NO_POSIX_IO) && !defined(NO_POSIX_IO)
603+#  define NO_POSIX_IO
604+# endif
605+# if defined(OPENSSL_NO_RC2) && !defined(NO_RC2)
606+#  define NO_RC2
607+# endif
608 # if defined(OPENSSL_NO_RC5) && !defined(NO_RC5)
609 #  define NO_RC5
610 # endif
611+# if defined(OPENSSL_NO_RCS) && !defined(NO_RCS)
612+#  define NO_RCS
613+# endif
614 # if defined(OPENSSL_NO_RFC3779) && !defined(NO_RFC3779)
615 #  define NO_RFC3779
616 # endif
617+# if defined(OPENSSL_NO_RIPEMD) && !defined(NO_RIPEMD)
618+#  define NO_RIPEMD
619+# endif
620+# if defined(OPENSSL_NO_SCRYPT) && !defined(NO_SCRYPT)
621+#  define NO_SCRYPT
622+# endif
623+# if defined(OPENSSL_NO_SCT) && !defined(NO_SCT)
624+#  define NO_SCT
625+# endif
626 # if defined(OPENSSL_NO_SCTP) && !defined(NO_SCTP)
627 #  define NO_SCTP
628 # endif
629+# if defined(OPENSSL_NO_SEED) && !defined(NO_SEED)
630+#  define NO_SEED
631+# endif
632+# if defined(OPENSSL_NO_SHA0) && !defined(NO_SHA0)
633+#  define NO_SHA0
634+# endif
635+# if defined(OPENSSL_NO_SOCK) && !defined(NO_SOCK)
636+#  define NO_SOCK
637+# endif
638+# if defined(OPENSSL_NO_SRP) && !defined(NO_SRP)
639+#  define NO_SRP
640+# endif
641 # if defined(OPENSSL_NO_SSL_TRACE) && !defined(NO_SSL_TRACE)
642 #  define NO_SSL_TRACE
643 # endif
644+# if defined(OPENSSL_NO_SSL2) && !defined(NO_SSL2)
645+#  define NO_SSL2
646+# endif
647+# if defined(OPENSSL_NO_SSL3) && !defined(NO_SSL3)
648+#  define NO_SSL3
649+# endif
650+# if defined(OPENSSL_NO_STDIO) && !defined(NO_STDIO)
651+#  define NO_STDIO
652+# endif
653 # if defined(OPENSSL_NO_STORE) && !defined(NO_STORE)
654 #  define NO_STORE
655 # endif
656+# if defined(OPENSSL_NO_UI) && !defined(NO_UI)
657+#  define NO_UI
658+# endif
659 # if defined(OPENSSL_NO_UNIT_TEST) && !defined(NO_UNIT_TEST)
660 #  define NO_UNIT_TEST
661 # endif
662+# if defined(OPENSSL_NO_WHIRLPOOL) && !defined(NO_WHIRLPOOL)
663+#  define NO_WHIRLPOOL
664+# endif
665 #endif
666
667 /* crypto/opensslconf.h.in */
668@@ -152,7 +374,7 @@
669 #endif
670 #endif
671
672-#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H)
673+#if defined(HEADER_BN_H) && !defined(CONFIG_HEADER_BN_H) && !defined(OPENSSL_SYSNAME_UEFI)
674 #define CONFIG_HEADER_BN_H
675 #undef BN_LLONG
676
677diff U3 e_os.h e_os.h
678--- e_os.h	Thu Jul 09 19:57:16 2015
679+++ e_os.h	Thu Oct 29 16:54:10 2015
680@@ -136,7 +136,7 @@
681 #  define MSDOS
682 # endif
683
684-# if defined(MSDOS) && !defined(GETPID_IS_MEANINGLESS)
685+# if (defined(MSDOS) || defined(OPENSSL_SYS_UEFI)) && !defined(GETPID_IS_MEANINGLESS)
686 #  define GETPID_IS_MEANINGLESS
687 # endif
688
689diff U3 e_os2.h e_os2.h
690--- e_os2.h	Thu Jul 09 19:57:16 2015
691+++ e_os2.h	Thu Oct 29 15:08:19 2015
692@@ -97,7 +97,14 @@
693  * For 32 bit environment, there seems to be the CygWin environment and then
694  * all the others that try to do the same thing Microsoft does...
695  */
696-# if defined(OPENSSL_SYSNAME_UWIN)
697+/*
698+ * UEFI lives here because it might be built with a Microsoft toolchain and
699+ * we need to avoid the false positive match on Windows.
700+ */
701+# if defined(OPENSSL_SYSNAME_UEFI)
702+#  undef OPENSSL_SYS_UNIX
703+#  define OPENSSL_SYS_UEFI
704+# elif defined(OPENSSL_SYSNAME_UWIN)
705 #  undef OPENSSL_SYS_UNIX
706 #  define OPENSSL_SYS_WIN32_UWIN
707 # else
708