** libgnutls: gnutls_pkcs11_reinit() will reinitialize all PKCS #11
modules, and not only the ones loaded via p11-kit.
+** libgnutls: Added function to check whether the private key is
+still available (inserted).
+
** API and ABI modifications:
gnutls_handshake_set_random: Added
gnutls_transport_set_int2: Added
gnutls_transport_get_int: Added
gnutls_record_cork: Exported
gnutls_record_uncork: Exported
+gnutls_pkcs11_privkey_status: Added
* Version 3.1.8 (released 2013-02-10)
int gnutls_pkcs11_privkey_export_url (gnutls_pkcs11_privkey_t key,
gnutls_pkcs11_url_type_t detailed,
char **url);
+int gnutls_pkcs11_privkey_status (gnutls_pkcs11_privkey_t key);
int gnutls_pkcs11_privkey_generate (const char* url,
gnutls_pk_algorithm_t pk,
return ret;
}
+/**
+ * gnutls_pkcs11_privkey_status:
+ * @key: Holds the key
+ *
+ * Checks the status of the private key token.
+ *
+ * Returns: this function will return non-zero if the token
+ * holding the private key is still available (inserted), and zero otherwise.
+ *
+ * Since: 3.1.9
+ *
+ **/
+int
+gnutls_pkcs11_privkey_status (gnutls_pkcs11_privkey_t key)
+{
+ ck_rv_t rv;
+ int ret;
+ struct pkcs11_session_info _sinfo;
+ struct pkcs11_session_info *sinfo;
+ ck_object_handle_t obj;
+ struct ck_session_info session_info;
+
+ if (key->sinfo.init != 0)
+ {
+ sinfo = &key->sinfo;
+ obj = key->obj;
+ }
+ else
+ {
+ sinfo = &_sinfo;
+ memset(sinfo, 0, sizeof(*sinfo));
+ FIND_OBJECT (sinfo, &key->pin, obj, key);
+ }
+
+ rv = (sinfo->module)->C_GetSessionInfo (sinfo->pks, &session_info);
+ if (rv != CKR_OK)
+ {
+ ret = 0;
+ goto cleanup;
+ }
+ ret = 1;
+
+cleanup:
+ if (sinfo != &key->sinfo)
+ pkcs11_close_session (sinfo);
+
+ return ret;
+}
+
/**
* gnutls_pkcs11_privkey_import_url:
* @pkey: The structure to store the parsed key