From: Nikos Mavrogiannopoulos Date: Thu, 31 Dec 2015 11:35:30 +0000 (+0200) Subject: gnutls_pkcs11_copy_x509_privkey2: corrected the type of the written object X-Git-Tag: gnutls_3_5_0~432 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3eeec745046d6048bba74cc96d92056aa2c0aec5;p=thirdparty%2Fgnutls.git gnutls_pkcs11_copy_x509_privkey2: corrected the type of the written object Previously only RSA objects were correctly written. --- diff --git a/lib/pkcs11_write.c b/lib/pkcs11_write.c index d8b756f68e..413a9504ca 100644 --- a/lib/pkcs11_write.c +++ b/lib/pkcs11_write.c @@ -722,11 +722,6 @@ gnutls_pkcs11_copy_x509_privkey2(const char *token_url, a_val++; } - a[a_val].type = CKA_KEY_TYPE; - a[a_val].value = &type; - a[a_val].value_len = sizeof(type); - a_val++; - a[a_val].type = CKA_TOKEN; a[a_val].value = (void *) &tval; a[a_val].value_len = sizeof(tval); @@ -916,6 +911,11 @@ gnutls_pkcs11_copy_x509_privkey2(const char *token_url, goto cleanup; } + a[a_val].type = CKA_KEY_TYPE; + a[a_val].value = &type; + a[a_val].value_len = sizeof(type); + a_val++; + rv = pkcs11_create_object(sinfo.module, sinfo.pks, a, a_val, &obj); if (rv != CKR_OK) { gnutls_assert();