From owner-svn-ports-head@freebsd.org Tue Oct 30 15:06:09 2018 Return-Path: Delivered-To: svn-ports-head@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 F3DD410EB168; Tue, 30 Oct 2018 15:06:08 +0000 (UTC) (envelope-from brnrd@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 95C336A6C2; Tue, 30 Oct 2018 15:06:08 +0000 (UTC) (envelope-from brnrd@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 72C7B1F042; Tue, 30 Oct 2018 15:06:08 +0000 (UTC) (envelope-from brnrd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w9UF68Bt003329; Tue, 30 Oct 2018 15:06:08 GMT (envelope-from brnrd@FreeBSD.org) Received: (from brnrd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w9UF670P003326; Tue, 30 Oct 2018 15:06:07 GMT (envelope-from brnrd@FreeBSD.org) Message-Id: <201810301506.w9UF670P003326@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brnrd set sender to brnrd@FreeBSD.org using -f From: Bernard Spil Date: Tue, 30 Oct 2018 15:06:07 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r483493 - in head/security/openssl-devel: . files X-SVN-Group: ports-head X-SVN-Commit-Author: brnrd X-SVN-Commit-Paths: in head/security/openssl-devel: . files X-SVN-Commit-Revision: 483493 X-SVN-Commit-Repository: ports MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the ports tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 30 Oct 2018 15:06:09 -0000 Author: brnrd Date: Tue Oct 30 15:06:07 2018 New Revision: 483493 URL: https://svnweb.freebsd.org/changeset/ports/483493 Log: security/openssl-devel: Move patches - Add fix from upstream [1] 1: https://github.com/openssl/openssl/commit/003f1bfd MFH: 2018Q4 Added: head/security/openssl-devel/files/patch-CVE-2018-0734 - copied unchanged from r483492, head/security/openssl-devel/patch-CVE-2018-0734 head/security/openssl-devel/files/patch-CVE-2018-0735 - copied, changed from r483492, head/security/openssl-devel/patch-CVE-2018-0735 Deleted: head/security/openssl-devel/patch-CVE-2018-0734 head/security/openssl-devel/patch-CVE-2018-0735 Modified: head/security/openssl-devel/Makefile Modified: head/security/openssl-devel/Makefile ============================================================================== --- head/security/openssl-devel/Makefile Tue Oct 30 14:22:42 2018 (r483492) +++ head/security/openssl-devel/Makefile Tue Oct 30 15:06:07 2018 (r483493) @@ -3,6 +3,7 @@ PORTNAME= openssl PORTVERSION= 1.1.0i +PORTREVISION= 1 CATEGORIES= security devel MASTER_SITES= https://www.openssl.org/source/ \ ftp://ftp.cert.dfn.de/pub/tools/net/openssl/source/ Copied: head/security/openssl-devel/files/patch-CVE-2018-0734 (from r483492, head/security/openssl-devel/patch-CVE-2018-0734) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/security/openssl-devel/files/patch-CVE-2018-0734 Tue Oct 30 15:06:07 2018 (r483493, copy of r483492, head/security/openssl-devel/patch-CVE-2018-0734) @@ -0,0 +1,98 @@ +Timing vulnerability in DSA signature generation (CVE-2018-0734). + +Avoid a timing attack that leaks information via a side channel that +triggers when a BN is resized. Increasing the size of the BNs +prior to doing anything with them suppresses the attack. + +Thanks due to Samuel Weiser for finding and locating this. + +Reviewed-by: Bernd Edlinger +(Merged from #7486) + +(cherry picked from commit a9cfb8c) + +https://github.com/openssl/openssl/commit/8abfe72e8c1de1b95f50aa0d9134803b4d00070f +--- crypto/dsa/dsa_ossl.c.orig 2018-09-11 12:48:21 UTC ++++ crypto/dsa/dsa_ossl.c +@@ -9,6 +9,7 @@ + + #include + #include "internal/cryptlib.h" ++#include "internal/bn_int.h" + #include + #include + #include "dsa_locl.h" +@@ -178,9 +179,9 @@ static int dsa_sign_setup(DSA *dsa, BN_C + { + BN_CTX *ctx = NULL; + BIGNUM *k, *kinv = NULL, *r = *rp; +- BIGNUM *l, *m; ++ BIGNUM *l; + int ret = 0; +- int q_bits; ++ int q_bits, q_words; + + if (!dsa->p || !dsa->q || !dsa->g) { + DSAerr(DSA_F_DSA_SIGN_SETUP, DSA_R_MISSING_PARAMETERS); +@@ -189,8 +190,7 @@ static int dsa_sign_setup(DSA *dsa, BN_C + + k = BN_new(); + l = BN_new(); +- m = BN_new(); +- if (k == NULL || l == NULL || m == NULL) ++ if (k == NULL || l == NULL) + goto err; + + if (ctx_in == NULL) { +@@ -201,9 +201,9 @@ static int dsa_sign_setup(DSA *dsa, BN_C + + /* Preallocate space */ + q_bits = BN_num_bits(dsa->q); +- if (!BN_set_bit(k, q_bits) +- || !BN_set_bit(l, q_bits) +- || !BN_set_bit(m, q_bits)) ++ q_words = bn_get_top(dsa->q); ++ if (!bn_wexpand(k, q_words + 2) ++ || !bn_wexpand(l, q_words + 2)) + goto err; + + /* Get random k */ +@@ -238,14 +238,17 @@ static int dsa_sign_setup(DSA *dsa, BN_C + * small timing information leakage. We then choose the sum that is + * one bit longer than the modulus. + * +- * TODO: revisit the BN_copy aiming for a memory access agnostic +- * conditional copy. ++ * There are some concerns about the efficacy of doing this. More ++ * specificly refer to the discussion starting with: ++ * https://github.com/openssl/openssl/pull/7486#discussion_r228323705 ++ * The fix is to rework BN so these gymnastics aren't required. + */ + if (!BN_add(l, k, dsa->q) +- || !BN_add(m, l, dsa->q) +- || !BN_copy(k, BN_num_bits(l) > q_bits ? l : m)) ++ || !BN_add(k, l, dsa->q)) + goto err; + ++ BN_consttime_swap(BN_is_bit_set(l, q_bits), k, l, q_words + 2); ++ + if ((dsa)->meth->bn_mod_exp != NULL) { + if (!dsa->meth->bn_mod_exp(dsa, r, dsa->g, k, dsa->p, ctx, + dsa->method_mont_p)) +@@ -258,7 +261,7 @@ static int dsa_sign_setup(DSA *dsa, BN_C + if (!BN_mod(r, r, dsa->q, ctx)) + goto err; + +- /* Compute part of 's = inv(k) (m + xr) mod q' */ ++ /* Compute part of 's = inv(k) (m + xr) mod q' */ + if ((kinv = BN_mod_inverse(NULL, k, dsa->q, ctx)) == NULL) + goto err; + +@@ -273,7 +276,6 @@ static int dsa_sign_setup(DSA *dsa, BN_C + BN_CTX_free(ctx); + BN_clear_free(k); + BN_clear_free(l); +- BN_clear_free(m); + return ret; + } + Copied and modified: head/security/openssl-devel/files/patch-CVE-2018-0735 (from r483492, head/security/openssl-devel/patch-CVE-2018-0735) ============================================================================== --- head/security/openssl-devel/patch-CVE-2018-0735 Tue Oct 30 14:22:42 2018 (r483492, copy source) +++ head/security/openssl-devel/files/patch-CVE-2018-0735 Tue Oct 30 15:06:07 2018 (r483493) @@ -9,20 +9,20 @@ Reviewed-by: Bernd Edlinger