From owner-dev-commits-src-all@freebsd.org Fri Mar 5 17:55:35 2021 Return-Path: Delivered-To: dev-commits-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BDF535615C6; Fri, 5 Mar 2021 17:55:35 +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 4Dsb4R4zgYz3DDG; Fri, 5 Mar 2021 17:55:35 +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 9E40C14DAE; Fri, 5 Mar 2021 17:55:35 +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 125HtZjT073705; Fri, 5 Mar 2021 17:55:35 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 125HtZsc073704; Fri, 5 Mar 2021 17:55:35 GMT (envelope-from git) Date: Fri, 5 Mar 2021 17:55:35 GMT Message-Id: <202103051755.125HtZsc073704@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: bb6e84c988d3 - main - poly1305: Don't export generic Poly1305_* symbols from xform_poly1305.c. 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: bb6e84c988d3f54eff602ed544ceaa9b9fe3e9ff Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 05 Mar 2021 17:55:35 -0000 The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=bb6e84c988d3f54eff602ed544ceaa9b9fe3e9ff commit bb6e84c988d3f54eff602ed544ceaa9b9fe3e9ff Author: John Baldwin AuthorDate: 2021-03-05 17:47:58 +0000 Commit: John Baldwin CommitDate: 2021-03-05 17:55:11 +0000 poly1305: Don't export generic Poly1305_* symbols from xform_poly1305.c. There currently isn't a need to provide a public interface to a software Poly1305 implementation beyond what is already available via libsodium's APIs and these symbols conflict with symbols shared within the ossl.ko module between ossl_poly1305.c and ossl_chacha20.c. Reported by: se, kp Fixes: 78991a93eb9d Sponsored by: Netflix --- sys/opencrypto/xform_poly1305.c | 43 ++++++++++++----------------------------- sys/opencrypto/xform_poly1305.h | 16 --------------- 2 files changed, 12 insertions(+), 47 deletions(-) diff --git a/sys/opencrypto/xform_poly1305.c b/sys/opencrypto/xform_poly1305.c index bddbb572d682..d8ceab47deca 100644 --- a/sys/opencrypto/xform_poly1305.c +++ b/sys/opencrypto/xform_poly1305.c @@ -4,7 +4,6 @@ __FBSDID("$FreeBSD$"); #include -#include #include @@ -16,16 +15,16 @@ CTASSERT(sizeof(union authctx) >= sizeof(struct poly1305_xform_ctx)); CTASSERT(POLY1305_KEY_LEN == crypto_onetimeauth_poly1305_KEYBYTES); CTASSERT(POLY1305_HASH_LEN == crypto_onetimeauth_poly1305_BYTES); -void -Poly1305_Init(void *polyctx) +static void +xform_Poly1305_Init(void *polyctx) { /* Nop */ } -void -Poly1305_Setkey(struct poly1305_xform_ctx *polyctx, - const uint8_t key[__min_size(POLY1305_KEY_LEN)], size_t klen) +static void +xform_Poly1305_Setkey(void *ctx, const uint8_t *key, u_int klen) { + struct poly1305_xform_ctx *polyctx = ctx; int rc; if (klen != POLY1305_KEY_LEN) @@ -36,16 +35,10 @@ Poly1305_Setkey(struct poly1305_xform_ctx *polyctx, panic("%s: Invariant violated: %d", __func__, rc); } -static void -xform_Poly1305_Setkey(void *ctx, const uint8_t *key, u_int klen) -{ - Poly1305_Setkey(ctx, key, klen); -} - -int -Poly1305_Update(struct poly1305_xform_ctx *polyctx, const void *data, - size_t len) +static int +xform_Poly1305_Update(void *ctx, const void *data, u_int len) { + struct poly1305_xform_ctx *polyctx = ctx; int rc; rc = crypto_onetimeauth_poly1305_update(&polyctx->state, data, len); @@ -54,16 +47,10 @@ Poly1305_Update(struct poly1305_xform_ctx *polyctx, const void *data, return (0); } -static int -xform_Poly1305_Update(void *ctx, const void *data, u_int len) -{ - return (Poly1305_Update(ctx, data, len)); -} - -void -Poly1305_Final(uint8_t digest[__min_size(POLY1305_HASH_LEN)], - struct poly1305_xform_ctx *polyctx) +static void +xform_Poly1305_Final(uint8_t *digest, void *ctx) { + struct poly1305_xform_ctx *polyctx = ctx; int rc; rc = crypto_onetimeauth_poly1305_final(&polyctx->state, digest); @@ -71,12 +58,6 @@ Poly1305_Final(uint8_t digest[__min_size(POLY1305_HASH_LEN)], panic("%s: Invariant violated: %d", __func__, rc); } -static void -xform_Poly1305_Final(uint8_t *digest, void *ctx) -{ - Poly1305_Final(digest, ctx); -} - struct auth_hash auth_hash_poly1305 = { .type = CRYPTO_POLY1305, .name = "Poly-1305", @@ -84,7 +65,7 @@ struct auth_hash auth_hash_poly1305 = { .hashsize = POLY1305_HASH_LEN, .ctxsize = sizeof(struct poly1305_xform_ctx), .blocksize = crypto_onetimeauth_poly1305_BYTES, - .Init = Poly1305_Init, + .Init = xform_Poly1305_Init, .Setkey = xform_Poly1305_Setkey, .Update = xform_Poly1305_Update, .Final = xform_Poly1305_Final, diff --git a/sys/opencrypto/xform_poly1305.h b/sys/opencrypto/xform_poly1305.h deleted file mode 100644 index cca1c6af9395..000000000000 --- a/sys/opencrypto/xform_poly1305.h +++ /dev/null @@ -1,16 +0,0 @@ -/* This file is in the public domain. */ -/* $FreeBSD$ */ -#pragma once - -#include - -struct poly1305_xform_ctx; - -void Poly1305_Init(void *); - -void Poly1305_Setkey(struct poly1305_xform_ctx *, - const uint8_t [__min_size(32)], size_t); - -int Poly1305_Update(struct poly1305_xform_ctx *, const void *, size_t); - -void Poly1305_Final(uint8_t [__min_size(16)], struct poly1305_xform_ctx *);