]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
ossl: Keep mutable AES-GCM state on the stack
authorMark Johnston <markj@FreeBSD.org>
Wed, 29 Nov 2023 17:51:55 +0000 (12:51 -0500)
committerMark Johnston <markj@FreeBSD.org>
Wed, 29 Nov 2023 17:55:51 +0000 (12:55 -0500)
commit5c0dac0b7a012f326edab06ad85aee5ad68ff120
tree8c73ffbd3a7df3c4253d4175fd7a1dbbc519d93b
parentdb0a4f2d7a654250f329241c6bd3f535be9a05bc
ossl: Keep mutable AES-GCM state on the stack

ossl(4)'s AES-GCM implementation keeps mutable state in the session
structure, together with the key schedule.  This was done for
convenience, as both are initialized together.  However, some OCF
consumers, particularly ZFS, assume that requests may be dispatched to
the same session in parallel.  Without serialization, this results in
incorrect output.

Fix the problem by explicitly copying per-session state onto the stack
at the beginning of each operation.

PR: 275306
Reviewed by: jhb
Fixes: 9a3444d91c70 ("ossl: Add a VAES-based AES-GCM implementation for amd64")
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D42783
sys/crypto/openssl/ossl_aes.c