]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
cryptosoft: Fully support per-operation keys for auth algorithms.
authorJohn Baldwin <jhb@FreeBSD.org>
Thu, 9 Dec 2021 19:52:42 +0000 (11:52 -0800)
committerJohn Baldwin <jhb@FreeBSD.org>
Thu, 9 Dec 2021 19:52:42 +0000 (11:52 -0800)
commit6113a08b98e403de5b92cc0a30fdc60489eccc48
tree60d1c0be000b44f91e48f077912edd01076e7f94
parentb54d12841e1a188e37bca943f003ad340492a4cd
cryptosoft: Fully support per-operation keys for auth algorithms.

Only pre-allocate auth contexts when a session-wide key is provided or
for sessions without keys.  For sessions with per-operation keys,
always initialize the on-stack context directly rather than
initializing the session context in swcr_authprepare (now removed) and
then copying that session context into the on-stack context.

This approach permits parallel auth operations without needing a
serializing lock.  In addition, the previous code assumed that auth
sessions always provided an initial key unlike cipher sessions which
assume either an initial key or per-op keys.

While here, fix the Blake2 auth transforms to function like other auth
transforms where Setkey is invoked after Init rather than before.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33316
sys/crypto/blake2/blake2-sw.c
sys/opencrypto/cryptosoft.c