diff --git a/src/common/hmac.c b/src/common/hmac.c index 592f9b20a38..a27778e86b3 100644 --- a/src/common/hmac.c +++ b/src/common/hmac.c @@ -46,9 +46,7 @@ typedef enum pg_hmac_errno PG_HMAC_ERROR_INTERNAL } pg_hmac_errno; -/* - * Internal structure for pg_hmac_ctx->data with this implementation. - */ +/* Internal pg_hmac_ctx structure */ struct pg_hmac_ctx { pg_cryptohash_ctx *hash; diff --git a/src/common/hmac_openssl.c b/src/common/hmac_openssl.c index c352f9db9e9..44f36d51dcb 100644 --- a/src/common/hmac_openssl.c +++ b/src/common/hmac_openssl.c @@ -60,9 +60,7 @@ typedef enum pg_hmac_errno PG_HMAC_ERROR_OPENSSL } pg_hmac_errno; -/* - * Internal structure for pg_hmac_ctx->data with this implementation. - */ +/* Internal pg_hmac_ctx structure */ struct pg_hmac_ctx { HMAC_CTX *hmacctx; diff --git a/src/common/scram-common.c b/src/common/scram-common.c index 5f90397c66d..8896b1e73e4 100644 --- a/src/common/scram-common.c +++ b/src/common/scram-common.c @@ -44,7 +44,10 @@ scram_SaltedPassword(const char *password, pg_hmac_ctx *hmac_ctx = pg_hmac_create(PG_SHA256); if (hmac_ctx == NULL) + { + *errstr = pg_hmac_error(NULL); /* returns OOM */ return -1; + } /* * Iterate hash calculation of HMAC entry using given salt. This is @@ -126,7 +129,10 @@ scram_ClientKey(const uint8 *salted_password, uint8 *result, pg_hmac_ctx *ctx = pg_hmac_create(PG_SHA256); if (ctx == NULL) + { + *errstr = pg_hmac_error(NULL); /* returns OOM */ return -1; + } if (pg_hmac_init(ctx, salted_password, SCRAM_KEY_LEN) < 0 || pg_hmac_update(ctx, (uint8 *) "Client Key", strlen("Client Key")) < 0 ||