diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2017-02-20 15:02:22 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2017-02-20 18:52:20 +0100 |
commit | 0bafa12e1b4e8c97432e0f153e5fcea1bef29b71 (patch) | |
tree | d7445fd1e71f9ecb823676d033208ac70bad2395 | |
parent | 766ae1587d5a62f3f569a6fd40947b4c85844eaa (diff) | |
download | gnutls-0bafa12e1b4e8c97432e0f153e5fcea1bef29b71.tar.gz |
pkcs7: corrected error checking in write_signer_id
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
-rw-r--r-- | lib/x509/pkcs7.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/x509/pkcs7.c b/lib/x509/pkcs7.c index ded49e818d..8b40b5b994 100644 --- a/lib/x509/pkcs7.c +++ b/lib/x509/pkcs7.c @@ -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); |