]> git.proxmox.com Git - mirror_edk2.git/commitdiff
CryptoPkg/OpensslLib: Fix OpenSSL link failures on Windows (RT#4310)
authorQin Long <qin.long@intel.com>
Sat, 5 Mar 2016 15:44:40 +0000 (23:44 +0800)
committerQin Long <qin.long@intel.com>
Sat, 5 Mar 2016 15:44:40 +0000 (23:44 +0800)
This is pull request #755 for OpenSSL 1.1, along with a little extra fix
in the RSA_NET code which has been removed from 1.1 so we can't fix it
there.

https://github.com/openssl/openssl/pull/755

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Reviewed-by: Qin Long <qin.long@intel.com>
Tested-by: Qin Long <qin.long@intel.com>
CryptoPkg/Library/OpensslLib/EDKII_openssl-1.0.2f.patch

index c4d0b6569755c3c44bd89fd7e239187cb958c63c..b799bf26cd6437c1cc96abb4c34177fe482a2891 100644 (file)
@@ -224,6 +224,35 @@ index abc6dc3..3a672e9 100644
  \r
  # define M_ASN1_New(arg,func) \\r
          if (((arg)=func()) == NULL) return(NULL)\r
+diff --git a/crypto/asn1/n_pkey.c b/crypto/asn1/n_pkey.c\r
+index d5a5514..bede55c 100644\r
+--- a/crypto/asn1/n_pkey.c\r
++++ b/crypto/asn1/n_pkey.c\r
+@@ -193,7 +193,12 @@ int i2d_RSA_NET(const RSA *a, unsigned char **pp,\r
+     OPENSSL_cleanse(pkey->private_key->data, rsalen);\r
\r
+     if (cb == NULL)\r
++#ifndef OPENSSL_NO_UI\r
+         cb = EVP_read_pw_string;\r
++#else\r
++        i = 1;\r
++    else\r
++#endif\r
+     i = cb((char *)buf, 256, "Enter Private Key password:", 1);\r
+     if (i != 0) {\r
+         ASN1err(ASN1_F_I2D_RSA_NET, ASN1_R_BAD_PASSWORD_READ);\r
+@@ -264,7 +269,11 @@ RSA *d2i_RSA_NET(RSA **a, const unsigned char **pp, long length,\r
+         goto err;\r
+     }\r
+     if (cb == NULL)\r
++#ifndef OPENSSL_NO_UI\r
+         cb = EVP_read_pw_string;\r
++#else\r
++        goto err;\r
++#endif\r
+     if ((ret = d2i_RSA_NET_2(a, enckey->enckey->digest, cb, sgckey)) == NULL)\r
+         goto err;\r
\r
 diff --git a/crypto/bn/bn_prime.c b/crypto/bn/bn_prime.c\r
 index 1d25687..e933ead 100644\r
 --- a/crypto/bn/bn_prime.c\r
@@ -848,6 +877,44 @@ index 585aa8b..04c6cfc 100644
  \r
  /*\r
   * Borland C seems too stupid to be able to shift and do longs in the\r
+diff --git a/crypto/evp/evp.h b/crypto/evp/evp.h\r
+index 39ab793..ad1e350 100644\r
+--- a/crypto/evp/evp.h\r
++++ b/crypto/evp/evp.h\r
+@@ -602,11 +602,13 @@ int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in);\r
+ int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type);\r
+ int EVP_DigestFinal(EVP_MD_CTX *ctx, unsigned char *md, unsigned int *s);\r
\r
++#ifndef OPENSSL_NO_UI\r
+ int EVP_read_pw_string(char *buf, int length, const char *prompt, int verify);\r
+ int EVP_read_pw_string_min(char *buf, int minlen, int maxlen,\r
+                            const char *prompt, int verify);\r
+ void EVP_set_pw_prompt(const char *prompt);\r
+ char *EVP_get_pw_prompt(void);\r
++#endif\r
\r
+ int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md,\r
+                    const unsigned char *salt, const unsigned char *data,\r
+diff --git a/crypto/evp/evp_key.c b/crypto/evp/evp_key.c\r
+index 5be9e33..63c8866 100644\r
+--- a/crypto/evp/evp_key.c\r
++++ b/crypto/evp/evp_key.c\r
+@@ -63,6 +63,7 @@\r
+ #include <openssl/evp.h>\r
+ #include <openssl/ui.h>\r
\r
++#ifndef OPENSSL_NO_UI\r
+ /* should be init to zeros. */\r
+ static char prompt_string[80];\r
\r
+@@ -117,6 +118,7 @@ int EVP_read_pw_string_min(char *buf, int min, int len, const char *prompt,\r
+     OPENSSL_cleanse(buff, BUFSIZ);\r
+     return ret;\r
+ }\r
++#endif /* OPENSSL_NO_UI */\r
\r
+ int EVP_BytesToKey(const EVP_CIPHER *type, const EVP_MD *md,\r
+                    const unsigned char *salt, const unsigned char *data,\r
 diff --git a/crypto/opensslconf.h.in b/crypto/opensslconf.h.in\r
 index 7a1c85d..7162c0f 100644\r
 --- a/crypto/opensslconf.h.in\r
@@ -922,6 +989,19 @@ index d3b23fc..87b0b6a 100644
  EVP_PKEY *PEM_read_bio_Parameters(BIO *bp, EVP_PKEY **x);\r
  int PEM_write_bio_Parameters(BIO *bp, EVP_PKEY *x);\r
  \r
+diff --git a/crypto/pem/pem_lib.c b/crypto/pem/pem_lib.c\r
+index a29821a..5525efd 100644\r
+--- a/crypto/pem/pem_lib.c\r
++++ b/crypto/pem/pem_lib.c\r
+@@ -84,7 +84,7 @@ int pem_check_suffix(const char *pem_str, const char *suffix);\r
\r
+ int PEM_def_callback(char *buf, int num, int w, void *key)\r
+ {\r
+-#ifdef OPENSSL_NO_FP_API\r
++#if defined(OPENSSL_NO_FP_API) || defined(OPENSSL_NO_UI)\r
+     /*\r
+      * We should not ever call the default callback routine from windows.\r
+      */\r
 diff --git a/crypto/pem/pem_pk8.c b/crypto/pem/pem_pk8.c\r
 index 5747c73..fe465cc 100644\r
 --- a/crypto/pem/pem_pk8.c\r