File opensc-CVE-2024-8443.patch of Package opensc.35665

commit b28a3cef416fcfb92fbb9ea7fd3c71df52c6c9fc
Author: Jakub Jelen <jjelen@redhat.com>
Date:   Mon Aug 12 19:02:14 2024 +0200

    openpgp: Do not accept non-matching key responses
    
    When generating RSA key pair using PKCS#15 init, the driver could accept
    responses relevant to ECC keys, which made further processing in the
    pkcs15-init failing/accessing invalid parts of structures.
    
    Thanks oss-fuzz!
    
    https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=71010
    
    Signed-off-by: Jakub Jelen <jjelen@redhat.com>

Index: opensc-0.13.0/src/libopensc/card-openpgp.c
===================================================================
--- opensc-0.13.0.orig/src/libopensc/card-openpgp.c
+++ opensc-0.13.0/src/libopensc/card-openpgp.c
@@ -1601,12 +1601,14 @@ pgp_calculate_and_store_fingerprint(sc_c
 	sc_log(card->ctx, "Update the blob containing fingerprints (00C5)");
 	fpseq_blob = pgp_find_blob(card, 0x00C5);
 	if (!fpseq_blob) {
+               r = SC_ERROR_OUT_OF_MEMORY;
 		sc_log(card->ctx, "Not found 00C5");
 		goto exit;
 	}
 	/* Save the fingerprints sequence */
 	newdata = malloc(fpseq_blob->len);
 	if (!newdata) {
+                r = SC_ERROR_OUT_OF_MEMORY;
 		sc_log(card->ctx, "Not enough memory to update fingerprints blob.");
 		goto exit;
 	}
openSUSE Build Service is sponsored by