From 62965b688f906106b1cec252162da55850d31e3f Mon Sep 17 00:00:00 2001
From: Jonathan McDowell <noodles@earth.li>
Date: Sat, 16 Sep 2023 14:57:02 +0530
Subject: [PATCH] Relax version check on parsing signature + key packets

Rather than ensuring signatures/keys are no more than v5 allow them to
be anything from v2 onwards; otherwise things like armor/dearmor won't
work properly.
---
 parsekey.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/parsekey.c b/parsekey.c
index ceff429..e3fe800 100644
--- a/parsekey.c
+++ b/parsekey.c
@@ -378,9 +378,8 @@ onak_status_t read_openpgp_stream(size_t (*getchar_func)(void *ctx, size_t count
 			case OPENPGP_PACKET_SIGNATURE:
 			case OPENPGP_PACKET_SECRETKEY:
 			case OPENPGP_PACKET_PUBLICKEY:
-				/* Must be v2 -> v5 */
-				if (curpacket->packet->data[0] < 2 ||
-					curpacket->packet->data[0] > 5) {
+				/* Must be v2 onwards */
+				if (curpacket->packet->data[0] < 2) {
 					rc = ONAK_E_INVALID_PKT;
 				}
 				break;
-- 
2.39.5