<pre style='margin:0'>
Chih-Hsuan Yen (yan12125) pushed a commit to branch master
in repository macports-ports.
</pre>
<p><a href="https://github.com/macports/macports-ports/commit/70fcc31cc1434b77f5e58ca086483e634eeef6fe">https://github.com/macports/macports-ports/commit/70fcc31cc1434b77f5e58ca086483e634eeef6fe</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 70fcc31cc1434b77f5e58ca086483e634eeef6fe
</span>Author: Chih-Hsuan Yen <yan12125@gmail.com>
AuthorDate: Thu Sep 12 18:57:41 2019 +0800
<span style='display:block; white-space:pre;color:#404040;'> yafic: fix building with OpenSSL
</span><span style='display:block; white-space:pre;color:#404040;'>
</span><span style='display:block; white-space:pre;color:#404040;'> Closes: https://trac.macports.org/ticket/58984
</span>---
sysutils/yafic/Portfile | 3 +
sysutils/yafic/files/patch-crypto.c.diff | 188 +++++++++++++++++++++++++++++++
2 files changed, 191 insertions(+)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/sysutils/yafic/Portfile b/sysutils/yafic/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index f73548b..711e151 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/sysutils/yafic/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/sysutils/yafic/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -27,6 +27,9 @@ configure.args --mandir=${prefix}/share/man
</span>
depends_lib path:lib/libssl.dylib:openssl
<span style='display:block; white-space:pre;background:#e0ffe0;'>+# patch from FreeBSD https://svnweb.freebsd.org/ports/head/security/yafic/files/patch-crypto.c?view=markup
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+patchfiles patch-crypto.c.diff
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span> post-destroot {
xinstall ${worksrcpath}/yafic.conf.sample ${destroot}${prefix}/etc
xinstall -d ${destroot}${prefix}/share/doc/${name}
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/sysutils/yafic/files/patch-crypto.c.diff b/sysutils/yafic/files/patch-crypto.c.diff
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 0000000..a509123
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/sysutils/yafic/files/patch-crypto.c.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,188 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- crypto.c.orig 2004-03-21 04:02:32.000000000 -0800
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ crypto.c 2018-10-15 15:18:25.842905000 -0700
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -56,6 +56,30 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ static EVP_PKEY *pkey;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#if OPENSSL_VERSION_NUMBER < 0x10100000L
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++static void *OPENSSL_zalloc (size_t num)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ void *ret = OPENSSL_malloc (num);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (ret != NULL)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ memset (ret, 0, num);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return ret;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++EVP_MD_CTX *EVP_MD_CTX_new (void)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return OPENSSL_zalloc (sizeof (EVP_MD_CTX));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++void EVP_MD_CTX_free (EVP_MD_CTX *ctx)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++{
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ EVP_MD_CTX_cleanup (ctx);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ OPENSSL_free (ctx);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ static void
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ opensslError (const char *what)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -100,7 +124,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ SignFile (int fd, const char *filename, const char *sigfile)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const EVP_MD *mdType;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- EVP_MD_CTX ctx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ EVP_MD_CTX *ctx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ssize_t len;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ unsigned char *sig = NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ unsigned int sigLen;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -111,8 +135,12 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (!pkey)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#if OPENSSL_VERSION_NUMBER < 0x10100000L
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mdType = EVP_PKEY_type (pkey->type) == EVP_PKEY_DSA ? EVP_dss1 () :
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ EVP_sha1 ();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ mdType = EVP_sha1 ();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (!sigfile) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int tlen = strlen (filename) + 4 + 1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -122,21 +150,23 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sigfile = tsigfile;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if ((ctx = EVP_MD_CTX_new ()) == NULL)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ opensslError ("EVP_MD_CTX_new");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #ifdef HAVE_EVP_MD_CTX_INIT
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- EVP_MD_CTX_init (&ctx);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ EVP_MD_CTX_init (ctx);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #ifdef EVP_DIGESTINIT_VOID
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- EVP_SignInit (&ctx, mdType);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ EVP_SignInit (ctx, mdType);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- if (!EVP_SignInit (&ctx, mdType))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (!EVP_SignInit (ctx, mdType))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ opensslError ("EVP_SignInit");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ while ((len = read (fd, HashBuffer, HASH_BUFFER_SIZE)) > 0) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #ifdef EVP_DIGESTINIT_VOID
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- EVP_SignUpdate (&ctx, HashBuffer, len);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ EVP_SignUpdate (ctx, HashBuffer, len);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- if (!EVP_SignUpdate (&ctx, HashBuffer, len))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (!EVP_SignUpdate (ctx, HashBuffer, len))
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ opensslError ("EVP_SignUpdate");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -146,7 +176,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ sig = mymalloc (EVP_PKEY_size (pkey));
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- if (EVP_SignFinal (&ctx, sig, &sigLen, pkey)) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (EVP_SignFinal (ctx, sig, &sigLen, pkey)) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if ((f = open (sigfile, O_CREAT|O_WRONLY|O_TRUNC, 0600)) != -1) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (write (f, sig, sigLen) != sigLen)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ yaficError (sigfile);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -162,15 +192,16 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (sig) free (sig);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (tsigfile) free (tsigfile);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #ifdef HAVE_EVP_MD_CTX_CLEANUP
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- EVP_MD_CTX_cleanup (&ctx);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ EVP_MD_CTX_cleanup (ctx);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ EVP_MD_CTX_free (ctx);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ void
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ VerifyFile (int fd, const char *filename, const char *sigfile)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const EVP_MD *mdType;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- EVP_MD_CTX ctx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ EVP_MD_CTX *ctx;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ ssize_t len;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ unsigned char *sig = NULL;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int f;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -181,8 +212,12 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (!pkey)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#if OPENSSL_VERSION_NUMBER < 0x10100000L
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ mdType = EVP_PKEY_type (pkey->type) == EVP_PKEY_DSA ? EVP_dss1 () :
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ EVP_sha1 ();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ mdType = EVP_sha1 ();
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (!sigfile) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int tlen = strlen (filename) + 4 + 1;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -195,13 +230,15 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fprintf (stderr, "Verifying %s: ", filename);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fflush (stderr);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if ((ctx = EVP_MD_CTX_new ()) == NULL)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ opensslError ("EVP_MD_CTX_new");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #ifdef HAVE_EVP_MD_CTX_INIT
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- EVP_MD_CTX_init (&ctx);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ EVP_MD_CTX_init (ctx);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #ifdef EVP_DIGESTINIT_VOID
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- EVP_VerifyInit (&ctx, mdType);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ EVP_VerifyInit (ctx, mdType);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- if (!EVP_VerifyInit (&ctx, mdType)) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (!EVP_VerifyInit (ctx, mdType)) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fprintf (stderr, "Error\n");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ opensslError ("EVP_VerifyInit");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -209,9 +246,9 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ while ((len = read (fd, HashBuffer, HASH_BUFFER_SIZE)) > 0) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #ifdef EVP_DIGESTINIT_VOID
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- EVP_VerifyUpdate (&ctx, HashBuffer, len);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ EVP_VerifyUpdate (ctx, HashBuffer, len);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- if (!EVP_VerifyUpdate (&ctx, HashBuffer, len)) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ if (!EVP_VerifyUpdate (ctx, HashBuffer, len)) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fprintf (stderr, "Error\n");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ opensslError ("EVP_SignUpdate");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -233,7 +270,7 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ close (f);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- ret = EVP_VerifyFinal (&ctx, sig, len, pkey);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ ret = EVP_VerifyFinal (ctx, sig, len, pkey);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (ret < 0) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ fprintf (stderr, "Error\n");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ opensslError ("EVP_VerifyFinal");
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -254,8 +291,9 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (sig) free (sig);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (tsigfile) free (tsigfile);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #ifdef HAVE_EVP_MD_CTX_CLEANUP
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+- EVP_MD_CTX_cleanup (&ctx);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ EVP_MD_CTX_cleanup (ctx);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ EVP_MD_CTX_free (ctx);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ const char *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -265,7 +303,11 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ if (pkey) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int bits = EVP_PKEY_bits (pkey);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#if OPENSSL_VERSION_NUMBER < 0x10100000L
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int type = EVP_PKEY_type (pkey->type);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ int type = EVP_PKEY_base_id (pkey);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ switch (type) {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ case EVP_PKEY_RSA:
</span></pre><pre style='margin:0'>
</pre>