Skip to content

Commit aecaa04

Browse files
committed
Add error code for encryption failure in pgcrypto
PXE_DECRYPT_FAILED exists already for decryption errors, and an equivalent for encryption did not exist. There is one code path that deals with such failures for OpenSSL but it used PXE_ERR_GENERIC, which was inconsistent. This switches this code path to use the new error PXE_ENCRYPT_FAILED instead of PXE_ERR_GENERIC, making the code used for encryption more consistent with the decryption. Author: Daniel Gustafsson Discussion: https://postgr.es/m/03049139-CB7A-436E-B71B-42696D3E2EF7@yesql.se
1 parent d2246cd commit aecaa04

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

contrib/pgcrypto/openssl.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ gen_ossl_encrypt(PX_Cipher *c, const uint8 *data, unsigned dlen,
400400
}
401401

402402
if (!EVP_EncryptUpdate(od->evp_ctx, res, &outlen, data, dlen))
403-
return PXE_ERR_GENERIC;
403+
return PXE_ENCRYPT_FAILED;
404404

405405
return 0;
406406
}

contrib/pgcrypto/px.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ static const struct error_desc px_err_list[] = {
5858
{PXE_MCRYPT_INTERNAL, "mcrypt internal error"},
5959
{PXE_NO_RANDOM, "Failed to generate strong random bits"},
6060
{PXE_DECRYPT_FAILED, "Decryption failed"},
61+
{PXE_ENCRYPT_FAILED, "Encryption failed"},
6162
{PXE_PGP_CORRUPT_DATA, "Wrong key or corrupt data"},
6263
{PXE_PGP_CORRUPT_ARMOR, "Corrupt ascii-armor"},
6364
{PXE_PGP_UNSUPPORTED_COMPR, "Unsupported compression algorithm"},

contrib/pgcrypto/px.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
#define PXE_MCRYPT_INTERNAL -16
6262
#define PXE_NO_RANDOM -17
6363
#define PXE_DECRYPT_FAILED -18
64+
#define PXE_ENCRYPT_FAILED -19
6465

6566
#define PXE_PGP_CORRUPT_DATA -100
6667
#define PXE_PGP_CORRUPT_ARMOR -101

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy