]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
gnutls_x509_privkey_import: immediately exit on GNUTLS_E_PK_INVALID_PRIVKEY
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Thu, 3 Aug 2017 13:08:43 +0000 (15:08 +0200)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Fri, 4 Aug 2017 09:08:51 +0000 (11:08 +0200)
Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
lib/x509/privkey.c

index 7b8423c47e306c868b1b80bbaf19543526ae0f45..b7c5038db00920b55089fad6c135a42c7c5b9e51 100644 (file)
@@ -585,6 +585,7 @@ gnutls_x509_privkey_import(gnutls_x509_privkey_t key,
                if (result < 0) {
                        gnutls_assert();
                        key->key = NULL;
+                       goto cleanup;
                }
        } else if (key->params.algo == GNUTLS_PK_RSA) {
                key->key =
@@ -624,6 +625,8 @@ gnutls_x509_privkey_import(gnutls_x509_privkey_t key,
                                        if (result < 0) {
                                                gnutls_assert();
                                                key->key = NULL;
+                                               if (result == GNUTLS_E_PK_INVALID_PRIVKEY)
+                                                       goto cleanup;
                                        }
                                }