Re: Replace px_memset() with explicit_bzero() - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Replace px_memset() with explicit_bzero()
Date
Msg-id 1d13668c-14af-45eb-8459-58e8d27f220b@eisentraut.org
Whole thread
In response to Re: Replace px_memset() with explicit_bzero()  (Daniel Gustafsson <daniel@yesql.se>)
List pgsql-hackers
On 25.08.26 14:27, Sehrope Sarkuni wrote:
> I eyeballed the patch. Looks mechanical and fine.
> 
> One thing stood out, but it's from the existing code:
> 
> 
> diff --git a/contrib/pgcrypto/crypt-sha.c b/contrib/pgcrypto/crypt-sha.c
> index 8191ba02b23..eab86f8206c 100644
> --- a/contrib/pgcrypto/crypt-sha.c
> +++ b/contrib/pgcrypto/crypt-sha.c
> @@ -477,7 +477,7 @@ px_crypt_shacrypt(const char *pw, const char *salt, 
> char *passwd, unsigned dstle
>    memcpy(cp, sha_buf_tmp, block);
> 
>    /* Make sure we don't leave something important behind */
> - px_memset(&sha_buf_tmp, 0, sizeof sha_buf);
> + explicit_bzero(&sha_buf_tmp, sizeof sha_buf);
> 
>    /*-
>    * 21. Repeat a loop according to the number specified in the rounds=<N>
> 
> 
> That's sha_buf in the sizeof but we're zeroing out sha_buf_tmp.
> 
> They're both of length PX_SHACRYPT_DIGEST_MAX_LEN so the result is the 
> same. It just reads weird.
> 
> Might as well fix that now too if going to touch that line.

Thanks.  I committed that fix along with the rest of the patch.



pgsql-hackers by date:

Previous
From: Bertrand Drouvot
Date:
Subject: Re: pgstat: Flush some statistics within running transactions, take 2
Next
From: Peter Eisentraut
Date:
Subject: Re: pgcrypto: remove useless px_memset() and BF_ASM