From nobody Mon Feb 06 17:03:58 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4P9XfR0PLQz3mx6b; Mon, 6 Feb 2023 17:03:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4P9XfQ6xPcz4Pg1; Mon, 6 Feb 2023 17:03:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675703039; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9ND0xVSBz+tNsvbd4sBoZDzUP0rH3Mt1Ow2fljS7+0w=; b=qQjfCKQkBkhfW2qevYYUBbpzeip5D8Y6JUNR2yh7CMyQL+hLTXJGxawHwTD+rR+PSclNWf DSTGe01E5HMbCvfgqq5VFAkTJrbVhAielkVKhvoNcJSYsqa1u3Nw2WEVj+SQ642yXk1zux TFyaPQK/Xj1KCWnFSKiOW88tCEa50T/kotrr1DgDfyVYBRITZ4jBPEBxt+8j/NpLsQjCBl FMcoRv1b8h+9yFMb02qD9x9t9RYH7T6vuVvchPNcyjNMUxVYuwATWt2HDYcS97Lcr3pzAM m6aXLuUPzng96gDscZz/BX/+MKCBVhdJ4KC7JlUlHAFP+RxM276fhsdacAlZOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675703039; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=9ND0xVSBz+tNsvbd4sBoZDzUP0rH3Mt1Ow2fljS7+0w=; b=qMUxfnASv005TUTZRntQQLvxNxjqhnTnfnGPVR5onEtfqsFQklAdqK580E9tsR/QTCL7Zh csTUxRU9O9eOYAGGWaYkuXnF38QqcqO7PAsUOLMqqTvXp1cjRRR136TQeQoaKDQ2OSApIn xXlyQKS8kaOCbvbWjOPuAt/1KbRyi8QXzZi4Y6ChSTTx36fHkzOfKIsQKbt9b+PPV1kuxO 5lRAdZbdaq+UCj3oggZCoyi16ENBTgDBKSUNFFf2/DMOopmPamch13rtlxkTJ2hBW8ET7Z Jf1zJ5QoQJ04DNQ25YZ8pDf9bBpwW+SpWJc9w7bq1mHMMIdbLbdnBvxbGtOYZw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675703039; a=rsa-sha256; cv=none; b=uCrTTdqcPkeiWk0WQqgJC5fbwVmiD6vOpw1+GTOGPdS3AOQHxZ0a9ql0cZ/NZpG+Tu0Yfn 72oGPpzuImQZJ0Lc4LHvIR+AbEGhUuBXiaMgC20hGObwckO0AcvPosV6T7/znv7NgIVzUI z2n69crnGcAgSmEK85//O/GZ3xmYBYnRXvLZzbda3grAj1neH6nczQLhC4X/Zw28Haiyzw sOIhseMDuMpAOEx8TNGuaTae5b8C5KV1D69kIqiKkA6cTEsibBDV+pcqkAd2H6EdNKcFf1 ojIHeLIpum/Ovl+B7ah7W6RYVGtbXMw2oODOgXLr4wBKj2yxmF6jgk42IWlptA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4P9XfQ60WKzjJM; Mon, 6 Feb 2023 17:03:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 316H3wVg002128; Mon, 6 Feb 2023 17:03:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 316H3w21002127; Mon, 6 Feb 2023 17:03:58 GMT (envelope-from git) Date: Mon, 6 Feb 2023 17:03:58 GMT Message-Id: <202302061703.316H3w21002127@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Dag-Erling=20Sm=C3=B8rgrav?= Subject: git: 6680cfe8e0ee - main - sha512_224: Fix SHA512_224_Final() on little-endian machines. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6680cfe8e0eec4427716ab50d73ab8231dd9ab28 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=6680cfe8e0eec4427716ab50d73ab8231dd9ab28 commit 6680cfe8e0eec4427716ab50d73ab8231dd9ab28 Author: Sebastian Huber AuthorDate: 2023-02-06 16:57:28 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-02-06 17:02:49 +0000 sha512_224: Fix SHA512_224_Final() on little-endian machines. PR: 266863 MFC after: 1 week Reviewed by: allanjude, cperciva, des Differential Revision: https://reviews.freebsd.org/D38372 --- sys/crypto/sha2/sha512c.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/sys/crypto/sha2/sha512c.c b/sys/crypto/sha2/sha512c.c index f18a7e6fa994..4533632500f2 100644 --- a/sys/crypto/sha2/sha512c.c +++ b/sys/crypto/sha2/sha512c.c @@ -60,23 +60,26 @@ __FBSDID("$FreeBSD$"); #else /* BYTE_ORDER != BIG_ENDIAN */ /* - * Encode a length len/4 vector of (uint64_t) into a length len vector of - * (unsigned char) in big-endian form. Assumes len is a multiple of 8. + * Encode a length (len + 7) / 8 vector of (uint64_t) into a length len + * vector of (unsigned char) in big-endian form. Assumes len is a + * multiple of 4. */ -static void +static inline void be64enc_vect(unsigned char *dst, const uint64_t *src, size_t len) { size_t i; for (i = 0; i < len / 8; i++) be64enc(dst + i * 8, src[i]); + if (len % 8 == 4) + be32enc(dst + i * 8, src[i] >> 32); } /* * Decode a big-endian length len vector of (unsigned char) into a length - * len/4 vector of (uint64_t). Assumes len is a multiple of 8. + * len/8 vector of (uint64_t). Assumes len is a multiple of 8. */ -static void +static inline void be64dec_vect(uint64_t *dst, const unsigned char *src, size_t len) { size_t i;