git: 47fc04958562 - main - crypto: Define POLY1305_BLOCK_LEN constant.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 16 Dec 2021 22:09:25 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=47fc04958562e3a1fca06f9321f89bea3d1dcab7

commit 47fc04958562e3a1fca06f9321f89bea3d1dcab7
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2021-12-16 21:47:16 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2021-12-16 21:47:16 +0000

    crypto: Define POLY1305_BLOCK_LEN constant.
    
    Reviewed by:    markj
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D33485
---
 sys/opencrypto/cryptodev.h      | 1 +
 sys/opencrypto/xform_poly1305.c | 3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/sys/opencrypto/cryptodev.h b/sys/opencrypto/cryptodev.h
index 6611a8925020..a46ccb71f7f1 100644
--- a/sys/opencrypto/cryptodev.h
+++ b/sys/opencrypto/cryptodev.h
@@ -95,6 +95,7 @@
 #define	SHA2_256_BLOCK_LEN	64
 #define	SHA2_384_BLOCK_LEN	128
 #define	SHA2_512_BLOCK_LEN	128
+#define	POLY1305_BLOCK_LEN	16
 
 /* HMAC values */
 #define	NULL_HMAC_BLOCK_LEN		64
diff --git a/sys/opencrypto/xform_poly1305.c b/sys/opencrypto/xform_poly1305.c
index c885192f9df6..5620c2c42d7d 100644
--- a/sys/opencrypto/xform_poly1305.c
+++ b/sys/opencrypto/xform_poly1305.c
@@ -14,6 +14,7 @@ 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);
+CTASSERT(POLY1305_BLOCK_LEN == crypto_onetimeauth_poly1305_BYTES);
 
 static void
 xform_Poly1305_Init(void *polyctx)
@@ -64,7 +65,7 @@ const struct auth_hash auth_hash_poly1305 = {
 	.keysize = POLY1305_KEY_LEN,
 	.hashsize = POLY1305_HASH_LEN,
 	.ctxsize = sizeof(struct poly1305_xform_ctx),
-	.blocksize = crypto_onetimeauth_poly1305_BYTES,
+	.blocksize = POLY1305_BLOCK_LEN,
 	.Init = xform_Poly1305_Init,
 	.Setkey = xform_Poly1305_Setkey,
 	.Update = xform_Poly1305_Update,