1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-26 01:22:12 +03:00

Improve some code around cryptohash functions

This adjusts some code related to recent changes for cryptohash
functions:
- Add a variable in md5.h to track down the size of a computed result,
moved from pgcrypto.  Note that pg_md5_hash() assumed a result of this
size already.
- Call explicit_bzero() on the hashed data when freeing the context for
fallback implementations.  For MD5, particularly, it would be annoying
to leave some non-zeroed data around.
- Clean up some code related to recent changes of uuid-ossp.  .gitignore
still included md5.c and a comment was incorrect.

Discussion: https://postgr.es/m/X9HXKTgrvJvYO7Oh@paquier.xyz
This commit is contained in:
Michael Paquier
2020-12-14 12:38:13 +09:00
parent df9274adf3
commit 9b584953e7
6 changed files with 27 additions and 8 deletions

View File

@ -69,7 +69,7 @@ bytesToHex(uint8 b[16], char *s)
bool
pg_md5_hash(const void *buff, size_t len, char *hexsum)
{
uint8 sum[16];
uint8 sum[MD5_DIGEST_LENGTH];
pg_cryptohash_ctx *ctx;
ctx = pg_cryptohash_create(PG_MD5);