ALT Linux kernel packages development
 help / color / mirror / Atom feed
From: "Ivan A. Melnikov" <iv@altlinux.org>
To: ALT Linux kernel packages development
	<devel-kernel@lists.altlinux.org>,
	 Alexey Shabalin <shaba@altlinux.org>
Subject: Re: [d-kernel] [PATCH v2 6.12/sisyphus 11/29] crypto/krb5: Implement the AES enctypes from rfc3962
Date: Fri, 20 Nov 2026 20:45:25 +0400
Message-ID: <awBzLtC98ICjTqdE@iv-alt> (raw)
In-Reply-To: <20261118144935.3872281-12-shaba@altlinux.org>

[-- Attachment #1: Type: text/plain, Size: 8768 bytes --]

On Wed, Nov 18, 2026 at 05:49:17PM +0300, Alexey Shabalin wrote:
> From: David Howells <dhowells@redhat.com>
> 
> Implement the aes128-cts-hmac-sha1-96 and aes256-cts-hmac-sha1-96 enctypes
> from rfc3962, using the rfc3961 kerberos 5 simplified crypto scheme.
> 
> Signed-off-by: David Howells <dhowells@redhat.com>
> cc: Herbert Xu <herbert@gondor.apana.org.au>
> cc: "David S. Miller" <davem@davemloft.net>
> cc: Chuck Lever <chuck.lever@oracle.com>
> cc: Marc Dionne <marc.dionne@auristor.com>
> cc: Eric Dumazet <edumazet@google.com>
> cc: Jakub Kicinski <kuba@kernel.org>
> cc: Paolo Abeni <pabeni@redhat.com>
> cc: Simon Horman <horms@kernel.org>
> cc: linux-afs@lists.infradead.org
> cc: linux-nfs@vger.kernel.org
> cc: linux-crypto@vger.kernel.org
> cc: netdev@vger.kernel.org
> (cherry picked from commit 7c164b66b276c49b3888d3280e1b70a85732a38c)
> Signed-off-by: Alexey Shabalin <shaba@altlinux.org>
> ---
>  crypto/krb5/Kconfig       |   1 +
>  crypto/krb5/Makefile      |   3 +-
>  crypto/krb5/internal.h    |   6 ++
>  crypto/krb5/krb5_api.c    |   2 +
>  crypto/krb5/rfc3962_aes.c | 115 ++++++++++++++++++++++++++++++++++++++
>  5 files changed, 126 insertions(+), 1 deletion(-)
>  create mode 100644 crypto/krb5/rfc3962_aes.c
> 
> diff --git a/crypto/krb5/Kconfig b/crypto/krb5/Kconfig
> index 079873618abf..2ad874990dc8 100644
> --- a/crypto/krb5/Kconfig
> +++ b/crypto/krb5/Kconfig
> @@ -5,6 +5,7 @@ config CRYPTO_KRB5
>  	select CRYPTO_AUTHENC
>  	select CRYPTO_SKCIPHER
>  	select CRYPTO_HASH_INFO
> +	select CRYPTO_HMAC
>  	select CRYPTO_SHA1
>  	select CRYPTO_CBC
>  	select CRYPTO_CTS
> diff --git a/crypto/krb5/Makefile b/crypto/krb5/Makefile
> index 8dad8e3bf086..35f21411abf8 100644
> --- a/crypto/krb5/Makefile
> +++ b/crypto/krb5/Makefile
> @@ -6,6 +6,7 @@
>  krb5-y += \
>  	krb5_kdf.o \
>  	krb5_api.o \
> -	rfc3961_simplified.o
> +	rfc3961_simplified.o \
> +	rfc3962_aes.o
>  
>  obj-$(CONFIG_CRYPTO_KRB5) += krb5.o
> diff --git a/crypto/krb5/internal.h b/crypto/krb5/internal.h
> index 07a47ddf3ea9..43f904a69e32 100644
> --- a/crypto/krb5/internal.h
> +++ b/crypto/krb5/internal.h
> @@ -179,3 +179,9 @@ int rfc3961_verify_mic(const struct krb5_enctype *krb5,
>  		       const struct krb5_buffer *metadata,
>  		       struct scatterlist *sg, unsigned int nr_sg,
>  		       size_t *_offset, size_t *_len);
> +
> +/*
> + * rfc3962_aes.c
> + */
> +extern const struct krb5_enctype krb5_aes128_cts_hmac_sha1_96;
> +extern const struct krb5_enctype krb5_aes256_cts_hmac_sha1_96;
> diff --git a/crypto/krb5/krb5_api.c b/crypto/krb5/krb5_api.c
> index 8fc3a1b9d4ad..ecc6655953d5 100644
> --- a/crypto/krb5/krb5_api.c
> +++ b/crypto/krb5/krb5_api.c
> @@ -17,6 +17,8 @@ MODULE_AUTHOR("Red Hat, Inc.");
>  MODULE_LICENSE("GPL");
>  
>  static const struct krb5_enctype *const krb5_supported_enctypes[] = {
> +	&krb5_aes128_cts_hmac_sha1_96,
> +	&krb5_aes256_cts_hmac_sha1_96,
>  };
>  
>  /**
> diff --git a/crypto/krb5/rfc3962_aes.c b/crypto/krb5/rfc3962_aes.c
> new file mode 100644
> index 000000000000..5cbf8f4638b9
> --- /dev/null
> +++ b/crypto/krb5/rfc3962_aes.c
> @@ -0,0 +1,115 @@
> +// SPDX-License-Identifier: BSD-3-Clause
> +/* rfc3962 Advanced Encryption Standard (AES) Encryption for Kerberos 5
> + *
> + * Parts borrowed from net/sunrpc/auth_gss/.
> + */
> +/*
> + * COPYRIGHT (c) 2008
> + * The Regents of the University of Michigan
> + * ALL RIGHTS RESERVED
> + *
> + * Permission is granted to use, copy, create derivative works
> + * and redistribute this software and such derivative works
> + * for any purpose, so long as the name of The University of
> + * Michigan is not used in any advertising or publicity
> + * pertaining to the use of distribution of this software
> + * without specific, written prior authorization.  If the
> + * above copyright notice or any other identification of the
> + * University of Michigan is included in any copy of any
> + * portion of this software, then the disclaimer below must
> + * also be included.
> + *
> + * THIS SOFTWARE IS PROVIDED AS IS, WITHOUT REPRESENTATION
> + * FROM THE UNIVERSITY OF MICHIGAN AS TO ITS FITNESS FOR ANY
> + * PURPOSE, AND WITHOUT WARRANTY BY THE UNIVERSITY OF
> + * MICHIGAN OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
> + * WITHOUT LIMITATION THE IMPLIED WARRANTIES OF
> + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
> + * REGENTS OF THE UNIVERSITY OF MICHIGAN SHALL NOT BE LIABLE
> + * FOR ANY DAMAGES, INCLUDING SPECIAL, INDIRECT, INCIDENTAL, OR
> + * CONSEQUENTIAL DAMAGES, WITH RESPECT TO ANY CLAIM ARISING
> + * OUT OF OR IN CONNECTION WITH THE USE OF THE SOFTWARE, EVEN
> + * IF IT HAS BEEN OR IS HEREAFTER ADVISED OF THE POSSIBILITY OF
> + * SUCH DAMAGES.
> + */
> +
> +/*
> + * Copyright (C) 1998 by the FundsXpress, INC.
> + *
> + * All rights reserved.
> + *
> + * Export of this software from the United States of America may require
> + * a specific license from the United States Government.  It is the
> + * responsibility of any person or organization contemplating export to
> + * obtain such a license before exporting.
> + *
> + * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
> + * distribute this software and its documentation for any purpose and
> + * without fee is hereby granted, provided that the above copyright
> + * notice appear in all copies and that both that copyright notice and
> + * this permission notice appear in supporting documentation, and that
> + * the name of FundsXpress. not be used in advertising or publicity pertaining
> + * to distribution of the software without specific, written prior
> + * permission.  FundsXpress makes no representations about the suitability of
> + * this software for any purpose.  It is provided "as is" without express
> + * or implied warranty.
> + *
> + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
> + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
> + * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
> + */
> +
> +/*
> + * Copyright (C) 2025 Red Hat, Inc. All Rights Reserved.
> + * Written by David Howells (dhowells@redhat.com)
> + */
> +
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> +#include "internal.h"
> +
> +const struct krb5_enctype krb5_aes128_cts_hmac_sha1_96 = {
> +	.etype		= KRB5_ENCTYPE_AES128_CTS_HMAC_SHA1_96,
> +	.ctype		= KRB5_CKSUMTYPE_HMAC_SHA1_96_AES128,
> +	.name		= "aes128-cts-hmac-sha1-96",
> +	.encrypt_name	= "krb5enc(hmac(sha1),cts(cbc(aes)))",

Here krb5enc template is used, but it is not part of the series,
nor is present in 6.12. This looks problematic to me, as
these enctypes are exposed via crypto_krb5_find_enctype(...).

Of course, ceph hardcodes KRB5_ENCTYPE_AES256_CTS_HMAC_SHA384_192
when calls crypto_krb5_find_enctype, so it's not problem
for the intended usecase of the series; and there are no other in-tree
callers of this function. But it's exported, and we should not
present such half-backproted stuff to out-of-tree modules,
or any other in-tree caller that might appear in the future.

Please either backport upstream commit d1775a177f7f ("crypto: Add
'krb5enc' hash and cipher AEAD algorithm") with all its fixes,
or drop the enctypes that use "krb5enc" enctype from the series.

> +	.cksum_name	= "hmac(sha1)",
> +	.hash_name	= "sha1",
> +	.derivation_enc	= "cts(cbc(aes))",
> +	.key_bytes	= 16,
> +	.key_len	= 16,
> +	.Kc_len		= 16,
> +	.Ke_len		= 16,
> +	.Ki_len		= 16,
> +	.block_len	= 16,
> +	.conf_len	= 16,
> +	.cksum_len	= 12,
> +	.hash_len	= 20,
> +	.prf_len	= 16,
> +	.keyed_cksum	= true,
> +	.random_to_key	= NULL, /* Identity */
> +	.profile	= &rfc3961_simplified_profile,
> +};
> +
> +const struct krb5_enctype krb5_aes256_cts_hmac_sha1_96 = {
> +	.etype		= KRB5_ENCTYPE_AES256_CTS_HMAC_SHA1_96,
> +	.ctype		= KRB5_CKSUMTYPE_HMAC_SHA1_96_AES256,
> +	.name		= "aes256-cts-hmac-sha1-96",
> +	.encrypt_name	= "krb5enc(hmac(sha1),cts(cbc(aes)))",
> +	.cksum_name	= "hmac(sha1)",
> +	.hash_name	= "sha1",
> +	.derivation_enc	= "cts(cbc(aes))",
> +	.key_bytes	= 32,
> +	.key_len	= 32,
> +	.Kc_len		= 32,
> +	.Ke_len		= 32,
> +	.Ki_len		= 32,
> +	.block_len	= 16,
> +	.conf_len	= 16,
> +	.cksum_len	= 12,
> +	.hash_len	= 20,
> +	.prf_len	= 16,
> +	.keyed_cksum	= true,
> +	.random_to_key	= NULL, /* Identity */
> +	.profile	= &rfc3961_simplified_profile,
> +};
> -- 
> 2.50.1
> 
> _______________________________________________
> devel-kernel mailing list
> devel-kernel@lists.altlinux.org
> https://lists.altlinux.org/mailman/listinfo/devel-kernel

-- 
  wbr,
    iv m.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 870 bytes --]

  reply	other threads:[~2026-11-20 16:45 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 14:49 [d-kernel] [PATCH v2 6.12/sisyphus 0/29] libceph: add support for AES256KRB5 (aes256k) cephx keys Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 01/29] crypto/krb5: Add some constants out of sunrpc headers Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 02/29] crypto/krb5: Implement Kerberos crypto core Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 03/29] crypto/krb5: Add an API to query the layout of the crypto section Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 04/29] crypto/krb5: Add an API to alloc and prepare a crypto object Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 05/29] crypto/krb5: Add an API to perform requests Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 06/29] crypto/krb5: Provide infrastructure and key derivation Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 07/29] crypto/krb5: Implement the Kerberos5 rfc3961 " Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 08/29] crypto/krb5: Provide RFC3961 setkey packaging functions Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 09/29] crypto/krb5: Implement the Kerberos5 rfc3961 encrypt and decrypt functions Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 10/29] crypto/krb5: Implement the Kerberos5 rfc3961 get_mic and verify_mic Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 11/29] crypto/krb5: Implement the AES enctypes from rfc3962 Alexey Shabalin
2026-11-20 16:45   ` Ivan A. Melnikov [this message]
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 12/29] crypto/krb5: Implement the AES enctypes from rfc8009 Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 13/29] crypto/krb5: Implement the Camellia enctypes from rfc6803 Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 14/29] crypto/krb5: Implement crypto self-testing Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 15/29] lib/scatterlist: Add SG_MITER_LOCAL and use it Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 16/29] crypto: krb5 - Use SG miter instead of doing it by hand Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 17/29] crypto/krb5: Fix change to use SG miter to use offset Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 18/29] crypto: krb5 - Fix memory leak in krb5_test_one_prf() Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 19/29] crypto/krb5: Add API Documentation Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 20/29] crypto/krb5, rxrpc: Fix lack of pre-decrypt/pre-verify length checks Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 21/29] crypto: krb5 - filter out async aead implementations at alloc Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 22/29] crypto: krb5 - use kfree_sensitive() for derived key buffers Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 23/29] libceph: Rename hmac_sha256() to ceph_hmac_sha256() Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 24/29] libceph: generalize ceph_x_encrypt_offset() and ceph_x_encrypt_buflen() Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 25/29] libceph: Remove unused ceph_crypto_key_encode Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 26/29] libceph: introduce ceph_crypto_key_prepare() Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 27/29] libceph: add support for CEPH_CRYPTO_AES256KRB5 Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 28/29] libceph: adapt ceph_x_challenge_blob hashing and msgr1 message signing Alexey Shabalin
2026-11-18 14:49 ` [d-kernel] [PATCH v2 6.12/sisyphus 29/29] config: enable CONFIG_CRYPTO_KRB5 Alexey Shabalin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=awBzLtC98ICjTqdE@iv-alt \
    --to=iv@altlinux.org \
    --cc=devel-kernel@lists.altlinux.org \
    --cc=shaba@altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux kernel packages development

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel-kernel/0 devel-kernel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel-kernel devel-kernel/ http://lore.altlinux.org/devel-kernel \
		devel-kernel@altlinux.org devel-kernel@altlinux.ru devel-kernel@altlinux.com
	public-inbox-index devel-kernel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git