From: Nikos Mavrogiannopoulos Date: Sun, 11 Jan 2015 21:15:10 +0000 (+0100) Subject: pkcs11: when importing a public key, import it's data as well X-Git-Tag: gnutls_3_4_0~366 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e2b41763288626d7b7bec9c2d4076bd2312c2ff2;p=thirdparty%2Fgnutls.git pkcs11: when importing a public key, import it's data as well --- diff --git a/lib/pkcs11.c b/lib/pkcs11.c index a2b497cbb0..44c1b994c5 100644 --- a/lib/pkcs11.c +++ b/lib/pkcs11.c @@ -1466,6 +1466,7 @@ pkcs11_obj_import_pubkey(struct ck_function_list *module, { struct ck_attribute a[4]; ck_key_type_t key_type; + gnutls_datum_t data = {NULL,0}; int ret; ck_bool_t tval; @@ -1538,8 +1539,15 @@ pkcs11_obj_import_pubkey(struct ck_function_list *module, } } - return pkcs11_obj_import(CKO_PUBLIC_KEY, crt, NULL, id, label, + ret = pkcs11_get_attribute_avalue(module, pks, obj, CKA_VALUE, &data); + if (ret != CKR_OK) { + gnutls_assert(); + } + + ret = pkcs11_obj_import(CKO_PUBLIC_KEY, crt, &data, id, label, tinfo, lib_info); + gnutls_free(data.data); + return ret; } static int