]> git.proxmox.com Git - mirror_edk2.git/blob - CryptoPkg/Library/OpensslLib/EDKII_openssl-1.0.2c.patch
54e14d8af99d0f8c285ac50359c6d40008f56757
[mirror_edk2.git] / CryptoPkg / Library / OpensslLib / EDKII_openssl-1.0.2c.patch
1 diff 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);
16 diff 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 @@ -460,6 +460,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 */
43 diff 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 }
64 diff 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
75 diff 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;
87 BIO *tmpin, *tmpout;
88 @@ -365,9 +366,14 @@
89 } else
90 tmpout = out;
91
92 + bufsiz = 4096;
93 + buf = OPENSSL_malloc(bufsiz);
94 + if (buf == NULL) {
95 + goto err;
96 + }
97 /* We now have to 'read' from p7bio to calculate digests etc. */
98 for (;;) {
99 - i = BIO_read(p7bio, buf, sizeof(buf));
100 + i = BIO_read(p7bio, buf, bufsiz);
101 if (i <= 0)
102 break;
103 if (tmpout)
104 @@ -406,6 +412,10 @@
105 BIO_free_all(p7bio);
106
107 sk_X509_free(signers);
108 +
109 + if (buf != NULL) {
110 + OPENSSL_free(buf);
111 + }
112
113 return ret;
114 }
115 diff U3 crypto/rand/rand_unix.c crypto/rand/rand_unix.c
116 --- crypto/rand/rand_unix.c Thu Jun 11 21:01:06 2015
117 +++ crypto/rand/rand_unix.c Fri Jun 12 10:51:21 2015
118 @@ -116,7 +116,7 @@
119 #include <openssl/rand.h>
120 #include "rand_lcl.h"
121
122 -#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))
123 +#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))
124
125 # include <sys/types.h>
126 # include <sys/time.h>
127 @@ -439,7 +439,7 @@
128 * defined(OPENSSL_SYS_VXWORKS) ||
129 * defined(OPENSSL_SYS_NETWARE)) */
130
131 -#if defined(OPENSSL_SYS_VXWORKS)
132 +#if defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_UEFI)
133 int RAND_poll(void)
134 {
135 return 0;
136 diff U3 crypto/rsa/rsa_ameth.c crypto/rsa/rsa_ameth.c
137 --- crypto/rsa/rsa_ameth.c Thu Jun 11 21:50:12 2015
138 +++ crypto/rsa/rsa_ameth.c Fri Jun 12 10:45:38 2015
139 @@ -68,10 +68,12 @@
140 #endif
141 #include "asn1_locl.h"
142
143 +#ifndef OPENSSL_NO_CMS
144 static int rsa_cms_sign(CMS_SignerInfo *si);
145 static int rsa_cms_verify(CMS_SignerInfo *si);
146 static int rsa_cms_decrypt(CMS_RecipientInfo *ri);
147 static int rsa_cms_encrypt(CMS_RecipientInfo *ri);
148 +#endif
149
150 static int rsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
151 {
152 @@ -665,6 +667,7 @@
153 return rv;
154 }
155
156 +#ifndef OPENSSL_NO_CMS
157 static int rsa_cms_verify(CMS_SignerInfo *si)
158 {
159 int nid, nid2;
160 @@ -683,6 +686,7 @@
161 }
162 return 0;
163 }
164 +#endif
165
166 /*
167 * Customised RSA item verification routine. This is called when a signature
168 @@ -705,6 +709,7 @@
169 return -1;
170 }
171
172 +#ifndef OPENSSL_NO_CMS
173 static int rsa_cms_sign(CMS_SignerInfo *si)
174 {
175 int pad_mode = RSA_PKCS1_PADDING;
176 @@ -729,6 +734,7 @@
177 X509_ALGOR_set0(alg, OBJ_nid2obj(NID_rsassaPss), V_ASN1_SEQUENCE, os);
178 return 1;
179 }
180 +#endif
181
182 static int rsa_item_sign(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn,
183 X509_ALGOR *alg1, X509_ALGOR *alg2,
184 @@ -785,6 +791,7 @@
185 return pss;
186 }
187
188 +#ifndef OPENSSL_NO_CMS
189 static int rsa_cms_decrypt(CMS_RecipientInfo *ri)
190 {
191 EVP_PKEY_CTX *pkctx;
192 @@ -857,7 +864,9 @@
193 X509_ALGOR_free(maskHash);
194 return rv;
195 }
196 +#endif
197
198 +#ifndef OPENSSL_NO_CMS
199 static int rsa_cms_encrypt(CMS_RecipientInfo *ri)
200 {
201 const EVP_MD *md, *mgf1md;
202 @@ -920,6 +929,7 @@
203 ASN1_STRING_free(os);
204 return rv;
205 }
206 +#endif
207
208 const EVP_PKEY_ASN1_METHOD rsa_asn1_meths[] = {
209 {
210 diff U3 crypto/x509/x509_vfy.c crypto/x509/x509_vfy.c
211 --- crypto/x509/x509_vfy.c Thu Jun 11 21:52:58 2015
212 +++ crypto/x509/x509_vfy.c Fri Jun 12 11:29:37 2015
213 @@ -1647,6 +1647,10 @@
214
215 static int check_cert_time(X509_STORE_CTX *ctx, X509 *x)
216 {
217 +#ifdef OPENSSL_SYS_UEFI
218 + /* Bypass Certificate Time Checking for UEFI version. */
219 + return 1;
220 +#else
221 time_t *ptime;
222 int i;
223
224 @@ -1686,6 +1690,7 @@
225 }
226
227 return 1;
228 +#endif
229 }
230
231 static int internal_verify(X509_STORE_CTX *ctx)
232 diff U3 crypto/x509v3/ext_dat.h crypto/x509v3/ext_dat.h
233 --- crypto/x509v3/ext_dat.h Thu Jun 11 21:50:12 2015
234 +++ crypto/x509v3/ext_dat.h Fri Jun 12 11:11:03 2015
235 @@ -127,8 +127,10 @@
236 &v3_idp,
237 &v3_alt[2],
238 &v3_freshest_crl,
239 +#ifndef OPENSSL_SYS_UEFI
240 &v3_ct_scts[0],
241 &v3_ct_scts[1],
242 +#endif
243 };
244
245 /* Number of standard extensions */
246 diff U3 crypto/crypto.h crypto/crypto.h
247 --- crypto/crypto.h Thu Jun 11 21:01:06 2015
248 +++ crypto/crypto.h Fri Jun 12 11:33:27 2015
249 @@ -235,15 +235,15 @@
250 # ifndef OPENSSL_NO_LOCKING
251 # ifndef CRYPTO_w_lock
252 # define CRYPTO_w_lock(type) \
253 - CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
254 + CRYPTO_lock(CRYPTO_LOCK|CRYPTO_WRITE,type,NULL,0)
255 # define CRYPTO_w_unlock(type) \
256 - CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,__FILE__,__LINE__)
257 + CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_WRITE,type,NULL,0)
258 # define CRYPTO_r_lock(type) \
259 - CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,__FILE__,__LINE__)
260 + CRYPTO_lock(CRYPTO_LOCK|CRYPTO_READ,type,NULL,0)
261 # define CRYPTO_r_unlock(type) \
262 - CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,__FILE__,__LINE__)
263 + CRYPTO_lock(CRYPTO_UNLOCK|CRYPTO_READ,type,NULL,0)
264 # define CRYPTO_add(addr,amount,type) \
265 - CRYPTO_add_lock(addr,amount,type,__FILE__,__LINE__)
266 + CRYPTO_add_lock(addr,amount,type,NULL,0)
267 # endif
268 # else
269 # define CRYPTO_w_lock(a)
270 @@ -378,19 +378,19 @@
271 # define MemCheck_off() CRYPTO_mem_ctrl(CRYPTO_MEM_CHECK_DISABLE)
272 # define is_MemCheck_on() CRYPTO_is_mem_check_on()
273
274 -# define OPENSSL_malloc(num) CRYPTO_malloc((int)num,__FILE__,__LINE__)
275 -# define OPENSSL_strdup(str) CRYPTO_strdup((str),__FILE__,__LINE__)
276 +# define OPENSSL_malloc(num) CRYPTO_malloc((int)num,NULL,0)
277 +# define OPENSSL_strdup(str) CRYPTO_strdup((str),NULL,0)
278 # define OPENSSL_realloc(addr,num) \
279 - CRYPTO_realloc((char *)addr,(int)num,__FILE__,__LINE__)
280 + CRYPTO_realloc((char *)addr,(int)num,NULL,0)
281 # define OPENSSL_realloc_clean(addr,old_num,num) \
282 - CRYPTO_realloc_clean(addr,old_num,num,__FILE__,__LINE__)
283 + CRYPTO_realloc_clean(addr,old_num,num,NULL,0)
284 # define OPENSSL_remalloc(addr,num) \
285 - CRYPTO_remalloc((char **)addr,(int)num,__FILE__,__LINE__)
286 + CRYPTO_remalloc((char **)addr,(int)num,NULL,0)
287 # define OPENSSL_freeFunc CRYPTO_free
288 # define OPENSSL_free(addr) CRYPTO_free(addr)
289
290 # define OPENSSL_malloc_locked(num) \
291 - CRYPTO_malloc_locked((int)num,__FILE__,__LINE__)
292 + CRYPTO_malloc_locked((int)num,NULL,0)
293 # define OPENSSL_free_locked(addr) CRYPTO_free_locked(addr)
294
295 const char *SSLeay_version(int type);
296 @@ -545,7 +545,7 @@
297 long CRYPTO_get_mem_debug_options(void);
298
299 # define CRYPTO_push_info(info) \
300 - CRYPTO_push_info_(info, __FILE__, __LINE__);
301 + CRYPTO_push_info_(info, NULL, 0);
302 int CRYPTO_push_info_(const char *info, const char *file, int line);
303 int CRYPTO_pop_info(void);
304 int CRYPTO_remove_all_info(void);
305 @@ -588,7 +588,7 @@
306
307 /* die if we have to */
308 void OpenSSLDie(const char *file, int line, const char *assertion);
309 -# define OPENSSL_assert(e) (void)((e) ? 0 : (OpenSSLDie(__FILE__, __LINE__, #e),1))
310 +# define OPENSSL_assert(e) (void)((e) ? 0 : (OpenSSLDie(NULL, 0, #e),1))
311
312 unsigned long *OPENSSL_ia32cap_loc(void);
313 # define OPENSSL_ia32cap (*(OPENSSL_ia32cap_loc()))
314 @@ -605,14 +605,14 @@
315 # define fips_md_init_ctx(alg, cx) \
316 int alg##_Init(cx##_CTX *c) \
317 { \
318 - if (FIPS_mode()) OpenSSLDie(__FILE__, __LINE__, \
319 + if (FIPS_mode()) OpenSSLDie(NULL, 0, \
320 "Low level API call to digest " #alg " forbidden in FIPS mode!"); \
321 return private_##alg##_Init(c); \
322 } \
323 int private_##alg##_Init(cx##_CTX *c)
324
325 # define fips_cipher_abort(alg) \
326 - if (FIPS_mode()) OpenSSLDie(__FILE__, __LINE__, \
327 + if (FIPS_mode()) OpenSSLDie(NULL, 0, \
328 "Low level API call to cipher " #alg " forbidden in FIPS mode!")
329
330 # else
331 diff U3 crypto/opensslconf.h crypto/opensslconf.h
332 --- crypto/opensslconf.h Thu Jun 11 21:55:38 2015
333 +++ crypto/opensslconf.h Fri Jun 12 10:28:27 2015
334 @@ -159,9 +159,12 @@
335 /* Should we define BN_DIV2W here? */
336
337 /* Only one for the following should be defined */
338 +/* Bypass the following definitions for UEFI version. */
339 +#if !defined(OPENSSL_SYS_UEFI)
340 #undef SIXTY_FOUR_BIT_LONG
341 #undef SIXTY_FOUR_BIT
342 #define THIRTY_TWO_BIT
343 +#endif
344 #endif
345
346 #if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H)