netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/8] crypto: Add generic Kerberos library with crypto as AEAD algorithms
@ 2025-01-10  1:03 David Howells
  2025-01-10  1:03 ` [RFC PATCH 1/8] crypto/krb5: Add some constants out of sunrpc headers David Howells
                   ` (7 more replies)
  0 siblings, 8 replies; 23+ messages in thread
From: David Howells @ 2025-01-10  1:03 UTC (permalink / raw)
  To: Herbert Xu, Chuck Lever
  Cc: David Howells, Trond Myklebust, David S. Miller, Marc Dionne,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Simon Horman,
	linux-crypto, linux-afs, linux-nfs, linux-fsdevel, netdev,
	linux-kernel

Hi Herbert, Chuck,

Here's my next go at a generic Kerberos crypto library in the kernel so
that I can share code between rxrpc and sunrpc (and cifs?).

I derived some of the parts from the sunrpc gss library and added more
advanced AES and Camellia crypto.  The crypto bits are inside AEAD
algorithms as Herbert required, but there's also a library of supplementary
functions to aid in managing message layout.

You can use:

        const struct krb5_enctype *crypto_krb5_find_enctype(u32 enctype);

to go and get an information table and this will also let you get at the
name of the AEAD algorithm associated with that encoding type number.

Each AEAD algorithm is defined for a particular Kerberos 5 type by name
(not by enctype number) and supports both encryption and checksumming
(MIC) through the AEAD encrypt/decrypt request API.

Note that the plain text may be a different size to the cipher text and
this causes the testmgr some issues as it thinks the extra data is an auth
tag (but this doesn't want auth tags).

A kerberos AEAD object is configured through its setkey method and this
takes a compound structure that indicates the mode of operation (encrypt or
checksum), the usage type and either the transport key or the subkeys.  The
setkey method allocates and keys the constituent ciphers and hashes - but
that's a detail hidden inside the object.

This library has its own self-testing framework that checks more things
than is possible with the testmgr, including subkey derivation.  It also
checks things about the output of encrypt + decrypt that testmgr doesn't.
That said, testmgr is also provisioned with some encryption and
checksumming tests for Camilla and AES2.

Note that, for purposes of illustration, I've included some rxrpc patches
that use this interface to implement the rxgk Rx security class.  The
branch also is based on net-next that carries some rxrpc patches that are a
prerequisite for this, but the crypto patches don't need it.

---
The patches can be found here also:

	http://git.kernel.org/cgit/linux/kernel/git/dhowells/linux-fs.git/log/?h=crypto-krb5

David

David Howells (8):
  crypto/krb5: Add some constants out of sunrpc headers
  crypto/krb5: Provide Kerberos 5 crypto through AEAD API
  crypto/krb5: Test manager data
  rxrpc: Add the security index for yfs-rxgk
  rxrpc: Add YFS RxGK (GSSAPI) security class
  rxrpc: rxgk: Provide infrastructure and key derivation
  rxrpc: rxgk: Implement the yfs-rxgk security class (GSSAPI)
  rxrpc: rxgk: Implement connection rekeying

 crypto/Kconfig                   |    1 +
 crypto/Makefile                  |    2 +
 crypto/aead.c                    |    2 +
 crypto/krb5/Kconfig              |   24 +
 crypto/krb5/Makefile             |   17 +
 crypto/krb5/internal.h           |  162 ++++
 crypto/krb5/kdf.c                |  334 ++++++++
 crypto/krb5/krb5_aead.c          |  462 +++++++++++
 crypto/krb5/rfc3961_simplified.c |  815 +++++++++++++++++++
 crypto/krb5/rfc6803_camellia.c   |  190 +++++
 crypto/krb5/rfc8009_aes2.c       |  394 ++++++++++
 crypto/krb5/selftest.c           |  533 +++++++++++++
 crypto/krb5/selftest_data.c      |  370 +++++++++
 crypto/testmgr.c                 |   24 +
 crypto/testmgr.h                 |  456 +++++++++++
 fs/afs/misc.c                    |   13 +
 include/crypto/aead.h            |    2 +
 include/crypto/krb5.h            |  147 ++++
 include/keys/rxrpc-type.h        |   17 +
 include/trace/events/rxrpc.h     |   36 +
 include/uapi/linux/rxrpc.h       |   17 +
 net/rxrpc/Kconfig                |   10 +
 net/rxrpc/Makefile               |    5 +-
 net/rxrpc/ar-internal.h          |   22 +
 net/rxrpc/conn_event.c           |    2 +-
 net/rxrpc/conn_object.c          |    1 +
 net/rxrpc/key.c                  |  183 +++++
 net/rxrpc/output.c               |    2 +-
 net/rxrpc/protocol.h             |   20 +
 net/rxrpc/rxgk.c                 | 1244 ++++++++++++++++++++++++++++++
 net/rxrpc/rxgk_app.c             |  318 ++++++++
 net/rxrpc/rxgk_common.h          |   58 ++
 net/rxrpc/rxgk_kdf.c             |  260 +++++++
 net/rxrpc/rxkad.c                |    6 +-
 net/rxrpc/security.c             |    3 +
 35 files changed, 6147 insertions(+), 5 deletions(-)
 create mode 100644 crypto/krb5/Kconfig
 create mode 100644 crypto/krb5/Makefile
 create mode 100644 crypto/krb5/internal.h
 create mode 100644 crypto/krb5/kdf.c
 create mode 100644 crypto/krb5/krb5_aead.c
 create mode 100644 crypto/krb5/rfc3961_simplified.c
 create mode 100644 crypto/krb5/rfc6803_camellia.c
 create mode 100644 crypto/krb5/rfc8009_aes2.c
 create mode 100644 crypto/krb5/selftest.c
 create mode 100644 crypto/krb5/selftest_data.c
 create mode 100644 include/crypto/krb5.h
 create mode 100644 net/rxrpc/rxgk.c
 create mode 100644 net/rxrpc/rxgk_app.c
 create mode 100644 net/rxrpc/rxgk_common.h
 create mode 100644 net/rxrpc/rxgk_kdf.c


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2025-01-17  8:30 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-10  1:03 [RFC PATCH 0/8] crypto: Add generic Kerberos library with crypto as AEAD algorithms David Howells
2025-01-10  1:03 ` [RFC PATCH 1/8] crypto/krb5: Add some constants out of sunrpc headers David Howells
2025-01-10  1:03 ` [RFC PATCH 2/8] crypto/krb5: Provide Kerberos 5 crypto through AEAD API David Howells
2025-01-10  5:50   ` Eric Biggers
2025-01-10  7:13     ` David Howells
2025-01-10  9:47       ` Ard Biesheuvel
2025-01-10 14:33         ` David Howells
2025-01-10  9:48   ` Herbert Xu
2025-01-10 10:26     ` David Howells
2025-01-10 10:30       ` Herbert Xu
2025-01-10 11:09         ` David Howells
2025-01-17  8:13     ` David Howells
2025-01-17  8:30       ` David Howells
2025-01-10 10:02   ` Herbert Xu
2025-01-10 10:39     ` David Howells
2025-01-10 10:42       ` Herbert Xu
2025-01-10 18:22     ` Jeffrey E Altman
2025-01-10  1:03 ` [RFC PATCH 3/8] crypto/krb5: Test manager data David Howells
2025-01-10  1:03 ` [RFC PATCH 4/8] rxrpc: Add the security index for yfs-rxgk David Howells
2025-01-10  1:03 ` [RFC PATCH 5/8] rxrpc: Add YFS RxGK (GSSAPI) security class David Howells
2025-01-10  1:03 ` [RFC PATCH 6/8] rxrpc: rxgk: Provide infrastructure and key derivation David Howells
2025-01-10  1:03 ` [RFC PATCH 7/8] rxrpc: rxgk: Implement the yfs-rxgk security class (GSSAPI) David Howells
2025-01-10  1:03 ` [RFC PATCH 8/8] rxrpc: rxgk: Implement connection rekeying David Howells

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).