master d71a399fdda 2/2: Remove lib/af_alg.h, to adjust to recent Gnulib

Paul Eggert <[email protected]> Fri, 17 Jul 2026 17:09:29 -0400 (EDT)
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: master
commit d71a399fdda45acf32a13a2a8febc090683c266f
Author: Paul Eggert <[email protected]>
Commit: Paul Eggert <[email protected]>

    Remove lib/af_alg.h, to adjust to recent Gnulib
    
    Gnulib deprecated the crypto/af_alg module,
    following the deprecation of the AF_ALG API in Linux 7.2.
    This means Emacs needs to do less work to avoid using it.
    * admin/merge-gnulib (AVOIDED_MODULES):
    Remove crypto/af_alg as we no longer need to avoid it.
    * configure.ac (emacs_files): Omit lib/af_alg.h.
    * lib/af_alg.h: Remove; no longer used.
    * lib/gnulib.mk.in: Regenerate.
---
 admin/merge-gnulib |   5 +--
 configure.ac       |   8 ++--
 lib/af_alg.h       | 115 -----------------------------------------------------
 lib/gnulib.mk.in   |   1 -
 4 files changed, 6 insertions(+), 123 deletions(-)

diff --git a/admin/merge-gnulib b/admin/merge-gnulib
index 8c906d34cef..eca94e12d9a 100755
--- a/admin/merge-gnulib
+++ b/admin/merge-gnulib
@@ -61,7 +61,7 @@ AVOIDED_MODULES='
   access btoc32
   c32_apply_type_test c32_get_type_test
   c32isalnum c32rtomb c32tolower c32toupper
-  chmod close crypto/af_alg dup fchdir fstat gnulib-i18n
+  chmod close dup fchdir fstat gnulib-i18n
   langinfo-h libgmp-mpq
   localcharset localeinfo localename-unsafe-limited lock
   mbrtoc32-regular mbsinit memchr mkdir
@@ -164,8 +164,7 @@ cp -- "$gnulib_srcdir"/build-aux/config.guess \
       "$gnulib_srcdir"/build-aux/install-sh \
       "$gnulib_srcdir"/build-aux/move-if-change \
    "$src"build-aux &&
-cp -- "$gnulib_srcdir"/lib/af_alg.h \
-      "$gnulib_srcdir"/lib/save-cwd.h \
+cp -- "$gnulib_srcdir"/lib/save-cwd.h \
    "$src"lib &&
 cp -- "$gnulib_srcdir"/m4/codeset.m4 \
    "$src"m4 &&
diff --git a/configure.ac b/configure.ac
index f19ba664aac..897cc7870a1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7882,10 +7882,10 @@ if test "$XCONFIGURE" != "android"; then
   AS_MKDIR_P([cross/etc])
 
   AS_IF([test "x$with_android" != "xno"], [
-    dnl Link gnulib files to cross/lib as well.  af_alg.h and
-    dnl lib/save-cwd.h are copied manually from gnulib, and as such
-    dnl aren't specified in gl_FILE_LIST.
-    emacs_files='gl_FILE_LIST lib/af_alg.h lib/save-cwd.h'
+    dnl Link gnulib files to cross/lib as well.
+    dnl lib/save-cwd.h is copied manually from gnulib,
+    dnl and as such isn't specified in gl_FILE_LIST.
+    emacs_files='gl_FILE_LIST lib/save-cwd.h'
     dnl These files are specific to Emacs.
     emacs_files="$emacs_files lib/fingerprint.c lib/fingerprint.h \
 		   lib/save-cwd.c lib/openat-die.c lib/save-cwd.c \
diff --git a/lib/af_alg.h b/lib/af_alg.h
deleted file mode 100644
index 6272d1ecbbb..00000000000
--- a/lib/af_alg.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* af_alg.h - Compute message digests from file streams and buffers.
-   Copyright (C) 2018-2026 Free Software Foundation, Inc.
-
-   This file is free software: you can redistribute it and/or modify
-   it under the terms of the GNU Lesser General Public License as
-   published by the Free Software Foundation; either version 2.1 of the
-   License, or (at your option) any later version.
-
-   This file is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public License
-   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
-
-/* Written by Matteo Croce <[email protected]>, 2018.
-   Documentation by Bruno Haible <[email protected]>, 2018.  */
-
-/* Declare specific functions for computing message digests
-   using the Linux kernel crypto API, if available.  This kernel API gives
-   access to specialized crypto instructions (that would also be available
-   in user space) or to crypto devices (not directly available in user space).
-
-   For a more complete set of facilities that use the Linux kernel crypto API,
-   look at libkcapi.  */
-
-#ifndef AF_ALG_H
-# define AF_ALG_H 1
-
-# include <stdio.h>
-# include <errno.h>
-
-# ifdef __cplusplus
-extern "C" {
-# endif
-
-# if USE_LINUX_CRYPTO_API
-
-/* Compute a message digest of a memory region.
-
-   The memory region starts at BUFFER and is LEN bytes long.
-
-   ALG is the message digest algorithm; see the file /proc/crypto.
-
-   RESBLOCK points to a block of HASHLEN bytes, for the result.
-   HASHLEN must be the length of the message digest, in bytes, in particular:
-
-      alg    | hashlen
-      -------+--------
-      md5    | 16
-      sha1   | 20
-      sha224 | 28
-      sha256 | 32
-      sha384 | 48
-      sha512 | 64
-
-   If successful, fill RESBLOCK and return 0.
-   Upon failure, return a negated error number.  */
-int
-afalg_buffer (char const *restrict buffer, size_t len, char const *restrict alg,
-              void *restrict resblock, ssize_t hashlen);
-
-/* Compute a message digest of data read from STREAM.
-
-   STREAM is an open file stream.  The last operation on STREAM should
-   not be 'ungetc', and if STREAM is also open for writing it should
-   have been fflushed since its last write.  Read from the current
-   position to the end of STREAM.  Handle regular files efficiently.
-
-   ALG is the message digest algorithm; see the file /proc/crypto.
-
-   RESBLOCK points to a block of HASHLEN bytes, for the result.
-   HASHLEN must be the length of the message digest, in bytes, in particular:
-
-      alg    | hashlen
-      -------+--------
-      md5    | 16
-      sha1   | 20
-      sha224 | 28
-      sha256 | 32
-      sha384 | 48
-      sha512 | 64
-
-   If successful, fill RESBLOCK and return 0.
-   Upon failure, return a negated error number.
-   Unless returning 0 or -EIO, restore STREAM's file position so that
-   the caller can fall back on some other method.  */
-int
-afalg_stream (FILE *restrict stream, char const *restrict alg,
-              void *restrict resblock, ssize_t hashlen);
-
-# else
-
-static inline int
-afalg_buffer (char const *restrict buffer, size_t len, char const *restrict alg,
-              void *restrict resblock, ssize_t hashlen)
-{
-  return -EAFNOSUPPORT;
-}
-
-static inline int
-afalg_stream (FILE *restrict stream, char const *restrict alg,
-              void *restrict resblock, ssize_t hashlen)
-{
-  return -EAFNOSUPPORT;
-}
-
-# endif
-
-# ifdef __cplusplus
-}
-# endif
-
-#endif /* AF_ALG_H */
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index c0eac711139..b21d470cd0b 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -44,7 +44,6 @@
 #  --avoid=c32toupper \
 #  --avoid=chmod \
 #  --avoid=close \
-#  --avoid=crypto/af_alg \
 #  --avoid=dup \
 #  --avoid=fchdir \
 #  --avoid=fstat \