]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
pkcs7: corrected error checking in write_signer_id
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Mon, 20 Feb 2017 14:02:22 +0000 (15:02 +0100)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Mon, 20 Feb 2017 17:52:20 +0000 (18:52 +0100)
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
lib/x509/pkcs7.c

index ded49e818d5e9ff455b43225bea7b89f9f1c673b..8b40b5b99456aedd669eb122f1e1fe09ae1ce3bd 100644 (file)
@@ -1209,7 +1209,7 @@ static gnutls_x509_crt_t find_child_of_with_serial(gnutls_pkcs7_t pkcs7,
                        }
                } else {
                        gnutls_assert();
-                       ret = GNUTLS_E_PARSING_ERROR;
+                       crt = NULL;
                        goto fail;
                }
 
@@ -2061,7 +2061,7 @@ static int write_signer_id(ASN1_TYPE c2, const char *root,
                const uint8_t ver = 3;
 
                snprintf(name, sizeof(name), "%s.version", root);
-               result = asn1_write_value(c2, name, &ver, 1);
+               asn1_write_value(c2, name, &ver, 1);
 
                snprintf(name, sizeof(name), "%s.sid", root);
                result = asn1_write_value(c2, name, "subjectKeyIdentifier", 1);
@@ -2213,9 +2213,8 @@ static int write_attributes(ASN1_TYPE c2, const char *root,
 
                snprintf(name, sizeof(name), "%s.?LAST.values.?1", root);
                ret = _gnutls_x509_set_raw_time(c2, name, gnutls_time(0));
-               if (result != ASN1_SUCCESS) {
+               if (ret < 0) {
                        gnutls_assert();
-                       ret = _gnutls_asn2err(result);
                        return ret;
                }
 
@@ -2272,8 +2271,6 @@ static int write_attributes(ASN1_TYPE c2, const char *root,
                        return ret;
                }
 
-               already_set = 1;
-
                /* If we add any attribute we should add them all */
                /* Add hash */
                digest_size = _gnutls_hash_get_algo_len(me);