]> git.ipfire.org Git - thirdparty/openssl.git/commit
Add serialization for SHA-2 digest contexts
authorSimo Sorce <simo@redhat.com>
Thu, 9 Oct 2025 22:27:42 +0000 (18:27 -0400)
committerDmitry Belyavskiy <beldmit@gmail.com>
Fri, 12 Dec 2025 08:08:33 +0000 (09:08 +0100)
commit1afb05b6035cfe7a748e9152e72832e760bab3dc
tree33b5465e24680beef743e9fb4ccdae15b5bcf549
parentc1f66c1ec33763de0d5e94e66039238729ef9c4b
Add serialization for SHA-2 digest contexts

This commit introduces the ability to serialize and deserialize the internal
state of SHA-2 digest contexts (SHA-256 and SHA-512 families).

This functionality is exposed via the new OSSL_DIGEST_SERIALIZATION parameter,
which can be used with EVP_MD_CTX_get_params() to retrieve the state and with
EVP_DigestInit_ex2() to restore it into a new context.

This allows an application to save the state of a hash operation and resume it
later, which is useful for process migration or for saving the state of long-
unning computations. A new test case has been added to verify this.

Signed-off-by: Simo Sorce <simo@redhat.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/28837)
.clang-format
providers/implementations/digests/sha2_prov.c
providers/implementations/include/prov/digestcommon.h
test/evp_extra_test2.c