From 497cdc69db73fb91539f5a1d1d05da1b3a625849 Mon Sep 17 00:00:00 2001 From: Nikos Mavrogiannopoulos Date: Thu, 27 Feb 2014 19:42:26 +0100 Subject: [PATCH] corrected return codes (cherry picked from commit 6aa26f78150ccbdf0aec1878a41c17c41d358a3b) Conflicts: lib/x509/verify.c --- lib/x509/verify.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/x509/verify.c b/lib/x509/verify.c index 1ab1357..1f817d8 100644 --- a/lib/x509/verify.c +++ b/lib/x509/verify.c @@ -132,7 +132,7 @@ check_if_ca (gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer, if (result < 0) { gnutls_assert (); - goto cleanup; + goto fail; } result = @@ -141,7 +141,7 @@ check_if_ca (gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer, if (result < 0) { gnutls_assert (); - goto cleanup; + goto fail; } result = @@ -149,7 +149,7 @@ check_if_ca (gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer, if (result < 0) { gnutls_assert (); - goto cleanup; + goto fail; } result = @@ -157,7 +157,7 @@ check_if_ca (gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer, if (result < 0) { gnutls_assert (); - goto cleanup; + goto fail; } /* If the subject certificate is the same as the issuer @@ -197,6 +197,7 @@ check_if_ca (gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer, else gnutls_assert (); +fail: result = 0; cleanup: @@ -397,7 +398,7 @@ _gnutls_verify_certificate2 (gnutls_x509_crt_t cert, gnutls_datum_t cert_signed_data = { NULL, 0 }; gnutls_datum_t cert_signature = { NULL, 0 }; gnutls_x509_crt_t issuer = NULL; - int issuer_version, result, hash_algo; + int issuer_version, result = 0, hash_algo; unsigned int out = 0; if (output) @@ -435,7 +436,7 @@ _gnutls_verify_certificate2 (gnutls_x509_crt_t cert, if (issuer_version < 0) { gnutls_assert (); - return issuer_version; + return 0; } if (!(flags & GNUTLS_VERIFY_DISABLE_CA_SIGN) && @@ -459,6 +460,7 @@ _gnutls_verify_certificate2 (gnutls_x509_crt_t cert, if (result < 0) { gnutls_assert (); + result = 0; goto cleanup; } @@ -467,6 +469,7 @@ _gnutls_verify_certificate2 (gnutls_x509_crt_t cert, if (result < 0) { gnutls_assert (); + result = 0; goto cleanup; } @@ -494,6 +497,7 @@ _gnutls_verify_certificate2 (gnutls_x509_crt_t cert, else if (result < 0) { gnutls_assert(); + result = 0; goto cleanup; } -- 1.7.10