From owner-svn-src-all@freebsd.org Mon Oct 1 14:07:39 2018 Return-Path: Delivered-To: svn-src-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 2E76810BD712; Mon, 1 Oct 2018 14:07:39 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from drew.franken.de (drew.ipv6.franken.de [IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C17B977B36; Mon, 1 Oct 2018 14:07:38 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from [IPv6:2a02:c6a0:4015:12:5d53:26a3:abad:15db] (unknown [IPv6:2a02:c6a0:4015:12:5d53:26a3:abad:15db]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTPSA id CF7B5721E280C; Mon, 1 Oct 2018 16:07:21 +0200 (CEST) From: Michael Tuexen Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.0 \(3445.100.39\)) Subject: Re: svn commit: r339042 - head/sys/netinet Date: Mon, 1 Oct 2018 16:07:21 +0200 References: <201810011405.w91E5WbA032630@repo.freebsd.org> To: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <201810011405.w91E5WbA032630@repo.freebsd.org> Message-Id: <4DA0784B-9ED3-4A9E-B786-BF0608D7E6DA@freebsd.org> X-Mailer: Apple Mail (2.3445.100.39) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Oct 2018 14:07:39 -0000 > On 1. Oct 2018, at 16:05, Michael Tuexen wrote: >=20 > Author: tuexen > Date: Mon Oct 1 14:05:31 2018 > New Revision: 339042 > URL: https://svnweb.freebsd.org/changeset/base/339042 >=20 > Log: > Mitigate providing a timing signal if the COOKIE or AUTH > validation fails. > Thanks to jmg@ for reporting the issue, which was discussed in > https://admbugs.freebsd.org/show_bug.cgi?id=3D878 >=20 > Approved by: re (TBD@) Should have been re (gjb@). Best regards Michael > MFC after: 1 week >=20 > Modified: > head/sys/netinet/sctp_auth.c > head/sys/netinet/sctp_input.c >=20 > Modified: head/sys/netinet/sctp_auth.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/netinet/sctp_auth.c Mon Oct 1 14:02:29 2018 = (r339041) > +++ head/sys/netinet/sctp_auth.c Mon Oct 1 14:05:31 2018 = (r339042) > @@ -1706,7 +1706,7 @@ sctp_handle_auth(struct sctp_tcb *stcb, struct = sctp_au > m, offset, computed_digest); >=20 > /* compare the computed digest with the one in the AUTH chunk */ > - if (memcmp(digest, computed_digest, digestlen) !=3D 0) { > + if (timingsafe_bcmp(digest, computed_digest, digestlen) !=3D 0) = { > SCTP_STAT_INCR(sctps_recvauthfailed); > SCTPDBG(SCTP_DEBUG_AUTH1, > "SCTP Auth: HMAC digest check failed\n"); >=20 > Modified: head/sys/netinet/sctp_input.c > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/netinet/sctp_input.c Mon Oct 1 14:02:29 2018 = (r339041) > +++ head/sys/netinet/sctp_input.c Mon Oct 1 14:05:31 2018 = (r339042) > @@ -2554,7 +2554,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int = iphlen, in > return (NULL); > } > /* compare the received digest with the computed digest */ > - if (memcmp(calc_sig, sig, SCTP_SIGNATURE_SIZE) !=3D 0) { > + if (timingsafe_bcmp(calc_sig, sig, SCTP_SIGNATURE_SIZE) !=3D 0) = { > /* try the old cookie? */ > if ((cookie->time_entered.tv_sec =3D=3D = (long)ep->time_of_secret_change) && > (ep->current_secret_number !=3D = ep->last_secret_number)) { > @@ -2563,7 +2563,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int = iphlen, in > (uint8_t = *)ep->secret_key[(int)ep->last_secret_number], > SCTP_SECRET_SIZE, m, cookie_offset, = calc_sig, 0); > /* compare */ > - if (memcmp(calc_sig, sig, SCTP_SIGNATURE_SIZE) = =3D=3D 0) > + if (timingsafe_bcmp(calc_sig, sig, = SCTP_SIGNATURE_SIZE) =3D=3D 0) > cookie_ok =3D 1; > } > } else { >=20