From owner-svn-ports-all@freebsd.org Fri Nov 9 17:39:22 2018 Return-Path: Delivered-To: svn-ports-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 229831102604; Fri, 9 Nov 2018 17:39:22 +0000 (UTC) (envelope-from swills@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 45F3E84722; Fri, 9 Nov 2018 17:39:21 +0000 (UTC) (envelope-from swills@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 228E61712A; Fri, 9 Nov 2018 17:39:21 +0000 (UTC) (envelope-from swills@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wA9HdKQS099514; Fri, 9 Nov 2018 17:39:20 GMT (envelope-from swills@FreeBSD.org) Received: (from swills@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wA9HdK9u099512; Fri, 9 Nov 2018 17:39:20 GMT (envelope-from swills@FreeBSD.org) Message-Id: <201811091739.wA9HdK9u099512@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: swills set sender to swills@FreeBSD.org using -f From: Steve Wills Date: Fri, 9 Nov 2018 17:39:20 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r484533 - in head/security/yafic: . files X-SVN-Group: ports-head X-SVN-Commit-Author: swills X-SVN-Commit-Paths: in head/security/yafic: . files X-SVN-Commit-Revision: 484533 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 45F3E84722 X-Spamd-Result: default: False [-106.87 / 200.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; ALLOW_DOMAIN_WHITELIST(-100.00)[FreeBSD.org]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; DMARC_NA(0.00)[FreeBSD.org]; RCVD_COUNT_THREE(0.00)[4]; MX_GOOD(-0.01)[cached: mx1.FreeBSD.org]; NEURAL_HAM_SHORT(-1.00)[-1.000,0]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; IP_SCORE(-3.76)[ip: (-9.91), ipnet: 2610:1c1:1::/48(-4.93), asn: 11403(-3.87), country: US(-0.09)] X-Rspamd-Server: mx1.freebsd.org X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Nov 2018 17:39:22 -0000 Author: swills Date: Fri Nov 9 17:39:20 2018 New Revision: 484533 URL: https://svnweb.freebsd.org/changeset/ports/484533 Log: security/yafic: Fix OpenSSL 1.1.x build PR: 232302 Submitted by: Allan Saddi (maintainer) Added: head/security/yafic/files/patch-crypto.c (contents, props changed) Modified: head/security/yafic/Makefile (contents, props changed) Modified: head/security/yafic/Makefile ============================================================================== --- head/security/yafic/Makefile Fri Nov 9 17:31:57 2018 (r484532) +++ head/security/yafic/Makefile Fri Nov 9 17:39:20 2018 (r484533) @@ -3,7 +3,7 @@ PORTNAME= yafic PORTVERSION= 1.2.2 -PORTREVISION= 2 +PORTREVISION= 3 CATEGORIES= security MASTER_SITES= SF Added: head/security/yafic/files/patch-crypto.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/security/yafic/files/patch-crypto.c Fri Nov 9 17:39:20 2018 (r484533) @@ -0,0 +1,188 @@ +--- crypto.c.orig 2004-03-21 04:02:32.000000000 -0800 ++++ crypto.c 2018-10-15 15:18:25.842905000 -0700 +@@ -56,6 +56,30 @@ + + static EVP_PKEY *pkey; + ++#if OPENSSL_VERSION_NUMBER < 0x10100000L ++ ++static void *OPENSSL_zalloc (size_t num) ++{ ++ void *ret = OPENSSL_malloc (num); ++ ++ if (ret != NULL) ++ memset (ret, 0, num); ++ return ret; ++} ++ ++EVP_MD_CTX *EVP_MD_CTX_new (void) ++{ ++ return OPENSSL_zalloc (sizeof (EVP_MD_CTX)); ++} ++ ++void EVP_MD_CTX_free (EVP_MD_CTX *ctx) ++{ ++ EVP_MD_CTX_cleanup (ctx); ++ OPENSSL_free (ctx); ++} ++ ++#endif /* OPENSSL_VERSION_NUMBER < 0x10100000L */ ++ + static void + opensslError (const char *what) + { +@@ -100,7 +124,7 @@ + SignFile (int fd, const char *filename, const char *sigfile) + { + const EVP_MD *mdType; +- EVP_MD_CTX ctx; ++ EVP_MD_CTX *ctx; + ssize_t len; + unsigned char *sig = NULL; + unsigned int sigLen; +@@ -111,8 +135,12 @@ + if (!pkey) + return; + ++#if OPENSSL_VERSION_NUMBER < 0x10100000L + mdType = EVP_PKEY_type (pkey->type) == EVP_PKEY_DSA ? EVP_dss1 () : + EVP_sha1 (); ++#else ++ mdType = EVP_sha1 (); ++#endif + + if (!sigfile) { + int tlen = strlen (filename) + 4 + 1; +@@ -122,21 +150,23 @@ + sigfile = tsigfile; + } + ++ if ((ctx = EVP_MD_CTX_new ()) == NULL) ++ opensslError ("EVP_MD_CTX_new"); + #ifdef HAVE_EVP_MD_CTX_INIT +- EVP_MD_CTX_init (&ctx); ++ EVP_MD_CTX_init (ctx); + #endif + #ifdef EVP_DIGESTINIT_VOID +- EVP_SignInit (&ctx, mdType); ++ EVP_SignInit (ctx, mdType); + #else +- if (!EVP_SignInit (&ctx, mdType)) ++ if (!EVP_SignInit (ctx, mdType)) + opensslError ("EVP_SignInit"); + #endif + + while ((len = read (fd, HashBuffer, HASH_BUFFER_SIZE)) > 0) { + #ifdef EVP_DIGESTINIT_VOID +- EVP_SignUpdate (&ctx, HashBuffer, len); ++ EVP_SignUpdate (ctx, HashBuffer, len); + #else +- if (!EVP_SignUpdate (&ctx, HashBuffer, len)) ++ if (!EVP_SignUpdate (ctx, HashBuffer, len)) + opensslError ("EVP_SignUpdate"); + #endif + } +@@ -146,7 +176,7 @@ + + sig = mymalloc (EVP_PKEY_size (pkey)); + +- if (EVP_SignFinal (&ctx, sig, &sigLen, pkey)) { ++ if (EVP_SignFinal (ctx, sig, &sigLen, pkey)) { + if ((f = open (sigfile, O_CREAT|O_WRONLY|O_TRUNC, 0600)) != -1) { + if (write (f, sig, sigLen) != sigLen) + yaficError (sigfile); +@@ -162,15 +192,16 @@ + if (sig) free (sig); + if (tsigfile) free (tsigfile); + #ifdef HAVE_EVP_MD_CTX_CLEANUP +- EVP_MD_CTX_cleanup (&ctx); ++ EVP_MD_CTX_cleanup (ctx); + #endif ++ EVP_MD_CTX_free (ctx); + } + + void + VerifyFile (int fd, const char *filename, const char *sigfile) + { + const EVP_MD *mdType; +- EVP_MD_CTX ctx; ++ EVP_MD_CTX *ctx; + ssize_t len; + unsigned char *sig = NULL; + int f; +@@ -181,8 +212,12 @@ + if (!pkey) + return; + ++#if OPENSSL_VERSION_NUMBER < 0x10100000L + mdType = EVP_PKEY_type (pkey->type) == EVP_PKEY_DSA ? EVP_dss1 () : + EVP_sha1 (); ++#else ++ mdType = EVP_sha1 (); ++#endif + + if (!sigfile) { + int tlen = strlen (filename) + 4 + 1; +@@ -195,13 +230,15 @@ + fprintf (stderr, "Verifying %s: ", filename); + fflush (stderr); + ++ if ((ctx = EVP_MD_CTX_new ()) == NULL) ++ opensslError ("EVP_MD_CTX_new"); + #ifdef HAVE_EVP_MD_CTX_INIT +- EVP_MD_CTX_init (&ctx); ++ EVP_MD_CTX_init (ctx); + #endif + #ifdef EVP_DIGESTINIT_VOID +- EVP_VerifyInit (&ctx, mdType); ++ EVP_VerifyInit (ctx, mdType); + #else +- if (!EVP_VerifyInit (&ctx, mdType)) { ++ if (!EVP_VerifyInit (ctx, mdType)) { + fprintf (stderr, "Error\n"); + opensslError ("EVP_VerifyInit"); + } +@@ -209,9 +246,9 @@ + + while ((len = read (fd, HashBuffer, HASH_BUFFER_SIZE)) > 0) { + #ifdef EVP_DIGESTINIT_VOID +- EVP_VerifyUpdate (&ctx, HashBuffer, len); ++ EVP_VerifyUpdate (ctx, HashBuffer, len); + #else +- if (!EVP_VerifyUpdate (&ctx, HashBuffer, len)) { ++ if (!EVP_VerifyUpdate (ctx, HashBuffer, len)) { + fprintf (stderr, "Error\n"); + opensslError ("EVP_SignUpdate"); + } +@@ -233,7 +270,7 @@ + + close (f); + +- ret = EVP_VerifyFinal (&ctx, sig, len, pkey); ++ ret = EVP_VerifyFinal (ctx, sig, len, pkey); + if (ret < 0) { + fprintf (stderr, "Error\n"); + opensslError ("EVP_VerifyFinal"); +@@ -254,8 +291,9 @@ + if (sig) free (sig); + if (tsigfile) free (tsigfile); + #ifdef HAVE_EVP_MD_CTX_CLEANUP +- EVP_MD_CTX_cleanup (&ctx); ++ EVP_MD_CTX_cleanup (ctx); + #endif ++ EVP_MD_CTX_free (ctx); + } + + const char * +@@ -265,7 +303,11 @@ + + if (pkey) { + int bits = EVP_PKEY_bits (pkey); ++#if OPENSSL_VERSION_NUMBER < 0x10100000L + int type = EVP_PKEY_type (pkey->type); ++#else ++ int type = EVP_PKEY_base_id (pkey); ++#endif + + switch (type) { + case EVP_PKEY_RSA: