summaryrefslogtreecommitdiff
path: root/lib/x509
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2017-07-30 03:43:42 +0200
committerNikos Mavrogiannopoulos <nmav@redhat.com>2017-08-04 16:53:54 +0200
commitcc75caff672625ed5a0f0c5e6d3eb10a6b0c7a12 (patch)
treebf50af67e083dc8c99b38c9fd2a126f86bf8b554 /lib/x509
parent76ffecfc2fb98042f7d90db7d729cce9ebfa9db2 (diff)
downloadgnutls-cc75caff672625ed5a0f0c5e6d3eb10a6b0c7a12.tar.gz
gnutls_x509_privkey_import: allow importing ed25519 PKCS#8 keys in DER form
Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Diffstat (limited to 'lib/x509')
-rw-r--r--lib/x509/privkey.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/x509/privkey.c b/lib/x509/privkey.c
index 2edebee6ed..87de8087cc 100644
--- a/lib/x509/privkey.c
+++ b/lib/x509/privkey.c
@@ -627,14 +627,18 @@ gnutls_x509_privkey_import(gnutls_x509_privkey_t key,
gnutls_x509_privkey_import_pkcs8(key, data, format,
NULL,
GNUTLS_PKCS_PLAIN);
- if (result < 0) {
- gnutls_assert();
- key->key = NULL;
- if (result == GNUTLS_E_PK_INVALID_PRIVKEY)
- goto cleanup;
+ if (result >= 0) {
+ /* there are keys (ed25519) which leave key->key NULL */
+ goto finish;
}
- }
+ /* result < 0 */
+ gnutls_assert();
+ key->key = NULL;
+
+ if (result == GNUTLS_E_PK_INVALID_PRIVKEY)
+ goto cleanup;
+ }
}
}
}