From: Nikos Mavrogiannopoulos Date: Mon, 12 Jan 2015 16:12:56 +0000 (+0100) Subject: pkcs11: when importing a public key, import it's data as well (version 2 fix) X-Git-Tag: gnutls_3_4_0~357 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=84ba6d281ecf8720d641d291fe97cfcecfddc6e3;p=thirdparty%2Fgnutls.git pkcs11: when importing a public key, import it's data as well (version 2 fix) --- diff --git a/lib/pkcs11.c b/lib/pkcs11.c index 44c1b994c5..21cb584b8b 100644 --- a/lib/pkcs11.c +++ b/lib/pkcs11.c @@ -1459,14 +1459,14 @@ pkcs11_obj_import_pubkey(struct ck_function_list *module, ck_session_handle_t pks, ck_object_handle_t obj, gnutls_pkcs11_obj_t crt, - const gnutls_datum_t * id, - const gnutls_datum_t * label, + gnutls_datum_t *data, + const gnutls_datum_t *id, + const gnutls_datum_t *label, struct ck_token_info *tinfo, struct ck_info *lib_info) { struct ck_attribute a[4]; ck_key_type_t key_type; - gnutls_datum_t data = {NULL,0}; int ret; ck_bool_t tval; @@ -1539,14 +1539,8 @@ pkcs11_obj_import_pubkey(struct ck_function_list *module, } } - 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, + ret = pkcs11_obj_import(CKO_PUBLIC_KEY, crt, data, id, label, tinfo, lib_info); - gnutls_free(data.data); return ret; } @@ -1683,6 +1677,7 @@ pkcs11_import_object(ck_object_handle_t obj, ck_object_class_t class, sinfo->pks, obj, fobj, + &data, &id, &label, tinfo, lib_info);