aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2022-12-17 23:11:55 -0800
committerPaul Eggert2022-12-18 00:24:13 -0800
commitbda755bf92b5fa0dfe25da173b30e1002e95b774 (patch)
treea9aa1b5520a48c93a1702b39c1b2f22a32c46805
parent5a344d90c53d681ed98ab03ad3e218a3c6561108 (diff)
downloademacs-bda755bf92b5fa0dfe25da173b30e1002e95b774.tar.gz
emacs-bda755bf92b5fa0dfe25da173b30e1002e95b774.zip
Update from Gnulib by running admin/merge-gnulib
-rw-r--r--lib/explicit_bzero.c69
-rw-r--r--lib/gnulib.mk.in15
-rw-r--r--lib/memset_explicit.c55
-rw-r--r--lib/string.in.h17
-rw-r--r--lib/verify.h2
-rw-r--r--m4/explicit_bzero.m46
-rw-r--r--m4/gnulib-comp.m412
-rw-r--r--m4/memset_explicit.m420
-rw-r--r--m4/string_h.m47
9 files changed, 133 insertions, 70 deletions
diff --git a/lib/explicit_bzero.c b/lib/explicit_bzero.c
index ad0bfd170ca..fc309f81d61 100644
--- a/lib/explicit_bzero.c
+++ b/lib/explicit_bzero.c
@@ -1,74 +1,27 @@
1/* Erasure of sensitive data, generic implementation. 1/* Erasure of sensitive data, generic implementation.
2 Copyright (C) 2016-2022 Free Software Foundation, Inc. 2 Copyright (C) 2016-2022 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 3
5 The GNU C Library is free software; you can redistribute it and/or 4 This file is free software: you can redistribute it and/or modify
6 modify it under the terms of the GNU Lesser General Public 5 it under the terms of the GNU Lesser General Public License as
7 License as published by the Free Software Foundation; either 6 published by the Free Software Foundation; either version 2.1 of the
8 version 2.1 of the License, or (at your option) any later version. 7 License, or (at your option) any later version.
9 8
10 The GNU C Library is distributed in the hope that it will be useful, 9 This file is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 10 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 Lesser General Public License for more details. 12 GNU Lesser General Public License for more details.
14 13
15 You should have received a copy of the GNU Lesser General Public 14 You should have received a copy of the GNU Lesser General Public License
16 License along with the GNU C Library; if not, see 15 along with this program. If not, see <https://www.gnu.org/licenses/>. */
17 <https://www.gnu.org/licenses/>. */
18 16
19/* An assembler implementation of explicit_bzero can be created as an 17#include <config.h>
20 assembler alias of an optimized bzero implementation.
21 Architecture-specific implementations also need to define
22 __explicit_bzero_chk. */
23
24#if !_LIBC
25# include <config.h>
26#endif
27
28/* memset_s need this define */
29#if HAVE_MEMSET_S
30# define __STDC_WANT_LIB_EXT1__ 1
31#endif
32 18
33#include <string.h> 19#include <string.h>
34 20
35#if defined _WIN32 && !defined __CYGWIN__
36# define WIN32_LEAN_AND_MEAN
37# include <windows.h>
38#endif
39
40#if _LIBC
41/* glibc-internal users use __explicit_bzero_chk, and explicit_bzero
42 redirects to that. */
43# undef explicit_bzero
44#endif
45
46/* Set LEN bytes of S to 0. The compiler will not delete a call to 21/* Set LEN bytes of S to 0. The compiler will not delete a call to
47 this function, even if S is dead after the call. */ 22 this function, even if S is dead after the call. */
48void 23void
49explicit_bzero (void *s, size_t len) 24explicit_bzero (void *s, size_t len)
50{ 25{
51#if defined _WIN32 && !defined __CYGWIN__ 26 memset_explicit (s, 0, len);
52 (void) SecureZeroMemory (s, len);
53#elif HAVE_EXPLICIT_MEMSET
54 explicit_memset (s, '\0', len);
55#elif HAVE_MEMSET_S
56 (void) memset_s (s, len, '\0', len);
57#elif defined __GNUC__ && !defined __clang__
58 memset (s, '\0', len);
59 /* Compiler barrier. */
60 asm volatile ("" ::: "memory");
61#elif defined __clang__
62 memset (s, '\0', len);
63 /* Compiler barrier. */
64 /* With asm ("" ::: "memory") LLVM analyzes uses of 's' and finds that the
65 whole thing is dead and eliminates it. Use 'g' to work around this
66 problem. See <https://bugs.llvm.org/show_bug.cgi?id=15495#c11>. */
67 __asm__ volatile ("" : : "g"(s) : "memory");
68#else
69 /* Invoke memset through a volatile function pointer. This defeats compiler
70 optimizations. */
71 void * (* const volatile volatile_memset) (void *, int, size_t) = memset;
72 (void) volatile_memset (s, '\0', len);
73#endif
74} 27}
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index 9af8fd0c579..a3ab50f396f 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -286,6 +286,7 @@ GL_COND_OBJ_LCHMOD_CONDITION = @GL_COND_OBJ_LCHMOD_CONDITION@
286GL_COND_OBJ_LSTAT_CONDITION = @GL_COND_OBJ_LSTAT_CONDITION@ 286GL_COND_OBJ_LSTAT_CONDITION = @GL_COND_OBJ_LSTAT_CONDITION@
287GL_COND_OBJ_MEMPCPY_CONDITION = @GL_COND_OBJ_MEMPCPY_CONDITION@ 287GL_COND_OBJ_MEMPCPY_CONDITION = @GL_COND_OBJ_MEMPCPY_CONDITION@
288GL_COND_OBJ_MEMRCHR_CONDITION = @GL_COND_OBJ_MEMRCHR_CONDITION@ 288GL_COND_OBJ_MEMRCHR_CONDITION = @GL_COND_OBJ_MEMRCHR_CONDITION@
289GL_COND_OBJ_MEMSET_EXPLICIT_CONDITION = @GL_COND_OBJ_MEMSET_EXPLICIT_CONDITION@
289GL_COND_OBJ_MINI_GMP_GNULIB_CONDITION = @GL_COND_OBJ_MINI_GMP_GNULIB_CONDITION@ 290GL_COND_OBJ_MINI_GMP_GNULIB_CONDITION = @GL_COND_OBJ_MINI_GMP_GNULIB_CONDITION@
290GL_COND_OBJ_MKOSTEMP_CONDITION = @GL_COND_OBJ_MKOSTEMP_CONDITION@ 291GL_COND_OBJ_MKOSTEMP_CONDITION = @GL_COND_OBJ_MKOSTEMP_CONDITION@
291GL_COND_OBJ_NANOSLEEP_CONDITION = @GL_COND_OBJ_NANOSLEEP_CONDITION@ 292GL_COND_OBJ_NANOSLEEP_CONDITION = @GL_COND_OBJ_NANOSLEEP_CONDITION@
@@ -485,6 +486,7 @@ GL_GNULIB_MEMCHR = @GL_GNULIB_MEMCHR@
485GL_GNULIB_MEMMEM = @GL_GNULIB_MEMMEM@ 486GL_GNULIB_MEMMEM = @GL_GNULIB_MEMMEM@
486GL_GNULIB_MEMPCPY = @GL_GNULIB_MEMPCPY@ 487GL_GNULIB_MEMPCPY = @GL_GNULIB_MEMPCPY@
487GL_GNULIB_MEMRCHR = @GL_GNULIB_MEMRCHR@ 488GL_GNULIB_MEMRCHR = @GL_GNULIB_MEMRCHR@
489GL_GNULIB_MEMSET_EXPLICIT = @GL_GNULIB_MEMSET_EXPLICIT@
488GL_GNULIB_MKDIR = @GL_GNULIB_MKDIR@ 490GL_GNULIB_MKDIR = @GL_GNULIB_MKDIR@
489GL_GNULIB_MKDIRAT = @GL_GNULIB_MKDIRAT@ 491GL_GNULIB_MKDIRAT = @GL_GNULIB_MKDIRAT@
490GL_GNULIB_MKDTEMP = @GL_GNULIB_MKDTEMP@ 492GL_GNULIB_MKDTEMP = @GL_GNULIB_MKDTEMP@
@@ -749,6 +751,7 @@ HAVE_MAX_ALIGN_T = @HAVE_MAX_ALIGN_T@
749HAVE_MBSLEN = @HAVE_MBSLEN@ 751HAVE_MBSLEN = @HAVE_MBSLEN@
750HAVE_MBTOWC = @HAVE_MBTOWC@ 752HAVE_MBTOWC = @HAVE_MBTOWC@
751HAVE_MEMPCPY = @HAVE_MEMPCPY@ 753HAVE_MEMPCPY = @HAVE_MEMPCPY@
754HAVE_MEMSET_EXPLICIT = @HAVE_MEMSET_EXPLICIT@
752HAVE_MKDIRAT = @HAVE_MKDIRAT@ 755HAVE_MKDIRAT = @HAVE_MKDIRAT@
753HAVE_MKDTEMP = @HAVE_MKDTEMP@ 756HAVE_MKDTEMP = @HAVE_MKDTEMP@
754HAVE_MKFIFO = @HAVE_MKFIFO@ 757HAVE_MKFIFO = @HAVE_MKFIFO@
@@ -2536,6 +2539,16 @@ endif
2536endif 2539endif
2537## end gnulib module memrchr 2540## end gnulib module memrchr
2538 2541
2542## begin gnulib module memset_explicit
2543ifeq (,$(OMIT_GNULIB_MODULE_memset_explicit))
2544
2545ifneq (,$(GL_COND_OBJ_MEMSET_EXPLICIT_CONDITION))
2546libgnu_a_SOURCES += memset_explicit.c
2547endif
2548
2549endif
2550## end gnulib module memset_explicit
2551
2539## begin gnulib module minmax 2552## begin gnulib module minmax
2540ifeq (,$(OMIT_GNULIB_MODULE_minmax)) 2553ifeq (,$(OMIT_GNULIB_MODULE_minmax))
2541 2554
@@ -3362,6 +3375,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
3362 -e 's/@''GNULIB_MEMMEM''@/$(GL_GNULIB_MEMMEM)/g' \ 3375 -e 's/@''GNULIB_MEMMEM''@/$(GL_GNULIB_MEMMEM)/g' \
3363 -e 's/@''GNULIB_MEMPCPY''@/$(GL_GNULIB_MEMPCPY)/g' \ 3376 -e 's/@''GNULIB_MEMPCPY''@/$(GL_GNULIB_MEMPCPY)/g' \
3364 -e 's/@''GNULIB_MEMRCHR''@/$(GL_GNULIB_MEMRCHR)/g' \ 3377 -e 's/@''GNULIB_MEMRCHR''@/$(GL_GNULIB_MEMRCHR)/g' \
3378 -e 's/@''GNULIB_MEMSET_EXPLICIT''@/$(GL_GNULIB_MEMSET_EXPLICIT)/g' \
3365 -e 's/@''GNULIB_RAWMEMCHR''@/$(GL_GNULIB_RAWMEMCHR)/g' \ 3379 -e 's/@''GNULIB_RAWMEMCHR''@/$(GL_GNULIB_RAWMEMCHR)/g' \
3366 -e 's/@''GNULIB_STPCPY''@/$(GL_GNULIB_STPCPY)/g' \ 3380 -e 's/@''GNULIB_STPCPY''@/$(GL_GNULIB_STPCPY)/g' \
3367 -e 's/@''GNULIB_STPNCPY''@/$(GL_GNULIB_STPNCPY)/g' \ 3381 -e 's/@''GNULIB_STPNCPY''@/$(GL_GNULIB_STPNCPY)/g' \
@@ -3393,6 +3407,7 @@ string.h: string.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H
3393 -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \ 3407 -e 's|@''HAVE_DECL_MEMMEM''@|$(HAVE_DECL_MEMMEM)|g' \
3394 -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \ 3408 -e 's|@''HAVE_MEMPCPY''@|$(HAVE_MEMPCPY)|g' \
3395 -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \ 3409 -e 's|@''HAVE_DECL_MEMRCHR''@|$(HAVE_DECL_MEMRCHR)|g' \
3410 -e 's|@''HAVE_MEMSET_EXPLICIT''@|$(HAVE_MEMSET_EXPLICIT)|g' \
3396 -e 's|@''HAVE_RAWMEMCHR''@|$(HAVE_RAWMEMCHR)|g' \ 3411 -e 's|@''HAVE_RAWMEMCHR''@|$(HAVE_RAWMEMCHR)|g' \
3397 -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \ 3412 -e 's|@''HAVE_STPCPY''@|$(HAVE_STPCPY)|g' \
3398 -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \ 3413 -e 's|@''HAVE_STPNCPY''@|$(HAVE_STPNCPY)|g' \
diff --git a/lib/memset_explicit.c b/lib/memset_explicit.c
new file mode 100644
index 00000000000..eabeb3ec2b8
--- /dev/null
+++ b/lib/memset_explicit.c
@@ -0,0 +1,55 @@
1/* Erase sensitive data from memory.
2 Copyright 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/* memset_s need this define */
20#if HAVE_MEMSET_S
21# define __STDC_WANT_LIB_EXT1__ 1
22#endif
23
24#include <string.h>
25
26/* Set S's bytes to C, where S has LEN bytes. The compiler will not
27 optimize effects away, even if S is dead after the call. */
28void *
29memset_explicit (void *s, int c, size_t len)
30{
31#if HAVE_EXPLICIT_MEMSET
32 return explicit_memset (s, c, len);
33#elif HAVE_MEMSET_S
34 (void) memset_s (s, len, c, len);
35 return s;
36#elif defined __GNUC__ && !defined __clang__
37 memset (s, c, len);
38 /* Compiler barrier. */
39 __asm__ volatile ("" ::: "memory");
40 return s;
41#elif defined __clang__
42 memset (s, c, len);
43 /* Compiler barrier. */
44 /* With asm ("" ::: "memory") LLVM analyzes uses of 's' and finds that the
45 whole thing is dead and eliminates it. Use 'g' to work around this
46 problem. See <https://bugs.llvm.org/show_bug.cgi?id=15495#c11>. */
47 __asm__ volatile ("" : : "g"(s) : "memory");
48 return s;
49#else
50 /* Invoke memset through a volatile function pointer. This defeats compiler
51 optimizations. */
52 void * (* const volatile volatile_memset) (void *, int, size_t) = memset;
53 return volatile_memset (s, c, len);
54#endif
55}
diff --git a/lib/string.in.h b/lib/string.in.h
index e56f6db0c9c..21356914e21 100644
--- a/lib/string.in.h
+++ b/lib/string.in.h
@@ -347,6 +347,23 @@ _GL_WARN_ON_USE (memrchr, "memrchr is unportable - "
347# endif 347# endif
348#endif 348#endif
349 349
350/* Overwrite a block of memory. The compiler will not optimize
351 effects away, even if the block is dead after the call. */
352#if @GNULIB_MEMSET_EXPLICIT@
353# if ! @HAVE_MEMSET_EXPLICIT@
354_GL_FUNCDECL_SYS (memset_explicit, void *,
355 (void *__dest, int __c, size_t __n) _GL_ARG_NONNULL ((1)));
356# endif
357_GL_CXXALIAS_SYS (memset_explicit, void *, (void *__dest, int __c, size_t __n));
358_GL_CXXALIASWARN (memset_explicit);
359#elif defined GNULIB_POSIXCHECK
360# undef memset_explicit
361# if HAVE_RAW_DECL_MEMSET_EXPLICIT
362_GL_WARN_ON_USE (memset_explicit, "memset_explicit is unportable - "
363 "use gnulib module memset_explicit for portability");
364# endif
365#endif
366
350/* Find the first occurrence of C in S. More efficient than 367/* Find the first occurrence of C in S. More efficient than
351 memchr(S,C,N), at the expense of undefined behavior if C does not 368 memchr(S,C,N), at the expense of undefined behavior if C does not
352 occur within N bytes. */ 369 occur within N bytes. */
diff --git a/lib/verify.h b/lib/verify.h
index 99af802993e..5225a8e616d 100644
--- a/lib/verify.h
+++ b/lib/verify.h
@@ -37,7 +37,7 @@
37 && (4 < __GNUC__ + (6 <= __GNUC_MINOR__) || 5 <= __clang_major__))) 37 && (4 < __GNUC__ + (6 <= __GNUC_MINOR__) || 5 <= __clang_major__)))
38# define _GL_HAVE__STATIC_ASSERT 1 38# define _GL_HAVE__STATIC_ASSERT 1
39# endif 39# endif
40# if (202000 <= __STDC_VERSION__ \ 40# if (202311 <= __STDC_VERSION__ \
41 || (!defined __STRICT_ANSI__ && 9 <= __GNUC__)) 41 || (!defined __STRICT_ANSI__ && 9 <= __GNUC__))
42# define _GL_HAVE__STATIC_ASSERT1 1 42# define _GL_HAVE__STATIC_ASSERT1 1
43# endif 43# endif
diff --git a/m4/explicit_bzero.m4 b/m4/explicit_bzero.m4
index 3b4ef8c3cc5..6c0d4c23368 100644
--- a/m4/explicit_bzero.m4
+++ b/m4/explicit_bzero.m4
@@ -15,9 +15,3 @@ AC_DEFUN([gl_FUNC_EXPLICIT_BZERO],
15 HAVE_EXPLICIT_BZERO=0 15 HAVE_EXPLICIT_BZERO=0
16 fi 16 fi
17]) 17])
18
19AC_DEFUN([gl_PREREQ_EXPLICIT_BZERO],
20[
21 AC_CHECK_FUNCS([explicit_memset])
22 AC_CHECK_FUNCS_ONCE([memset_s])
23])
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index 1a8bf8b7cdf..97d0a7d21f8 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -137,6 +137,7 @@ AC_DEFUN([gl_EARLY],
137 # Code from module memmem-simple: 137 # Code from module memmem-simple:
138 # Code from module mempcpy: 138 # Code from module mempcpy:
139 # Code from module memrchr: 139 # Code from module memrchr:
140 # Code from module memset_explicit:
140 # Code from module minmax: 141 # Code from module minmax:
141 # Code from module mkostemp: 142 # Code from module mkostemp:
142 # Code from module mktime: 143 # Code from module mktime:
@@ -287,9 +288,6 @@ AC_DEFUN([gl_INIT],
287 gl_CONDITIONAL([GL_COND_OBJ_EXECINFO], [$GL_GENERATE_EXECINFO_H]) 288 gl_CONDITIONAL([GL_COND_OBJ_EXECINFO], [$GL_GENERATE_EXECINFO_H])
288 gl_FUNC_EXPLICIT_BZERO 289 gl_FUNC_EXPLICIT_BZERO
289 gl_CONDITIONAL([GL_COND_OBJ_EXPLICIT_BZERO], [test $HAVE_EXPLICIT_BZERO = 0]) 290 gl_CONDITIONAL([GL_COND_OBJ_EXPLICIT_BZERO], [test $HAVE_EXPLICIT_BZERO = 0])
290 AM_COND_IF([GL_COND_OBJ_EXPLICIT_BZERO], [
291 gl_PREREQ_EXPLICIT_BZERO
292 ])
293 gl_STRING_MODULE_INDICATOR([explicit_bzero]) 291 gl_STRING_MODULE_INDICATOR([explicit_bzero])
294 AC_REQUIRE([gl_EXTERN_INLINE]) 292 AC_REQUIRE([gl_EXTERN_INLINE])
295 gl_FUNC_FACCESSAT 293 gl_FUNC_FACCESSAT
@@ -422,6 +420,12 @@ AC_DEFUN([gl_INIT],
422 gl_PREREQ_MEMRCHR 420 gl_PREREQ_MEMRCHR
423 ]) 421 ])
424 gl_STRING_MODULE_INDICATOR([memrchr]) 422 gl_STRING_MODULE_INDICATOR([memrchr])
423 gl_FUNC_MEMSET_EXPLICIT
424 gl_CONDITIONAL([GL_COND_OBJ_MEMSET_EXPLICIT], [test $HAVE_MEMSET_EXPLICIT = 0])
425 AM_COND_IF([GL_COND_OBJ_MEMSET_EXPLICIT], [
426 gl_PREREQ_MEMSET_EXPLICIT
427 ])
428 gl_STRING_MODULE_INDICATOR([memset_explicit])
425 gl_MINMAX 429 gl_MINMAX
426 gl_FUNC_MKOSTEMP 430 gl_FUNC_MKOSTEMP
427 gl_CONDITIONAL([GL_COND_OBJ_MKOSTEMP], [test $HAVE_MKOSTEMP = 0]) 431 gl_CONDITIONAL([GL_COND_OBJ_MKOSTEMP], [test $HAVE_MKOSTEMP = 0])
@@ -1318,6 +1322,7 @@ AC_DEFUN([gl_FILE_LIST], [
1318 lib/memmem.c 1322 lib/memmem.c
1319 lib/mempcpy.c 1323 lib/mempcpy.c
1320 lib/memrchr.c 1324 lib/memrchr.c
1325 lib/memset_explicit.c
1321 lib/mini-gmp-gnulib.c 1326 lib/mini-gmp-gnulib.c
1322 lib/mini-gmp.c 1327 lib/mini-gmp.c
1323 lib/mini-gmp.h 1328 lib/mini-gmp.h
@@ -1476,6 +1481,7 @@ AC_DEFUN([gl_FILE_LIST], [
1476 m4/memmem.m4 1481 m4/memmem.m4
1477 m4/mempcpy.m4 1482 m4/mempcpy.m4
1478 m4/memrchr.m4 1483 m4/memrchr.m4
1484 m4/memset_explicit.m4
1479 m4/minmax.m4 1485 m4/minmax.m4
1480 m4/mkostemp.m4 1486 m4/mkostemp.m4
1481 m4/mktime.m4 1487 m4/mktime.m4
diff --git a/m4/memset_explicit.m4 b/m4/memset_explicit.m4
new file mode 100644
index 00000000000..3d4dcb30955
--- /dev/null
+++ b/m4/memset_explicit.m4
@@ -0,0 +1,20 @@
1dnl Copyright 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_MEMSET_EXPLICIT],
7[
8 AC_REQUIRE([gl_STRING_H_DEFAULTS])
9
10 AC_CHECK_FUNCS_ONCE([memset_explicit])
11 if test $ac_cv_func_memset_explicit = no; then
12 HAVE_MEMSET_EXPLICIT=0
13 fi
14])
15
16AC_DEFUN([gl_PREREQ_MEMSET_EXPLICIT],
17[
18 AC_CHECK_FUNCS([explicit_memset])
19 AC_CHECK_FUNCS_ONCE([memset_s])
20])
diff --git a/m4/string_h.m4 b/m4/string_h.m4
index 9e09b96e165..6069d4a7523 100644
--- a/m4/string_h.m4
+++ b/m4/string_h.m4
@@ -5,7 +5,7 @@
5# gives unlimited permission to copy and/or distribute it, 5# gives unlimited permission to copy and/or distribute it,
6# with or without modifications, as long as this notice is preserved. 6# with or without modifications, as long as this notice is preserved.
7 7
8# serial 34 8# serial 35
9 9
10# Written by Paul Eggert. 10# Written by Paul Eggert.
11 11
@@ -21,7 +21,8 @@ AC_DEFUN_ONCE([gl_STRING_H],
21 dnl guaranteed by C89. 21 dnl guaranteed by C89.
22 gl_WARN_ON_USE_PREPARE([[#include <string.h> 22 gl_WARN_ON_USE_PREPARE([[#include <string.h>
23 ]], 23 ]],
24 [ffsl ffsll memmem mempcpy memrchr rawmemchr stpcpy stpncpy strchrnul 24 [explicit_bzero ffsl ffsll memmem mempcpy memrchr memset_explicit
25 rawmemchr stpcpy stpncpy strchrnul
25 strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r 26 strdup strncat strndup strnlen strpbrk strsep strcasestr strtok_r
26 strerror_r strerrorname_np sigabbrev_np sigdescr_np strsignal strverscmp]) 27 strerror_r strerrorname_np sigabbrev_np sigdescr_np strsignal strverscmp])
27 28
@@ -54,6 +55,7 @@ AC_DEFUN([gl_STRING_H_REQUIRE_DEFAULTS],
54 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMMEM]) 55 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMMEM])
55 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMPCPY]) 56 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMPCPY])
56 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMRCHR]) 57 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMRCHR])
58 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_MEMSET_EXPLICIT])
57 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RAWMEMCHR]) 59 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_RAWMEMCHR])
58 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPCPY]) 60 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPCPY])
59 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPNCPY]) 61 gl_MODULE_INDICATOR_INIT_VARIABLE([GNULIB_STPNCPY])
@@ -107,6 +109,7 @@ AC_DEFUN([gl_STRING_H_DEFAULTS],
107 HAVE_FFSLL=1; AC_SUBST([HAVE_FFSLL]) 109 HAVE_FFSLL=1; AC_SUBST([HAVE_FFSLL])
108 HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM]) 110 HAVE_DECL_MEMMEM=1; AC_SUBST([HAVE_DECL_MEMMEM])
109 HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY]) 111 HAVE_MEMPCPY=1; AC_SUBST([HAVE_MEMPCPY])
112 HAVE_MEMSET_EXPLICIT=1; AC_SUBST([HAVE_MEMSET_EXPLICIT])
110 HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR]) 113 HAVE_DECL_MEMRCHR=1; AC_SUBST([HAVE_DECL_MEMRCHR])
111 HAVE_RAWMEMCHR=1; AC_SUBST([HAVE_RAWMEMCHR]) 114 HAVE_RAWMEMCHR=1; AC_SUBST([HAVE_RAWMEMCHR])
112 HAVE_STPCPY=1; AC_SUBST([HAVE_STPCPY]) 115 HAVE_STPCPY=1; AC_SUBST([HAVE_STPCPY])