Hi, I noticed that PGP_Context.mdc_checked field is write-only and not used for anything. Since it's marked as an internal variable I'm pretty confident it's safe to remove it. The patch is attached.
-- Best regards, Aleksander Alekseev
From 796246168a709ccf737e90d41ceadfda16002b00 Mon Sep 17 00:00:00 2001 From: Aleksander Alekseev <[email protected]> Date: Thu, 13 Aug 2026 12:38:02 +0300 Subject: [PATCH v1] pgcrypto: remove unused PGP_Context.mdc_checked field mdc_finish() set this field once it had successfully verified the MDC packet. Its only reader used to be in the same function. That branch was removed by a59ee881978 when mdc_finish() stopped being called through the pullf_read() API, and nothing has looked at the field since. Note that MDC verification does not rely on it: process_data_packets() tracks whether an MDC packet was seen in its local got_mdc variable and rejects the message if a required MDC is missing, while the use_mdcbuf_filter path checks the hash in mdcbuf_finish(). Oversight in a59ee881978. Author: Aleksander Alekseev <[email protected]> Reviewed-by: TODO FIXME Discussion: TODO FIXME --- contrib/pgcrypto/pgp-decrypt.c | 1 - contrib/pgcrypto/pgp.h | 1 - 2 files changed, 2 deletions(-) diff --git a/contrib/pgcrypto/pgp-decrypt.c b/contrib/pgcrypto/pgp-decrypt.c index 47ae83db789..5f4be35b25a 100644 --- a/contrib/pgcrypto/pgp-decrypt.c +++ b/contrib/pgcrypto/pgp-decrypt.c @@ -388,7 +388,6 @@ mdc_finish(PGP_Context *ctx, PullFilter *src, int len) px_debug("mdc_finish: mdc failed"); return PXE_PGP_CORRUPT_DATA; } - ctx->mdc_checked = 1; return 0; } diff --git a/contrib/pgcrypto/pgp.h b/contrib/pgcrypto/pgp.h index 7b130388fcc..3c4610608d1 100644 --- a/contrib/pgcrypto/pgp.h +++ b/contrib/pgcrypto/pgp.h @@ -156,7 +156,6 @@ struct PGP_Context /* * internal variables */ - int mdc_checked; int corrupt_prefix; /* prefix failed RFC 4880 "quick check" */ int unsupported_compr; /* has bzip2 compression */ int unexpected_binary; /* binary data seen in text_mode */ -- 2.43.0
