pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruce Momjian <bruce@momjian.us>
To: Masahiko Sawada <masahiko.sawada@2ndquadrant.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: Proposed patch for key managment
Date: Fri, 4 Dec 2020 22:52:29 -0500
Message-ID: <20201205035229.GC8757@momjian.us> (raw)
In-Reply-To: <CA+fd4k7eHyvqU8FbDTcK_GV0Qc6+QyJCoaFF9dHipJSG9pWmcQ@mail.gmail.com>
References: <20201202213814.GG20285@momjian.us>
	<20201205020803.GA8757@momjian.us>
	<CA+fd4k7eHyvqU8FbDTcK_GV0Qc6+QyJCoaFF9dHipJSG9pWmcQ@mail.gmail.com>

On Sat, Dec  5, 2020 at 12:15:13PM +0900, Masahiko Sawada wrote:
> diff --git a/src/common/cryptohash_openssl.c b/src/common/cryptohash_openssl.c
> index e5233daab6..a45c86fa67 100644
> --- a/src/common/cryptohash_openssl.c
> +++ b/src/common/cryptohash_openssl.c
> @@ -81,6 +81,8 @@ pg_cryptohash_create(pg_cryptohash_type type)
>         return NULL;
>     }
> 
> +   memset(ctx, 0, sizeof(pg_cryptohash_ctx));
> +   memset(state, 0, sizeof(pg_cryptohash_state));
>     ctx->data = state;
>     ctx->type = type;

OK, I worked with Sawada-san and added the attached patch.  The updated
full patch is at the same URL:  :-)

	https://github.com/postgres/postgres/compare/master...bmomjian:key.diff

-- 
  Bruce Momjian  <bruce@momjian.us>        https://momjian.us
  EnterpriseDB                             https://enterprisedb.com

  The usefulness of a cup is in its emptiness, Bruce Lee

Attachments:

bzero.diff (text/x-diff, 917B) download diff --git a/src/common/cryptohash_openssl.c b/src/common/cryptohash_openssl.c index e5233daab6..02dec1fd1b 100644 --- a/src/common/cryptohash_openssl.c +++ b/src/common/cryptohash_openssl.c @@ -72,14 +72,15 @@ pg_cryptohash_create(pg_cryptohash_type type) ctx = ALLOC(sizeof(pg_cryptohash_ctx)); if (ctx == NULL) return NULL; + explicit_bzero(ctx, sizeof(pg_cryptohash_ctx)); state = ALLOC(sizeof(pg_cryptohash_state)); if (state == NULL) { - explicit_bzero(ctx, sizeof(pg_cryptohash_ctx)); FREE(ctx); return NULL; } + explicit_bzero(state, sizeof(pg_cryptohash_state)); ctx->data = state; ctx->type = type; @@ -97,8 +98,6 @@ pg_cryptohash_create(pg_cryptohash_type type) if (state->evpctx == NULL) { - explicit_bzero(state, sizeof(pg_cryptohash_state)); - explicit_bzero(ctx, sizeof(pg_cryptohash_ctx)); #ifndef FRONTEND ereport(ERROR, (errcode(ERRCODE_OUT_OF_MEMORY),

view thread (93+ messages)  latest in thread

Message-ID: <20201205035229.GC8757@momjian.us>
Permalink:  ../20201205035229.GC8757@momjian.us/
Also on:    postgresql.org/message-id/20201205035229.GC8757@momjian.us

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: bruce@momjian.us, masahiko.sawada@2ndquadrant.com
  Subject: Re: Proposed patch for key managment
  In-Reply-To: <20201205035229.GC8757@momjian.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox