summaryrefslogtreecommitdiff
path: root/lib/pkcs11_privkey.c
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2018-10-25 10:03:01 -0400
committerNikos Mavrogiannopoulos <nmav@redhat.com>2018-11-19 16:50:13 +0100
commit88377775a3eff679a9ec60ab9bfc6b3c683a0407 (patch)
tree758b81f44c5884106aec82eb93b074d69871b80a /lib/pkcs11_privkey.c
parenta853e12076f66154d893a1b97de44d91c5269d68 (diff)
downloadgnutls-88377775a3eff679a9ec60ab9bfc6b3c683a0407.tar.gz
Add support for EDDSA/Ed25519 object support via PKCS#11
Tested with softHSM 2.5.0 Resolves #417 Signed-off-by: Simo Sorce <simo@redhat.com> Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
Diffstat (limited to 'lib/pkcs11_privkey.c')
-rw-r--r--lib/pkcs11_privkey.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/pkcs11_privkey.c b/lib/pkcs11_privkey.c
index b721ed1252..f643a69a66 100644
--- a/lib/pkcs11_privkey.c
+++ b/lib/pkcs11_privkey.c
@@ -1075,6 +1075,29 @@ gnutls_pkcs11_privkey_generate3(const char *url, gnutls_pk_algorithm_t pk,
a[a_val].value = der.data;
a[a_val].value_len = der.size;
a_val++;
+
+ break;
+ case GNUTLS_PK_EDDSA_ED25519:
+ p[p_val].type = CKA_SIGN;
+ p[p_val].value = (void *) &tval;
+ p[p_val].value_len = sizeof(tval);
+ p_val++;
+
+ a[a_val].type = CKA_VERIFY;
+ a[a_val].value = (void *) &tval;
+ a[a_val].value_len = sizeof(tval);
+ a_val++;
+
+ ret = _gnutls_x509_write_ecc_params(GNUTLS_ECC_CURVE_ED25519, &der);
+ if (ret < 0) {
+ gnutls_assert();
+ goto cleanup;
+ }
+
+ a[a_val].type = CKA_EC_PARAMS;
+ a[a_val].value = der.data;
+ a[a_val].value_len = der.size;
+ a_val++;
break;
default:
ret = gnutls_assert_val(GNUTLS_E_INVALID_REQUEST);