pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/security/libtcpa Fix build with OpenSSL 1.1



details:   https://anonhg.NetBSD.org/pkgsrc/rev/ee4841035c8b
branches:  trunk
changeset: 426207:ee4841035c8b
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Fri Mar 27 20:57:11 2020 +0000

description:
Fix build with OpenSSL 1.1

diffstat:

 security/libtcpa/distinfo                           |   6 ++-
 security/libtcpa/patches/patch-examples_createkey.c |  36 ++++++++++++++++++
 security/libtcpa/patches/patch-examples_takeown.c   |  36 ++++++++++++++++++
 security/libtcpa/patches/patch-libtcpa_hmac.c       |  41 +++++++++++++++++++++
 security/libtcpa/patches/patch-libtcpa_keys.c       |  13 ++++++
 5 files changed, 131 insertions(+), 1 deletions(-)

diffs (159 lines):

diff -r 55cbd81549e0 -r ee4841035c8b security/libtcpa/distinfo
--- a/security/libtcpa/distinfo Fri Mar 27 20:56:53 2020 +0000
+++ b/security/libtcpa/distinfo Fri Mar 27 20:57:11 2020 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.6 2015/11/04 01:17:50 agc Exp $
+$NetBSD: distinfo,v 1.7 2020/03/27 20:57:11 joerg Exp $
 
 SHA1 (tpm-1.1b.tar.gz) = be59de89ae7ab633e23d4a03c855e3063aaf4c20
 RMD160 (tpm-1.1b.tar.gz) = 82fa9e9a9f60cb588319c2d73ca94e948fbc9b26
@@ -11,3 +11,7 @@
 SHA1 (patch-aa) = 6da066464bd105fda446da801e2d4ca9f11b9394
 SHA1 (patch-ab) = 978df91511c61a1067781e54994bad028a047d6a
 SHA1 (patch-ac) = 3793ca470d634974aabc32c698db4cfcfce4ca75
+SHA1 (patch-examples_createkey.c) = 1d26a6de2875cbb3921e08dadf7924415b707dbd
+SHA1 (patch-examples_takeown.c) = 05ff728a73b488d9540292cbed5d16bf553e6eff
+SHA1 (patch-libtcpa_hmac.c) = 88862b22b8f357181ec0bfea709ce205070f833d
+SHA1 (patch-libtcpa_keys.c) = c91d1d48e584542ad2635ad054a04f96d4316b19
diff -r 55cbd81549e0 -r ee4841035c8b security/libtcpa/patches/patch-examples_createkey.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/security/libtcpa/patches/patch-examples_createkey.c       Fri Mar 27 20:57:11 2020 +0000
@@ -0,0 +1,36 @@
+$NetBSD: patch-examples_createkey.c,v 1.1 2020/03/27 20:57:12 joerg Exp $
+
+--- examples/createkey.c.orig  2020-03-27 18:50:53.384965280 +0000
++++ examples/createkey.c
+@@ -21,7 +21,7 @@ int main(int argc, char *argv[])
+     keydata q;                    /* keydata structure for resulting key */
+     RSA *rsa;                     /* OpenSSL format Public Key */
+     FILE *keyfile;                /* output file for public key */
+-    EVP_PKEY pkey;                /* OpenSSL public key */
++    EVP_PKEY *pkey;                /* OpenSSL public key */
+     unsigned char pkeyname[256];  /* file name string of public key file */
+ 
+     if (argc < 5) {
+@@ -77,18 +77,20 @@ int main(int argc, char *argv[])
+     }
+     OpenSSL_add_all_algorithms();
+     snprintf(pkeyname,sizeof(pkeyname),"%s.pem", argv[3]);
+-    EVP_PKEY_assign_RSA(&pkey, rsa);
++    pkey = EVP_PKEY_new();
++    EVP_PKEY_assign_RSA(pkey, rsa);
+     keyfile = fopen(pkeyname, "w");
+     if (keyfile == NULL) {
+         fprintf(stderr, "Unable to create public key file\n");
+         exit(-1);
+     }
+-    ret = PEM_write_PUBKEY(keyfile, &pkey);
++    ret = PEM_write_PUBKEY(keyfile, pkey);
+     if (ret == 0) {
+         fprintf(stderr, "Unable to write public key file\n");
+         exit(-1);
+     }
+     fclose(keyfile);
+     RSA_free(rsa);
++    EVP_PKEY_free(pkey);
+     exit(0);
+ }
diff -r 55cbd81549e0 -r ee4841035c8b security/libtcpa/patches/patch-examples_takeown.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/security/libtcpa/patches/patch-examples_takeown.c Fri Mar 27 20:57:11 2020 +0000
@@ -0,0 +1,36 @@
+$NetBSD: patch-examples_takeown.c,v 1.1 2020/03/27 20:57:12 joerg Exp $
+
+--- examples/takeown.c.orig    2020-03-27 18:49:41.521284560 +0000
++++ examples/takeown.c
+@@ -19,7 +19,7 @@ int main(int argc, char *argv[])
+     keydata srk;
+     RSA *rsa;                   /* OpenSSL format Public Key */
+     FILE *keyfile;              /* output file for public key */
+-    EVP_PKEY pkey;              /* OpenSSL public key */
++    EVP_PKEY *pkey;              /* OpenSSL public key */
+ 
+     if (argc < 3) {
+         fprintf(stderr, "Usage: takeown <ownerpass> <SRK password>\n");
+@@ -42,18 +42,20 @@ int main(int argc, char *argv[])
+         exit(3);
+     }
+     OpenSSL_add_all_algorithms();
+-    EVP_PKEY_assign_RSA(&pkey, rsa);
++    pkey = EVP_PKEY_new();
++    EVP_PKEY_assign_RSA(pkey, rsa);
+     keyfile = fopen("srootkey.pem", "w");
+     if (keyfile == NULL) {
+         fprintf(stderr, "Unable to create public key file\n");
+         exit(4);
+     }
+-    ret = PEM_write_PUBKEY(keyfile, &pkey);
++    ret = PEM_write_PUBKEY(keyfile, pkey);
+     if (ret == 0) {
+         fprintf(stderr, "Unable to write public key file\n");
+         exit(5);
+     }
+     fclose(keyfile);
+     RSA_free(rsa);
++    EVP_PKEY_free(pkey);
+     exit(0);
+ }
diff -r 55cbd81549e0 -r ee4841035c8b security/libtcpa/patches/patch-libtcpa_hmac.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/security/libtcpa/patches/patch-libtcpa_hmac.c     Fri Mar 27 20:57:11 2020 +0000
@@ -0,0 +1,41 @@
+$NetBSD: patch-libtcpa_hmac.c,v 1.1 2020/03/27 20:57:12 joerg Exp $
+
+--- libtcpa/hmac.c.orig        2020-03-27 18:46:13.942881974 +0000
++++ libtcpa/hmac.c
+@@ -167,25 +167,30 @@ int authhmac(unsigned char *digest, unsi
+ int rawhmac(unsigned char *digest, unsigned char *key,
+             unsigned int keylen, ...)
+ {
+-    HMAC_CTX hmac;
++    HMAC_CTX *hmac;
+     unsigned int dlen;
+     unsigned char *data;
+     va_list argp;
+ 
+-    HMAC_Init(&hmac, key, keylen, EVP_sha1());
++    hmac = HMAC_CTX_new();
++    if (!hmac)
++        return -1;
++    HMAC_Init_ex(hmac, key, keylen, EVP_sha1(), NULL);
+     va_start(argp, keylen);
+     for (;;) {
+         dlen = (unsigned int) va_arg(argp, unsigned int);
+         if (dlen == 0)
+             break;
+         data = (unsigned char *) va_arg(argp, int);
+-        if (data == NULL)
++        if (data == NULL) {
++            HMAC_CTX_free(hmac);
+             return -1;
+-        HMAC_Update(&hmac, data, dlen);
++        }
++        HMAC_Update(hmac, data, dlen);
+     }
+-    HMAC_Final(&hmac, digest, &dlen);
+-    HMAC_cleanup(&hmac);
++    HMAC_Final(hmac, digest, &dlen);
+     va_end(argp);
++    HMAC_CTX_free(hmac);
+     return 0;
+ }
+ 
diff -r 55cbd81549e0 -r ee4841035c8b security/libtcpa/patches/patch-libtcpa_keys.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/security/libtcpa/patches/patch-libtcpa_keys.c     Fri Mar 27 20:57:11 2020 +0000
@@ -0,0 +1,13 @@
+$NetBSD: patch-libtcpa_keys.c,v 1.1 2020/03/27 20:57:12 joerg Exp $
+
+--- libtcpa/keys.c.orig        2020-03-27 18:48:00.249254812 +0000
++++ libtcpa/keys.c
+@@ -452,7 +452,6 @@ RSA *convpubkey(pubkeydata * k)
+     BN_bin2bn(k->modulus, k->keylength, mod);
+     BN_bin2bn(k->exponent, k->expsize, exp);
+     /* set up the RSA public key structure */
+-    rsa->n = mod;
+-    rsa->e = exp;
++    RSA_set0_key(rsa, mod, exp, NULL);
+     return rsa;
+ }



Home | Main Index | Thread Index | Old Index