summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorCollin Funk <collin.funk1@gmail.com>2026-02-23 00:20:46 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2026-02-23 00:22:17 -0800
commit29440eedac7968580e35e751c6cdf94af337a95a (patch)
tree511fa2df3d1459c9e3d53d088856194d2123af38 /m4
parentccaa4a07f093428241cbcc81379c3ea3d84b38ee (diff)
Add SHA-3 support to secure-hash
* admin/merge-gnulib (GNULIB_MODULES): Add crypto/sha3-buffer. * lib/sha3.c: New file, imported by running admin/merge-gnulib. * lib/sha3.h: Likewise. * m4/sha3.m4: Likewise. * lib/gnulib.mk.in: Updated by admin/merge-gnulib. * m4/gnulib-comp.m4: Likewise. * src/fns.c: Include sha3.h (Fsecure_hash_algorithms): Add Qsha3_224, Qsha3_256, Qsha3_384, and Qsha3_512. (secure_hash): Likewise. (Fsecure_hash): List the SHA-3 algorithms in the docstring. (syms_of_fns): Define Qsha3_224, Qsha3_256, Qsha3_384, and Qsha3_512. * test/lisp/net/gnutls-tests.el (gnutls-tests-internal-macs-upcased): Filter out the new SHA-3 algorithms since they are currently not implemented in gnutls. * test/src/fns-tests.el (test-secure-hash): Add test cases for the new algorithms. * doc/lispref/text.texi (Checksum/Hash): List the SHA-3 algorithms. Mention that they are considered secure. * etc/NEWS: Mention the new feature.
Diffstat (limited to 'm4')
-rw-r--r--m4/gnulib-comp.m46
-rw-r--r--m4/sha3.m416
2 files changed, 22 insertions, 0 deletions
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index 5e5906949de..984f657e2ed 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -70,6 +70,7 @@ AC_DEFUN([gl_EARLY],
# Code from module crypto/md5-buffer:
# Code from module crypto/sha1-buffer:
# Code from module crypto/sha256-buffer:
+ # Code from module crypto/sha3-buffer:
# Code from module crypto/sha512-buffer:
# Code from module d-type:
# Code from module diffseq:
@@ -286,6 +287,8 @@ AC_DEFUN([gl_INIT],
AC_REQUIRE([AC_C_RESTRICT])
gl_SHA256
AC_REQUIRE([AC_C_RESTRICT])
+ gl_SHA3
+ AC_REQUIRE([AC_C_RESTRICT])
gl_SHA512
gl_CHECK_TYPE_STRUCT_DIRENT_D_TYPE
gl_DIRENT_H
@@ -1445,6 +1448,8 @@ AC_DEFUN([gl_FILE_LIST], [
lib/sha1.h
lib/sha256.c
lib/sha256.h
+ lib/sha3.c
+ lib/sha3.h
lib/sha512.c
lib/sha512.h
lib/sig2str.c
@@ -1609,6 +1614,7 @@ AC_DEFUN([gl_FILE_LIST], [
m4/selinux-selinux-h.m4
m4/sha1.m4
m4/sha256.m4
+ m4/sha3.m4
m4/sha512.m4
m4/sig2str.m4
m4/sigdescr_np.m4
diff --git a/m4/sha3.m4 b/m4/sha3.m4
new file mode 100644
index 00000000000..4b282bcda44
--- /dev/null
+++ b/m4/sha3.m4
@@ -0,0 +1,16 @@
+# sha3.m4
+# serial 1
+dnl Copyright (C) 2025-2026 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+dnl This file is offered as-is, without any warranty.
+
+AC_DEFUN([gl_SHA3],
+[
+ dnl Prerequisites of lib/sha3.c.
+ AC_REQUIRE([gl_BIGENDIAN])
+
+ dnl Determine HAVE_OPENSSL_SHA3 and LIB_CRYPTO
+ gl_CRYPTO_CHECK([SHA3])
+])