v2-0002-pgcrypto-report-init-errors-as-PXE_CIPHER_INIT.patch
application/octet-stream
Filename: v2-0002-pgcrypto-report-init-errors-as-PXE_CIPHER_INIT.patch
Type: application/octet-stream
Part: 1
Patch
Format: format-patch
Series: patch v2-0002
Subject: pgcrypto: report init errors as PXE_CIPHER_INIT
| File | + | − |
|---|---|---|
| contrib/pgcrypto/openssl.c | 2 | 2 |
| contrib/pgcrypto/px.c | 0 | 1 |
| contrib/pgcrypto/px.h | 1 | 1 |
From b8fc79023c3cf9d2ee7dcf34d9efd8838643f33f Mon Sep 17 00:00:00 2001
From: Daniel Gustafsson <daniel@yesql.se>
Date: Sat, 23 Apr 2022 02:48:30 +0200
Subject: [PATCH v2 2/3] pgcrypto: report init errors as PXE_CIPHER_INIT
Report OpenSSL errors during initialization as PXE_CIPHER_INIT since
that's just what they were, and not generic unknown errors. This also
removes the last users of the generic error, and thus it can be removed.
---
contrib/pgcrypto/openssl.c | 4 ++--
contrib/pgcrypto/px.c | 1 -
contrib/pgcrypto/px.h | 2 +-
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/contrib/pgcrypto/openssl.c b/contrib/pgcrypto/openssl.c
index 68fd61b716..53e64297c2 100644
--- a/contrib/pgcrypto/openssl.c
+++ b/contrib/pgcrypto/openssl.c
@@ -209,13 +209,13 @@ px_find_digest(const char *name, PX_MD **res)
if (!ctx)
{
pfree(digest);
- return -1;
+ return PXE_CIPHER_INIT;
}
if (EVP_DigestInit_ex(ctx, md, NULL) == 0)
{
EVP_MD_CTX_destroy(ctx);
pfree(digest);
- return -1;
+ return PXE_CIPHER_INIT;
}
digest->algo = md;
diff --git a/contrib/pgcrypto/px.c b/contrib/pgcrypto/px.c
index c139798f3b..40b6a04d52 100644
--- a/contrib/pgcrypto/px.c
+++ b/contrib/pgcrypto/px.c
@@ -41,7 +41,6 @@ struct error_desc
static const struct error_desc px_err_list[] = {
{PXE_OK, "Everything ok"},
- {PXE_ERR_GENERIC, "Some PX error (not specified)"},
{PXE_NO_HASH, "No such hash algorithm"},
{PXE_NO_CIPHER, "No such cipher algorithm"},
{PXE_BAD_OPTION, "Unknown option"},
diff --git a/contrib/pgcrypto/px.h b/contrib/pgcrypto/px.h
index f175862f8e..4ef40f3f1c 100644
--- a/contrib/pgcrypto/px.h
+++ b/contrib/pgcrypto/px.h
@@ -44,7 +44,7 @@
* PX error codes
*/
#define PXE_OK 0
-#define PXE_ERR_GENERIC -1
+/* -1 is unused */
#define PXE_NO_HASH -2
#define PXE_NO_CIPHER -3
/* -4 is unused */
--
2.32.0 (Apple Git-132)