]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
crypto/sha3: fix errno when freeing
authorPaul Eggert <eggert@cs.ucla.edu>
Sun, 22 Feb 2026 17:58:37 +0000 (09:58 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 23 Feb 2026 00:18:30 +0000 (16:18 -0800)
* lib/sha3.c (sha3_free_ctx): Preserve errno.
* modules/crypto/sha3 (Depends-on):
* modules/crypto/sha3-buffer (Depends-on):
Depend on free-posix.

ChangeLog
lib/sha3.c
modules/crypto/sha3
modules/crypto/sha3-buffer

index 47606778bc250955f9483b4569ce772a420cf41d..cabca53248ba592da28a56eb6a10e81a6ee70ad1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2026-02-22  Paul Eggert  <eggert@cs.ucla.edu>
 
+       crypto/sha3: fix errno when freeing
+       * lib/sha3.c (sha3_free_ctx): Preserve errno.
+       * modules/crypto/sha3 (Depends-on):
+       * modules/crypto/sha3-buffer (Depends-on):
+       Depend on free-posix.
+
        crypto/sha3: fix memory leak with OpenSSL wrapper
        * lib/sha3.c (sha3_##SIZE##_buffer):
        Free ctx before returning.
index f7ca3c4abb528ffff24e39bdd9b24d0e63481a83..2a97190e07c8bca5e9f8a3d6e94b03bdbdb80b05 100644 (file)
@@ -364,8 +364,10 @@ sha3_free_ctx (struct sha3_ctx *ctx)
 {
   if (ctx->evp_ctx != NULL)
     {
+      int saved_errno = errno;
       EVP_MD_CTX_free (ctx->evp_ctx);
       ctx->evp_ctx = NULL;
+      errno = saved_errno;
     }
 }
 
index f2b878794a294c6e8e70f9e2f82893fcf2e9e3a0..50e2ead34f1654755c8e2cd4b233b091cdbebd45 100644 (file)
@@ -7,6 +7,7 @@ lib/sha3-stream.c
 Depends-on:
 crypto/af_alg
 crypto/sha3-buffer
+free-posix
 
 configure.ac:
 
index 7ab61dea30c2d263123e734fb99bb2e062890aaa..00c2f230a484fd21198b66949f67f2e02dcd1c61 100644 (file)
@@ -11,6 +11,7 @@ Depends-on:
 bool
 byteswap
 c99
+free-posix
 stddef-h
 stdint-h
 u64