aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2022-12-18 00:21:30 -0800
committerPaul Eggert2022-12-18 00:24:14 -0800
commit185bfc1af717046391e8b787e29f44f9768d00a7 (patch)
treed1dc3da7bc9b8270c9254fe15500ac948bc3dffb
parentbda755bf92b5fa0dfe25da173b30e1002e95b774 (diff)
downloademacs-185bfc1af717046391e8b787e29f44f9768d00a7.tar.gz
emacs-185bfc1af717046391e8b787e29f44f9768d00a7.zip
Remove Gnulib explicit_bzero module
It’s no longer needed, as it is now merely a thin layer around C23-style memset_explicit and we might as well just call the C23 standard function; that’s more forward-looking. * admin/merge-gnulib (GNULIB_MODULES): Remove explicit_bzero, and add memset_explicit. * lib/explicit_bzero.c, m4/explicit_bzero.m4: Remove these files, which were copied from Gnulib. * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate. * src/gnutls.c (gnutls_symmetric_aead): Use memset_explicit instead of explicit_bzero.
-rwxr-xr-xadmin/merge-gnulib5
-rw-r--r--lib/explicit_bzero.c27
-rw-r--r--lib/gnulib.mk.in13
-rw-r--r--m4/explicit_bzero.m417
-rw-r--r--m4/gnulib-comp.m46
-rw-r--r--src/gnutls.c2
6 files changed, 5 insertions, 65 deletions
diff --git a/admin/merge-gnulib b/admin/merge-gnulib
index d3c5520ad0f..99f834b0ae3 100755
--- a/admin/merge-gnulib
+++ b/admin/merge-gnulib
@@ -33,13 +33,14 @@ GNULIB_MODULES='
33 crypto/md5 crypto/md5-buffer 33 crypto/md5 crypto/md5-buffer
34 crypto/sha1-buffer crypto/sha256-buffer crypto/sha512-buffer 34 crypto/sha1-buffer crypto/sha256-buffer crypto/sha512-buffer
35 d-type diffseq double-slash-root dtoastr dtotimespec dup2 35 d-type diffseq double-slash-root dtoastr dtotimespec dup2
36 environ execinfo explicit_bzero faccessat 36 environ execinfo faccessat
37 fchmodat fcntl fcntl-h fdopendir file-has-acl 37 fchmodat fcntl fcntl-h fdopendir file-has-acl
38 filemode filename filevercmp flexmember fpieee 38 filemode filename filevercmp flexmember fpieee
39 free-posix fstatat fsusage fsync futimens 39 free-posix fstatat fsusage fsync futimens
40 getloadavg getopt-gnu getrandom gettime gettimeofday gitlog-to-changelog 40 getloadavg getopt-gnu getrandom gettime gettimeofday gitlog-to-changelog
41 ieee754-h ignore-value intprops largefile libgmp lstat 41 ieee754-h ignore-value intprops largefile libgmp lstat
42 manywarnings memmem-simple mempcpy memrchr minmax mkostemp mktime 42 manywarnings memmem-simple mempcpy memrchr memset_explicit
43 minmax mkostemp mktime
43 nanosleep nproc nstrftime 44 nanosleep nproc nstrftime
44 pathmax pipe2 pselect pthread_sigmask 45 pathmax pipe2 pselect pthread_sigmask
45 qcopy-acl readlink readlinkat regex 46 qcopy-acl readlink readlinkat regex
diff --git a/lib/explicit_bzero.c b/lib/explicit_bzero.c
deleted file mode 100644
index fc309f81d61..00000000000
--- a/lib/explicit_bzero.c
+++ /dev/null
@@ -1,27 +0,0 @@
1/* Erasure of sensitive data, generic implementation.
2 Copyright (C) 2016-2022 Free Software Foundation, Inc.
3
4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as
6 published by the Free Software Foundation; either version 2.1 of the
7 License, or (at your option) any later version.
8
9 This file is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
16
17#include <config.h>
18
19#include <string.h>
20
21/* Set LEN bytes of S to 0. The compiler will not delete a call to
22 this function, even if S is dead after the call. */
23void
24explicit_bzero (void *s, size_t len)
25{
26 memset_explicit (s, 0, len);
27}
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index a3ab50f396f..fcbf5bde2db 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -93,7 +93,6 @@
93# dup2 \ 93# dup2 \
94# environ \ 94# environ \
95# execinfo \ 95# execinfo \
96# explicit_bzero \
97# faccessat \ 96# faccessat \
98# fchmodat \ 97# fchmodat \
99# fcntl \ 98# fcntl \
@@ -126,6 +125,7 @@
126# memmem-simple \ 125# memmem-simple \
127# mempcpy \ 126# mempcpy \
128# memrchr \ 127# memrchr \
128# memset_explicit \
129# minmax \ 129# minmax \
130# mkostemp \ 130# mkostemp \
131# mktime \ 131# mktime \
@@ -264,7 +264,6 @@ GL_COND_OBJ_DIRFD_CONDITION = @GL_COND_OBJ_DIRFD_CONDITION@
264GL_COND_OBJ_DUP2_CONDITION = @GL_COND_OBJ_DUP2_CONDITION@ 264GL_COND_OBJ_DUP2_CONDITION = @GL_COND_OBJ_DUP2_CONDITION@
265GL_COND_OBJ_EUIDACCESS_CONDITION = @GL_COND_OBJ_EUIDACCESS_CONDITION@ 265GL_COND_OBJ_EUIDACCESS_CONDITION = @GL_COND_OBJ_EUIDACCESS_CONDITION@
266GL_COND_OBJ_EXECINFO_CONDITION = @GL_COND_OBJ_EXECINFO_CONDITION@ 266GL_COND_OBJ_EXECINFO_CONDITION = @GL_COND_OBJ_EXECINFO_CONDITION@
267GL_COND_OBJ_EXPLICIT_BZERO_CONDITION = @GL_COND_OBJ_EXPLICIT_BZERO_CONDITION@
268GL_COND_OBJ_FACCESSAT_CONDITION = @GL_COND_OBJ_FACCESSAT_CONDITION@ 267GL_COND_OBJ_FACCESSAT_CONDITION = @GL_COND_OBJ_FACCESSAT_CONDITION@
269GL_COND_OBJ_FCHMODAT_CONDITION = @GL_COND_OBJ_FCHMODAT_CONDITION@ 268GL_COND_OBJ_FCHMODAT_CONDITION = @GL_COND_OBJ_FCHMODAT_CONDITION@
270GL_COND_OBJ_FCNTL_CONDITION = @GL_COND_OBJ_FCNTL_CONDITION@ 269GL_COND_OBJ_FCNTL_CONDITION = @GL_COND_OBJ_FCNTL_CONDITION@
@@ -1860,16 +1859,6 @@ EXTRA_DIST += execinfo.in.h
1860endif 1859endif
1861## end gnulib module execinfo 1860## end gnulib module execinfo
1862 1861
1863## begin gnulib module explicit_bzero
1864ifeq (,$(OMIT_GNULIB_MODULE_explicit_bzero))
1865
1866ifneq (,$(GL_COND_OBJ_EXPLICIT_BZERO_CONDITION))
1867libgnu_a_SOURCES += explicit_bzero.c
1868endif
1869
1870endif
1871## end gnulib module explicit_bzero
1872
1873## begin gnulib module faccessat 1862## begin gnulib module faccessat
1874ifeq (,$(OMIT_GNULIB_MODULE_faccessat)) 1863ifeq (,$(OMIT_GNULIB_MODULE_faccessat))
1875 1864
diff --git a/m4/explicit_bzero.m4 b/m4/explicit_bzero.m4
deleted file mode 100644
index 6c0d4c23368..00000000000
--- a/m4/explicit_bzero.m4
+++ /dev/null
@@ -1,17 +0,0 @@
1dnl Copyright 2017-2022 Free Software Foundation, Inc.
2dnl This file is free software; the Free Software Foundation
3dnl gives unlimited permission to copy and/or distribute it,
4dnl with or without modifications, as long as this notice is preserved.
5
6AC_DEFUN([gl_FUNC_EXPLICIT_BZERO],
7[
8 AC_REQUIRE([gl_STRING_H_DEFAULTS])
9
10 dnl Persuade glibc <string.h> to declare explicit_bzero.
11 AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
12
13 AC_CHECK_FUNCS_ONCE([explicit_bzero])
14 if test $ac_cv_func_explicit_bzero = no; then
15 HAVE_EXPLICIT_BZERO=0
16 fi
17])
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index 97d0a7d21f8..9ba977711fa 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -82,7 +82,6 @@ AC_DEFUN([gl_EARLY],
82 # Code from module errno: 82 # Code from module errno:
83 # Code from module euidaccess: 83 # Code from module euidaccess:
84 # Code from module execinfo: 84 # Code from module execinfo:
85 # Code from module explicit_bzero:
86 # Code from module extensions: 85 # Code from module extensions:
87 # Code from module extern-inline: 86 # Code from module extern-inline:
88 # Code from module faccessat: 87 # Code from module faccessat:
@@ -286,9 +285,6 @@ AC_DEFUN([gl_INIT],
286 gl_CONDITIONAL_HEADER([execinfo.h]) 285 gl_CONDITIONAL_HEADER([execinfo.h])
287 AC_PROG_MKDIR_P 286 AC_PROG_MKDIR_P
288 gl_CONDITIONAL([GL_COND_OBJ_EXECINFO], [$GL_GENERATE_EXECINFO_H]) 287 gl_CONDITIONAL([GL_COND_OBJ_EXECINFO], [$GL_GENERATE_EXECINFO_H])
289 gl_FUNC_EXPLICIT_BZERO
290 gl_CONDITIONAL([GL_COND_OBJ_EXPLICIT_BZERO], [test $HAVE_EXPLICIT_BZERO = 0])
291 gl_STRING_MODULE_INDICATOR([explicit_bzero])
292 AC_REQUIRE([gl_EXTERN_INLINE]) 288 AC_REQUIRE([gl_EXTERN_INLINE])
293 gl_FUNC_FACCESSAT 289 gl_FUNC_FACCESSAT
294 gl_CONDITIONAL([GL_COND_OBJ_FACCESSAT], 290 gl_CONDITIONAL([GL_COND_OBJ_FACCESSAT],
@@ -1252,7 +1248,6 @@ AC_DEFUN([gl_FILE_LIST], [
1252 lib/euidaccess.c 1248 lib/euidaccess.c
1253 lib/execinfo.c 1249 lib/execinfo.c
1254 lib/execinfo.in.h 1250 lib/execinfo.in.h
1255 lib/explicit_bzero.c
1256 lib/faccessat.c 1251 lib/faccessat.c
1257 lib/fchmodat.c 1252 lib/fchmodat.c
1258 lib/fcntl.c 1253 lib/fcntl.c
@@ -1437,7 +1432,6 @@ AC_DEFUN([gl_FILE_LIST], [
1437 m4/errno_h.m4 1432 m4/errno_h.m4
1438 m4/euidaccess.m4 1433 m4/euidaccess.m4
1439 m4/execinfo.m4 1434 m4/execinfo.m4
1440 m4/explicit_bzero.m4
1441 m4/extensions.m4 1435 m4/extensions.m4
1442 m4/extern-inline.m4 1436 m4/extern-inline.m4
1443 m4/faccessat.m4 1437 m4/faccessat.m4
diff --git a/src/gnutls.c b/src/gnutls.c
index 7f0aaf85a41..4093865cae5 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -2282,7 +2282,7 @@ gnutls_symmetric_aead (bool encrypting, gnutls_cipher_algorithm_t gca,
2282 Lisp_Object output; 2282 Lisp_Object output;
2283 if (GNUTLS_E_SUCCESS <= ret) 2283 if (GNUTLS_E_SUCCESS <= ret)
2284 output = make_unibyte_string (storage, storage_length); 2284 output = make_unibyte_string (storage, storage_length);
2285 explicit_bzero (storage, storage_length); 2285 memset_explicit (storage, 0, storage_length);
2286 gnutls_aead_cipher_deinit (acipher); 2286 gnutls_aead_cipher_deinit (acipher);
2287 2287
2288 if (ret < GNUTLS_E_SUCCESS) 2288 if (ret < GNUTLS_E_SUCCESS)