summaryrefslogtreecommitdiff
path: root/contrib/pgcrypto/sha2.c
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2014-04-17 12:37:53 -0400
committerBruce Momjian <bruce@momjian.us>2014-04-17 12:37:53 -0400
commitfc02b87e2876b2492a3d5eebd3b70be383b08f40 (patch)
tree19301491c363e8f87b15d53f1f742b5975161749 /contrib/pgcrypto/sha2.c
parent179c45ae2fb9519a343bc2e38ebe4609097d14af (diff)
pgcrypto: fix memset() calls that might be optimized away
Specifically, on-stack memset() might be removed, so: * Replace memset() with px_memset() * Add px_memset to copy_crlf() * Add px_memset to pgp-s2k.c Patch by Marko Kreen Report by PVS-Studio Backpatch through 8.4.
Diffstat (limited to 'contrib/pgcrypto/sha2.c')
-rw-r--r--contrib/pgcrypto/sha2.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/contrib/pgcrypto/sha2.c b/contrib/pgcrypto/sha2.c
index 5de94b2fcda..bde1f61b311 100644
--- a/contrib/pgcrypto/sha2.c
+++ b/contrib/pgcrypto/sha2.c
@@ -40,6 +40,7 @@
#include <sys/param.h>
+#include "px.h"
#include "sha2.h"
/*
@@ -570,7 +571,7 @@ SHA256_Final(uint8 digest[], SHA256_CTX *context)
}
/* Clean up state data: */
- memset(context, 0, sizeof(*context));
+ px_memset(context, 0, sizeof(*context));
}
@@ -899,7 +900,7 @@ SHA512_Final(uint8 digest[], SHA512_CTX *context)
}
/* Zero out state data */
- memset(context, 0, sizeof(*context));
+ px_memset(context, 0, sizeof(*context));
}
@@ -944,7 +945,7 @@ SHA384_Final(uint8 digest[], SHA384_CTX *context)
}
/* Zero out state data */
- memset(context, 0, sizeof(*context));
+ px_memset(context, 0, sizeof(*context));
}
/*** SHA-224: *********************************************************/
@@ -987,5 +988,5 @@ SHA224_Final(uint8 digest[], SHA224_CTX *context)
}
/* Clean up state data: */
- memset(context, 0, sizeof(*context));
+ px_memset(context, 0, sizeof(*context));
}