kumquat-buildroot/package/libopenssl/0005-Fix-genstr-genconf-option-in-asn1parse.patch
Martin Kurbanov 55c6ae5656 package/libopenssl: add patches fixing hangs asn1parse
The asn1parse command hangs forever on 3.2.0 when the genstr or genconf
option is passed.

This commit fixes the issue by adding upstream commits [1] [2].

[1] a552c23c65
[2] 749fcc0e3c

Signed-off-by: Martin Kurbanov <mmkurbanov@salutedevices.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2024-02-07 19:51:23 +01:00

43 lines
1.6 KiB
Diff

From 749fcc0e3ce796474a15d6fac221e57daeacff1e Mon Sep 17 00:00:00 2001
From: Neil Horman <nhorman@openssl.org>
Date: Tue, 5 Dec 2023 14:50:01 -0500
Subject: [PATCH] Fix genstr/genconf option in asn1parse
At some point the asn1parse applet was changed to default the inform to
PEM, and defalt input file to stdin. Doing so broke the -genstr|conf options,
in that, before we attempt to generate an ASN1 block from the provided
genstr string, we attempt to read a PEM input from stdin. As a result,
this command:
openssl asn1parse -genstr OID:1.2.3.4
hangs because we are attempting a blocking read on stdin, waiting for
data that never arrives
Fix it by giving priority to genstr|genconf, such that, if set, will just run
do_generate on that string and exit
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22957)
Upstream: https://github.com/openssl/openssl/commit/749fcc0e3ce796474a15d6fac221e57daeacff1e
Signed-off-by: Martin Kurbanov <mmkurbanov@salutedevices.com>
---
apps/asn1parse.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/apps/asn1parse.c b/apps/asn1parse.c
index 097b0cc1ed..6597a6180b 100644
--- a/apps/asn1parse.c
+++ b/apps/asn1parse.c
@@ -178,7 +178,7 @@ int asn1parse_main(int argc, char **argv)
if ((buf = BUF_MEM_new()) == NULL)
goto end;
- if (informat == FORMAT_PEM) {
+ if (genstr == NULL && informat == FORMAT_PEM) {
if (PEM_read_bio(in, &name, &header, &str, &num) != 1) {
BIO_printf(bio_err, "Error reading PEM file\n");
ERR_print_errors(bio_err);
--
2.40.0