From owner-svn-ports-head@freebsd.org Mon Oct 29 19:29:06 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 BC5E710E8164; Mon, 29 Oct 2018 19:29:05 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 1BEF97F2DC; Mon, 29 Oct 2018 19:29:04 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id HDDbgLXxQ1jEDHDDcgwJfV; Mon, 29 Oct 2018 13:28:57 -0600 X-Authority-Analysis: v=2.3 cv=W/aMqiek c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=kj9zAlcOel0A:10 a=smKx5t2vBNcA:10 a=6I5d2MoRAAAA:8 a=Ntg_Zx-WAAAA:8 a=YhEe3CsSAAAA:8 a=NEAV23lmAAAA:8 a=YxBL1-UpAAAA:8 a=85BQB1Nc9WzPoM8Geh8A:9 a=rcqEo6eOy5EZR_t1:21 a=U5DgSour6u0XjlOm:21 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=RUfouJl5KNV7104ufCm4:22 a=H7XUopTnE8fvnaLSrIZD:22 a=Ia-lj3WSrqcvXOmTRaiG:22 Received: from slippy.cwsent.com (slippy8 [10.2.2.6]) by spqr.komquats.com (Postfix) with ESMTPS id 62FAC3ED4; Mon, 29 Oct 2018 12:28:54 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id w9TJStEG027488; Mon, 29 Oct 2018 12:28:55 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id w9TJStio027485; Mon, 29 Oct 2018 12:28:55 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201810291928.w9TJStio027485@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.8.0 04/21/2012 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Bernard Spil cc: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: Re: svn commit: r483393 - in head/security/openssl111: . files In-Reply-To: Message from Bernard Spil of "Mon, 29 Oct 2018 18:07:40 -0000." <201810291807.w9TI7eeg048928@repo.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 29 Oct 2018 12:28:55 -0700 X-CMAE-Envelope: MS4wfGXOUsA3XaccyQanRggGyO5g9eYe7Qmm61kqEDQGo3upJmCqIlvBlKzPqP7NQif6VbsNm2cP+5k87T/dXW5Gq6PMCJg+WQ4c1v89jhnncRNBWMe4QhJF GHCRj+IlBdk5nCosUJ94InsnIKIajX+mj6RuuT3Y041QH+zgJOnpfYf7WyWecwm4n2W+sJFFGQ9VH7GS6IZx5BeHh2UxycuZnDfWgU57DJcAXNaBAQ+uonl1 2OC30F26DvAoE4B35eGG6DahzSPXNQUgs91nNngFIWhRm2L3aE+/M6qEHh6Pqq45HYGQumAdv919SqqMvYvobg== 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: Mon, 29 Oct 2018 19:29:06 -0000 In message <201810291807.w9TI7eeg048928@repo.freebsd.org>, Bernard Spil writes: > Author: brnrd > Date: Mon Oct 29 18:07:39 2018 > New Revision: 483393 > URL: https://svnweb.freebsd.org/changeset/ports/483393 > > Log: > security/openssl111: Fix vulnerabilities > > MFH: 2018Q4 > Security: 238ae7de-dba2-11e8-b713-b499baebfeaf > > Added: > head/security/openssl111/files/patch-CVE-2018-0734 (contents, props chang > ed) > head/security/openssl111/files/patch-CVE-2018-0735 (contents, props chang > ed) > Modified: > head/security/openssl111/Makefile > > Modified: head/security/openssl111/Makefile > ============================================================================= > = > --- head/security/openssl111/Makefile Mon Oct 29 17:58:14 2018 (r48339 > 2) > +++ head/security/openssl111/Makefile Mon Oct 29 18:07:39 2018 (r48339 > 3) > @@ -3,7 +3,7 @@ > > PORTNAME= openssl > DISTVERSION= 1.1.1 > -PORTREVISION= 1 > +PORTREVISION= 2 > CATEGORIES= security devel > MASTER_SITES= https://www.openssl.org/source/ \ > ftp://ftp.cert.dfn.de/pub/tools/net/openssl/source/ > > Added: head/security/openssl111/files/patch-CVE-2018-0734 > ============================================================================= > = > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/security/openssl111/files/patch-CVE-2018-0734 Mon Oct 29 18:0 > 7:39 2018 (r483393) > @@ -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/8abfe72e8c1de1b95f50aa0d9134803b4d > 00070f > +--- 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_r2283237 > 05 > ++ * 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; > + } > + > > Added: head/security/openssl111/files/patch-CVE-2018-0735 > ============================================================================= > = > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/security/openssl111/files/patch-CVE-2018-0735 Mon Oct 29 18:0 > 7:39 2018 (r483393) > @@ -0,0 +1,33 @@ > +Timing vulnerability in ECDSA signature generation (CVE-2018-0735) > + > +Preallocate an extra limb for some of the big numbers to avoid a reallocatio > n > +that can potentially provide a side channel. > + > +Reviewed-by: Bernd Edlinger > +(Merged from #7486) > + > +(cherry picked from commit 99540ec) > + > +https://www.openssl.org/news/secadv/20181029.txt > +--- crypto/ec/ec_mult.c.orig 2018-09-11 12:48:21 UTC > ++++ crypto/ec/ec_mult.c > +@@ -206,8 +206,8 @@ int ec_scalar_mul_ladder(const EC_GROUP > + */ > + cardinality_bits = BN_num_bits(cardinality); > + group_top = bn_get_top(cardinality); > +- if ((bn_wexpand(k, group_top + 1) == NULL) > +- || (bn_wexpand(lambda, group_top + 1) == NULL)) { > ++ if ((bn_wexpand(k, group_top + 2) == NULL) > ++ || (bn_wexpand(lambda, group_top + 2) == NULL)) { > + ECerr(EC_F_EC_SCALAR_MUL_LADDER, ERR_R_BN_LIB); > + goto err; > + } > +@@ -244,7 +244,7 @@ int ec_scalar_mul_ladder(const EC_GROUP > + * k := scalar + 2*cardinality > + */ > + kbit = BN_is_bit_set(lambda, cardinality_bits); > +- BN_consttime_swap(kbit, k, lambda, group_top + 1); > ++ BN_consttime_swap(kbit, k, lambda, group_top + 2); > + > + group_top = bn_get_top(group->field); > + if ((bn_wexpand(s->X, group_top) == NULL) > Is this something we might want to apply to base as well before 12 is released? -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few.