summaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorPeter Eisentraut <peter@eisentraut.org>2019-09-05 08:15:58 +0200
committerPeter Eisentraut <peter@eisentraut.org>2019-09-05 08:30:42 +0200
commit74a308cf5221f491776fcdb4dc36eb61678dbc6f (patch)
treec2e9a146616d9b40dcd606db4030abcd1b1fe25b /src/include
parentae060a52b2881ea842f596fa78b8d09f9a91b149 (diff)
Use explicit_bzero
Use the explicit_bzero() function in places where it is important that security information such as passwords is cleared from memory. There might be other places where it could be useful; this is just an initial collection. For platforms that don't have explicit_bzero(), provide various fallback implementations. (explicit_bzero() itself isn't standard, but as Linux/glibc, FreeBSD, and OpenBSD have it, it's the most common spelling, so it makes sense to make that the invocation point.) Discussion: https://www.postgresql.org/message-id/flat/42d26bde-5d5b-c90d-87ae-6cab875f73be%402ndquadrant.com
Diffstat (limited to 'src/include')
-rw-r--r--src/include/pg_config.h.in6
-rw-r--r--src/include/pg_config.h.win326
-rw-r--r--src/include/port.h4
3 files changed, 16 insertions, 0 deletions
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in
index d876926c21a..c6014e83fa8 100644
--- a/src/include/pg_config.h.in
+++ b/src/include/pg_config.h.in
@@ -195,6 +195,9 @@
/* Define to 1 if you have the <editline/readline.h> header file. */
#undef HAVE_EDITLINE_READLINE_H
+/* Define to 1 if you have the `explicit_bzero' function. */
+#undef HAVE_EXPLICIT_BZERO
+
/* Define to 1 if you have the `fdatasync' function. */
#undef HAVE_FDATASYNC
@@ -395,6 +398,9 @@
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
+/* Define to 1 if you have the `memset_s' function. */
+#undef HAVE_MEMSET_S
+
/* Define to 1 if the system has the type `MINIDUMP_TYPE'. */
#undef HAVE_MINIDUMP_TYPE
diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32
index fc50528590a..5bbf476990f 100644
--- a/src/include/pg_config.h.win32
+++ b/src/include/pg_config.h.win32
@@ -153,6 +153,9 @@
/* Define to 1 if you have the <editline/readline.h> header file. */
/* #undef HAVE_EDITLINE_READLINE_H */
+/* Define to 1 if you have the `explicit_bzero' function. */
+/* #undef HAVE_EXPLICIT_BZERO */
+
/* Define to 1 if you have the `fdatasync' function. */
/* #undef HAVE_FDATASYNC */
@@ -283,6 +286,9 @@
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
+/* Define to 1 if you have the `memset_s' function. */
+/* #undef HAVE_MEMSET_S */
+
/* Define to 1 if the system has the type `MINIDUMP_TYPE'. */
#define HAVE_MINIDUMP_TYPE 1
diff --git a/src/include/port.h b/src/include/port.h
index 55619d893ce..30b6378ae56 100644
--- a/src/include/port.h
+++ b/src/include/port.h
@@ -378,6 +378,10 @@ extern int isinf(double x);
#endif /* __clang__ && !__cplusplus */
#endif /* !HAVE_ISINF */
+#ifndef HAVE_EXPLICIT_BZERO
+extern void explicit_bzero(void *buf, size_t len);
+#endif
+
#ifndef HAVE_STRTOF
extern float strtof(const char *nptr, char **endptr);
#endif