emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 185bfc1af7 2/2: Remove Gnulib explicit_bzero module


From: Paul Eggert
Subject: master 185bfc1af7 2/2: Remove Gnulib explicit_bzero module
Date: Sun, 18 Dec 2022 03:24:27 -0500 (EST)

branch: master
commit 185bfc1af717046391e8b787e29f44f9768d00a7
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>

    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.
---
 admin/merge-gnulib   |  5 +++--
 lib/explicit_bzero.c | 27 ---------------------------
 lib/gnulib.mk.in     | 13 +------------
 m4/explicit_bzero.m4 | 17 -----------------
 m4/gnulib-comp.m4    |  6 ------
 src/gnutls.c         |  2 +-
 6 files changed, 5 insertions(+), 65 deletions(-)

diff --git a/admin/merge-gnulib b/admin/merge-gnulib
index d3c5520ad0..99f834b0ae 100755
--- a/admin/merge-gnulib
+++ b/admin/merge-gnulib
@@ -33,13 +33,14 @@ GNULIB_MODULES='
   crypto/md5 crypto/md5-buffer
   crypto/sha1-buffer crypto/sha256-buffer crypto/sha512-buffer
   d-type diffseq double-slash-root dtoastr dtotimespec dup2
-  environ execinfo explicit_bzero faccessat
+  environ execinfo faccessat
   fchmodat fcntl fcntl-h fdopendir file-has-acl
   filemode filename filevercmp flexmember fpieee
   free-posix fstatat fsusage fsync futimens
   getloadavg getopt-gnu getrandom gettime gettimeofday gitlog-to-changelog
   ieee754-h ignore-value intprops largefile libgmp lstat
-  manywarnings memmem-simple mempcpy memrchr minmax mkostemp mktime
+  manywarnings memmem-simple mempcpy memrchr memset_explicit
+  minmax mkostemp mktime
   nanosleep nproc nstrftime
   pathmax pipe2 pselect pthread_sigmask
   qcopy-acl readlink readlinkat regex
diff --git a/lib/explicit_bzero.c b/lib/explicit_bzero.c
deleted file mode 100644
index fc309f81d6..0000000000
--- a/lib/explicit_bzero.c
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Erasure of sensitive data, generic implementation.
-   Copyright (C) 2016-2022 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/>.  */
-
-#include <config.h>
-
-#include <string.h>
-
-/* Set LEN bytes of S to 0.  The compiler will not delete a call to
-   this function, even if S is dead after the call.  */
-void
-explicit_bzero (void *s, size_t len)
-{
-  memset_explicit (s, 0, len);
-}
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index a3ab50f396..fcbf5bde2d 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -93,7 +93,6 @@
 #  dup2 \
 #  environ \
 #  execinfo \
-#  explicit_bzero \
 #  faccessat \
 #  fchmodat \
 #  fcntl \
@@ -126,6 +125,7 @@
 #  memmem-simple \
 #  mempcpy \
 #  memrchr \
+#  memset_explicit \
 #  minmax \
 #  mkostemp \
 #  mktime \
@@ -264,7 +264,6 @@ GL_COND_OBJ_DIRFD_CONDITION = @GL_COND_OBJ_DIRFD_CONDITION@
 GL_COND_OBJ_DUP2_CONDITION = @GL_COND_OBJ_DUP2_CONDITION@
 GL_COND_OBJ_EUIDACCESS_CONDITION = @GL_COND_OBJ_EUIDACCESS_CONDITION@
 GL_COND_OBJ_EXECINFO_CONDITION = @GL_COND_OBJ_EXECINFO_CONDITION@
-GL_COND_OBJ_EXPLICIT_BZERO_CONDITION = @GL_COND_OBJ_EXPLICIT_BZERO_CONDITION@
 GL_COND_OBJ_FACCESSAT_CONDITION = @GL_COND_OBJ_FACCESSAT_CONDITION@
 GL_COND_OBJ_FCHMODAT_CONDITION = @GL_COND_OBJ_FCHMODAT_CONDITION@
 GL_COND_OBJ_FCNTL_CONDITION = @GL_COND_OBJ_FCNTL_CONDITION@
@@ -1860,16 +1859,6 @@ EXTRA_DIST += execinfo.in.h
 endif
 ## end   gnulib module execinfo
 
-## begin gnulib module explicit_bzero
-ifeq (,$(OMIT_GNULIB_MODULE_explicit_bzero))
-
-ifneq (,$(GL_COND_OBJ_EXPLICIT_BZERO_CONDITION))
-libgnu_a_SOURCES += explicit_bzero.c
-endif
-
-endif
-## end   gnulib module explicit_bzero
-
 ## begin gnulib module faccessat
 ifeq (,$(OMIT_GNULIB_MODULE_faccessat))
 
diff --git a/m4/explicit_bzero.m4 b/m4/explicit_bzero.m4
deleted file mode 100644
index 6c0d4c2336..0000000000
--- a/m4/explicit_bzero.m4
+++ /dev/null
@@ -1,17 +0,0 @@
-dnl Copyright 2017-2022 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.
-
-AC_DEFUN([gl_FUNC_EXPLICIT_BZERO],
-[
-  AC_REQUIRE([gl_STRING_H_DEFAULTS])
-
-  dnl Persuade glibc <string.h> to declare explicit_bzero.
-  AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
-
-  AC_CHECK_FUNCS_ONCE([explicit_bzero])
-  if test $ac_cv_func_explicit_bzero = no; then
-    HAVE_EXPLICIT_BZERO=0
-  fi
-])
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index 97d0a7d21f..9ba977711f 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -82,7 +82,6 @@ AC_DEFUN([gl_EARLY],
   # Code from module errno:
   # Code from module euidaccess:
   # Code from module execinfo:
-  # Code from module explicit_bzero:
   # Code from module extensions:
   # Code from module extern-inline:
   # Code from module faccessat:
@@ -286,9 +285,6 @@ AC_DEFUN([gl_INIT],
   gl_CONDITIONAL_HEADER([execinfo.h])
   AC_PROG_MKDIR_P
   gl_CONDITIONAL([GL_COND_OBJ_EXECINFO], [$GL_GENERATE_EXECINFO_H])
-  gl_FUNC_EXPLICIT_BZERO
-  gl_CONDITIONAL([GL_COND_OBJ_EXPLICIT_BZERO], [test $HAVE_EXPLICIT_BZERO = 0])
-  gl_STRING_MODULE_INDICATOR([explicit_bzero])
   AC_REQUIRE([gl_EXTERN_INLINE])
   gl_FUNC_FACCESSAT
   gl_CONDITIONAL([GL_COND_OBJ_FACCESSAT],
@@ -1252,7 +1248,6 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/euidaccess.c
   lib/execinfo.c
   lib/execinfo.in.h
-  lib/explicit_bzero.c
   lib/faccessat.c
   lib/fchmodat.c
   lib/fcntl.c
@@ -1437,7 +1432,6 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/errno_h.m4
   m4/euidaccess.m4
   m4/execinfo.m4
-  m4/explicit_bzero.m4
   m4/extensions.m4
   m4/extern-inline.m4
   m4/faccessat.m4
diff --git a/src/gnutls.c b/src/gnutls.c
index 7f0aaf85a4..4093865cae 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -2282,7 +2282,7 @@ gnutls_symmetric_aead (bool encrypting, 
gnutls_cipher_algorithm_t gca,
   Lisp_Object output;
   if (GNUTLS_E_SUCCESS <= ret)
     output = make_unibyte_string (storage, storage_length);
-  explicit_bzero (storage, storage_length);
+  memset_explicit (storage, 0, storage_length);
   gnutls_aead_cipher_deinit (acipher);
 
   if (ret < GNUTLS_E_SUCCESS)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]