From nobody Fri Dec 17 22:00:08 2021 X-Original-To: dev-commits-src-all@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 093AA18F5E02; Fri, 17 Dec 2021 22:00:09 +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 4JG2w852fgz3t04; Fri, 17 Dec 2021 22:00:08 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 8E69C23AE8; Fri, 17 Dec 2021 22:00:08 +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 1BHM08Ql006212; Fri, 17 Dec 2021 22:00:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1BHM08x8006209; Fri, 17 Dec 2021 22:00:08 GMT (envelope-from git) Date: Fri, 17 Dec 2021 22:00:08 GMT Message-Id: <202112172200.1BHM08x8006209@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 1c9b25a5e8b5 - main - cryptosoft: Reuse 'blk' to hold the initial nonce in swcr_gmac. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1c9b25a5e8b536905b2a707159986f1a4b37f91c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1639778408; 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=FCMm3v2Ptr57+QeWVoJJIeQ5AH0hCJcoXaun7bc90eU=; b=BwLs1FckF4mKQGhmBb85S7WHY/7IBnrssisgi+M2OPre3gft2qNT3OgnajT8NM+COa+rdw +rQVA9dgdXbbvRb/hsVvCSXrrnxkWIi/5MDGDXCYxknl2BF5SEpHcpJm2T75K33WaAnFur y61It7VwUuBSmWGukoVswc/jqqgam6w8A9bvo7FGRwd1zZa5vEB6PLUOeF0EllbO9NL01i p1UmDXFTGWAXpgyFsFll0x3UycP8qcPD7kHdi12WSYmeq4J8MEQzHeJtHwzLZHZlOmBGU9 QHKQjOrfwkRD06xGExVGlaHGavdgREhbZff4VxM73igds0QrfyohuyjriZ5wzg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1639778408; a=rsa-sha256; cv=none; b=HBnh6vV7oQxDrxoTGmtdBy0GuBVU0RATPt9lOFZZXsirGTx0eBgDzGXEgYRTxsFJbgU/De YHBEy9alisGXn9vYedkFzTJobBsCMA/hziheMVUyWPEC0E6lHSDz9OJn9AjjflitiDYfrX dpdI/tMh9uMIGIjcJyKup00ktO6DHvuhT1u8ZQUI8Og7tjJj4BRhspM7rALIlMIVbAyFz3 5PPQv1KQHAvd94EJwgvO3W+x26M//YJZ+OerYxj4WTTNyqEc9CBIcpU3OKqY8zGzPZG4vM OolaZCccQn8obUarBKOe7NDqN+DXBchMGqqcbKdLKy7cARiBr1BDuMwKjz0EhA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=1c9b25a5e8b536905b2a707159986f1a4b37f91c commit 1c9b25a5e8b536905b2a707159986f1a4b37f91c Author: John Baldwin AuthorDate: 2021-12-17 21:58:58 +0000 Commit: John Baldwin CommitDate: 2021-12-17 21:58:58 +0000 cryptosoft: Reuse 'blk' to hold the initial nonce in swcr_gmac. Reusing the storage removes the need for an additional explicit_bzero. Reviewed by: markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33526 --- sys/opencrypto/cryptosoft.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sys/opencrypto/cryptosoft.c b/sys/opencrypto/cryptosoft.c index 6f03902498b1..8d39eec19b88 100644 --- a/sys/opencrypto/cryptosoft.c +++ b/sys/opencrypto/cryptosoft.c @@ -320,7 +320,6 @@ swcr_gmac(const struct swcr_session *ses, struct cryptop *crp) uint32_t blkbuf[howmany(AES_BLOCK_LEN, sizeof(uint32_t))]; u_char *blk = (u_char *)blkbuf; u_char tag[GMAC_DIGEST_LEN]; - u_char iv[AES_BLOCK_LEN]; struct crypto_buffer_cursor cc; const u_char *inblk; union authctx ctx; @@ -345,9 +344,9 @@ swcr_gmac(const struct swcr_session *ses, struct cryptop *crp) /* Initialize the IV */ ivlen = AES_GCM_IV_LEN; - crypto_read_iv(crp, iv); + crypto_read_iv(crp, blk); - axf->Reinit(&ctx, iv, ivlen); + axf->Reinit(&ctx, blk, ivlen); crypto_cursor_init(&cc, &crp->crp_buf); crypto_cursor_advance(&cc, crp->crp_payload_start); for (resid = crp->crp_payload_length; resid >= blksz; resid -= len) { @@ -392,7 +391,6 @@ swcr_gmac(const struct swcr_session *ses, struct cryptop *crp) } explicit_bzero(blkbuf, sizeof(blkbuf)); explicit_bzero(tag, sizeof(tag)); - explicit_bzero(iv, sizeof(iv)); return (error); }