2002-01-16 22:49:03 +00:00
|
|
|
|
/*
|
2002-10-19 14:04:52 +00:00
|
|
|
|
* sc-pkcs11.h: OpenSC project's PKCS#11 implementation header
|
2002-01-16 22:49:03 +00:00
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2002 Timo Ter<EFBFBD>s <timo.teras@iki.fi>
|
|
|
|
|
*
|
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
*/
|
|
|
|
|
|
2002-10-19 14:04:52 +00:00
|
|
|
|
#ifndef __sc_pkcs11_h__
|
|
|
|
|
#define __sc_pkcs11_h__
|
2002-01-16 22:49:03 +00:00
|
|
|
|
|
2002-03-25 12:39:35 +00:00
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
|
#include <config.h>
|
|
|
|
|
#endif
|
2002-06-03 15:28:43 +00:00
|
|
|
|
#ifdef HAVE_MALLOC_H
|
2002-06-03 15:18:47 +00:00
|
|
|
|
#include <malloc.h>
|
|
|
|
|
#endif
|
2002-04-05 13:48:00 +00:00
|
|
|
|
#include <opensc/opensc.h>
|
|
|
|
|
#include <opensc/pkcs15.h>
|
|
|
|
|
#include <opensc/log.h>
|
2002-06-20 13:16:22 +00:00
|
|
|
|
|
|
|
|
|
#ifndef _WIN32
|
|
|
|
|
#include "rsaref/unix.h"
|
|
|
|
|
#include "rsaref/pkcs11.h"
|
|
|
|
|
#else
|
|
|
|
|
#include "rsaref/win32.h"
|
|
|
|
|
#pragma pack(push, cryptoki, 1)
|
2002-01-16 22:49:03 +00:00
|
|
|
|
#include "rsaref/pkcs11.h"
|
2002-06-20 13:16:22 +00:00
|
|
|
|
#pragma pack(pop, cryptoki)
|
|
|
|
|
#endif
|
2002-01-16 22:49:03 +00:00
|
|
|
|
|
2002-08-19 17:13:46 +00:00
|
|
|
|
/* Decide whether to use pkcs11 for initialization support */
|
|
|
|
|
#ifdef HAVE_OPENSSL
|
|
|
|
|
# define USE_PKCS15_INIT
|
|
|
|
|
#endif
|
|
|
|
|
|
2002-04-19 14:23:31 +00:00
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2002-12-21 16:45:37 +00:00
|
|
|
|
#define SC_PKCS11_MAX_VIRTUAL_SLOTS 8
|
2002-12-22 20:50:25 +00:00
|
|
|
|
#define SC_PKCS11_MAX_READERS SC_MAX_READERS
|
2002-01-16 22:49:03 +00:00
|
|
|
|
|
|
|
|
|
struct sc_pkcs11_session;
|
|
|
|
|
struct sc_pkcs11_slot;
|
|
|
|
|
struct sc_pkcs11_card;
|
|
|
|
|
|
|
|
|
|
/* Object Pool */
|
|
|
|
|
struct sc_pkcs11_pool_item {
|
|
|
|
|
int handle;
|
|
|
|
|
void *item;
|
|
|
|
|
struct sc_pkcs11_pool_item *next;
|
|
|
|
|
struct sc_pkcs11_pool_item *prev;
|
|
|
|
|
};
|
|
|
|
|
|
2002-11-22 09:10:10 +00:00
|
|
|
|
enum {
|
|
|
|
|
POOL_TYPE_SESSION,
|
|
|
|
|
POOL_TYPE_OBJECT
|
|
|
|
|
};
|
|
|
|
|
|
2002-01-16 22:49:03 +00:00
|
|
|
|
struct sc_pkcs11_pool {
|
2002-11-22 09:10:10 +00:00
|
|
|
|
int type;
|
2002-01-16 22:49:03 +00:00
|
|
|
|
int next_free_handle;
|
|
|
|
|
int num_items;
|
|
|
|
|
struct sc_pkcs11_pool_item *head;
|
|
|
|
|
struct sc_pkcs11_pool_item *tail;
|
|
|
|
|
};
|
|
|
|
|
|
2002-12-21 16:45:37 +00:00
|
|
|
|
struct sc_pkcs11_config {
|
|
|
|
|
unsigned int num_slots;
|
2002-12-22 11:50:41 +00:00
|
|
|
|
unsigned char hide_empty_slots;
|
2003-01-03 10:49:07 +00:00
|
|
|
|
unsigned char lock_login;
|
2003-01-03 11:09:45 +00:00
|
|
|
|
unsigned char cache_pins;
|
2002-12-21 16:45:37 +00:00
|
|
|
|
};
|
2002-01-16 22:49:03 +00:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* PKCS#11 Object abstraction layer
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
struct sc_pkcs11_object_ops {
|
|
|
|
|
/* Generic operations */
|
|
|
|
|
void (*release)(void *);
|
|
|
|
|
|
|
|
|
|
/* Management methods */
|
|
|
|
|
CK_RV (*set_attribute)(struct sc_pkcs11_session *, void *, CK_ATTRIBUTE_PTR);
|
|
|
|
|
CK_RV (*get_attribute)(struct sc_pkcs11_session *, void *, CK_ATTRIBUTE_PTR);
|
2002-03-18 11:05:21 +00:00
|
|
|
|
int (*cmp_attribute)(struct sc_pkcs11_session *, void *, CK_ATTRIBUTE_PTR);
|
2002-01-16 22:49:03 +00:00
|
|
|
|
|
|
|
|
|
CK_RV (*destroy_object)(struct sc_pkcs11_session *, void *);
|
|
|
|
|
CK_RV (*get_size)(struct sc_pkcs11_session *, void *);
|
|
|
|
|
|
|
|
|
|
/* Cryptographic methods */
|
|
|
|
|
CK_RV (*sign)(struct sc_pkcs11_session *, void *, CK_MECHANISM_PTR pMechanism, CK_BYTE_PTR pData, CK_ULONG ulDataLen, CK_BYTE_PTR pSignature, CK_ULONG_PTR pulDataLen);
|
2002-03-15 15:22:41 +00:00
|
|
|
|
CK_RV (*unwrap_key)(struct sc_pkcs11_session *, void *,
|
|
|
|
|
CK_MECHANISM_PTR,
|
|
|
|
|
CK_BYTE_PTR pData, CK_ULONG ulDataLen,
|
|
|
|
|
CK_ATTRIBUTE_PTR, CK_ULONG,
|
|
|
|
|
void **);
|
2002-01-16 22:49:03 +00:00
|
|
|
|
/* Others to be added when implemented */
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct sc_pkcs11_object {
|
|
|
|
|
struct sc_pkcs11_object_ops *ops;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* PKCS#11 Smartcard Framework abstraction
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
struct sc_pkcs11_framework_ops {
|
|
|
|
|
/* Detect and bind card to framework */
|
|
|
|
|
CK_RV (*bind)(struct sc_pkcs11_card *);
|
|
|
|
|
/* Unbind and release allocated resources */
|
|
|
|
|
CK_RV (*unbind)(struct sc_pkcs11_card *);
|
|
|
|
|
|
|
|
|
|
/* Create tokens to virtual slots and
|
|
|
|
|
* objects in tokens; called after bind */
|
|
|
|
|
CK_RV (*create_tokens)(struct sc_pkcs11_card *);
|
|
|
|
|
CK_RV (*release_token)(struct sc_pkcs11_card *, void *);
|
|
|
|
|
|
|
|
|
|
/* Login and logout */
|
2002-04-08 15:51:19 +00:00
|
|
|
|
CK_RV (*login)(struct sc_pkcs11_card *, void *,
|
|
|
|
|
CK_USER_TYPE, CK_CHAR_PTR, CK_ULONG);
|
2002-01-16 22:49:03 +00:00
|
|
|
|
CK_RV (*logout)(struct sc_pkcs11_card *, void *);
|
2002-03-20 15:04:14 +00:00
|
|
|
|
CK_RV (*change_pin)(struct sc_pkcs11_card *, void *,
|
|
|
|
|
CK_CHAR_PTR, CK_ULONG,
|
|
|
|
|
CK_CHAR_PTR, CK_ULONG);
|
2002-01-16 22:49:03 +00:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* In future: functions to create new objects
|
|
|
|
|
* (ie. certificates, private keys)
|
|
|
|
|
*/
|
2002-04-08 15:51:19 +00:00
|
|
|
|
CK_RV (*init_token)(struct sc_pkcs11_card *, void *,
|
2002-04-05 15:02:41 +00:00
|
|
|
|
CK_UTF8CHAR_PTR, CK_ULONG,
|
|
|
|
|
CK_UTF8CHAR_PTR);
|
2002-04-08 15:51:19 +00:00
|
|
|
|
CK_RV (*init_pin)(struct sc_pkcs11_card *,
|
|
|
|
|
struct sc_pkcs11_slot *,
|
|
|
|
|
CK_UTF8CHAR_PTR, CK_ULONG);
|
2002-04-11 15:17:33 +00:00
|
|
|
|
CK_RV (*create_object)(struct sc_pkcs11_card *,
|
|
|
|
|
struct sc_pkcs11_slot *,
|
|
|
|
|
CK_ATTRIBUTE_PTR, CK_ULONG,
|
|
|
|
|
CK_OBJECT_HANDLE_PTR);
|
2002-01-16 22:49:03 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* PKCS#11 Slot (used to access card with specific framework data)
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
struct sc_pkcs11_card {
|
|
|
|
|
int reader;
|
|
|
|
|
struct sc_card *card;
|
|
|
|
|
struct sc_pkcs11_framework_ops *framework;
|
|
|
|
|
void *fw_data;
|
2002-12-17 11:49:12 +00:00
|
|
|
|
|
2002-12-21 16:45:37 +00:00
|
|
|
|
/* Number of slots owned by this card object */
|
|
|
|
|
unsigned int num_slots;
|
|
|
|
|
unsigned int max_slots;
|
|
|
|
|
|
2002-12-17 11:49:12 +00:00
|
|
|
|
/* List of supported mechanisms */
|
|
|
|
|
struct sc_pkcs11_mechanism_type **mechanisms;
|
|
|
|
|
unsigned int nmechanisms;
|
2002-01-16 22:49:03 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct sc_pkcs11_slot {
|
|
|
|
|
int id;
|
|
|
|
|
int login_user;
|
|
|
|
|
/* Slot specific information (information about reader) */
|
|
|
|
|
CK_SLOT_INFO slot_info;
|
|
|
|
|
/* Token specific information (information about card) */
|
|
|
|
|
CK_TOKEN_INFO token_info;
|
|
|
|
|
/* The card associated with this slot */
|
|
|
|
|
struct sc_pkcs11_card *card;
|
|
|
|
|
/* Framework specific data */
|
|
|
|
|
void *fw_data;
|
|
|
|
|
/* Object pools */
|
|
|
|
|
struct sc_pkcs11_pool object_pool;
|
2002-03-12 14:36:07 +00:00
|
|
|
|
/* Number of sessions using this slot */
|
|
|
|
|
unsigned int nsessions;
|
2002-01-16 22:49:03 +00:00
|
|
|
|
};
|
2003-01-03 11:39:59 +00:00
|
|
|
|
typedef struct sc_pkcs11_slot sc_pkcs11_slot_t;
|
2002-01-16 22:49:03 +00:00
|
|
|
|
|
|
|
|
|
|
2002-12-17 11:49:12 +00:00
|
|
|
|
/* Forward decl */
|
|
|
|
|
typedef struct sc_pkcs11_operation sc_pkcs11_operation_t;
|
|
|
|
|
|
|
|
|
|
enum {
|
|
|
|
|
SC_PKCS11_OPERATION_FIND = 0,
|
|
|
|
|
SC_PKCS11_OPERATION_SIGN,
|
|
|
|
|
SC_PKCS11_OPERATION_DIGEST,
|
|
|
|
|
SC_PKCS11_OPERATION_MAX
|
2002-01-16 22:49:03 +00:00
|
|
|
|
};
|
|
|
|
|
|
2002-12-17 11:49:12 +00:00
|
|
|
|
/* This describes a PKCS11 mechanism */
|
|
|
|
|
struct sc_pkcs11_mechanism_type {
|
|
|
|
|
CK_MECHANISM_TYPE mech; /* algorithm: md5, sha1, ... */
|
|
|
|
|
CK_MECHANISM_INFO mech_info; /* mechanism info */
|
|
|
|
|
CK_MECHANISM_TYPE key_type; /* for sign/decipher ops */
|
|
|
|
|
unsigned int obj_size;
|
|
|
|
|
|
|
|
|
|
/* General management */
|
|
|
|
|
void (*release)(sc_pkcs11_operation_t *);
|
|
|
|
|
|
|
|
|
|
/* Digest/sign Operations */
|
|
|
|
|
CK_RV (*md_init)(sc_pkcs11_operation_t *);
|
|
|
|
|
CK_RV (*md_update)(sc_pkcs11_operation_t *,
|
|
|
|
|
CK_BYTE_PTR, CK_ULONG);
|
|
|
|
|
CK_RV (*md_final)(sc_pkcs11_operation_t *,
|
|
|
|
|
CK_BYTE_PTR, CK_ULONG_PTR);
|
|
|
|
|
|
|
|
|
|
CK_RV (*sign_init)(sc_pkcs11_operation_t *,
|
|
|
|
|
struct sc_pkcs11_object *);
|
|
|
|
|
CK_RV (*sign_update)(sc_pkcs11_operation_t *,
|
|
|
|
|
CK_BYTE_PTR, CK_ULONG);
|
|
|
|
|
CK_RV (*sign_final)(sc_pkcs11_operation_t *,
|
|
|
|
|
CK_BYTE_PTR, CK_ULONG_PTR);
|
|
|
|
|
|
|
|
|
|
/* mechanism specific data */
|
|
|
|
|
void * mech_data;
|
|
|
|
|
};
|
|
|
|
|
typedef struct sc_pkcs11_mechanism_type sc_pkcs11_mechanism_type_t;
|
2002-01-16 22:49:03 +00:00
|
|
|
|
|
2002-12-17 11:49:12 +00:00
|
|
|
|
/*
|
|
|
|
|
* Generic operation
|
|
|
|
|
*/
|
|
|
|
|
struct sc_pkcs11_operation {
|
|
|
|
|
sc_pkcs11_mechanism_type_t *type;
|
|
|
|
|
CK_MECHANISM mechanism;
|
|
|
|
|
struct sc_pkcs11_session *session;
|
|
|
|
|
void * priv_data;
|
2002-01-16 22:49:03 +00:00
|
|
|
|
};
|
|
|
|
|
|
2002-12-17 11:49:12 +00:00
|
|
|
|
/* Find Operation */
|
2002-03-04 06:58:12 +00:00
|
|
|
|
#define SC_PKCS11_FIND_MAX_HANDLES 32
|
2002-01-16 22:49:03 +00:00
|
|
|
|
struct sc_pkcs11_find_operation {
|
|
|
|
|
struct sc_pkcs11_operation operation;
|
|
|
|
|
int num_handles, current_handle;
|
2002-03-04 06:58:12 +00:00
|
|
|
|
CK_OBJECT_HANDLE handles[SC_PKCS11_FIND_MAX_HANDLES];
|
2002-01-16 22:49:03 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* PKCS#11 Session
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
struct sc_pkcs11_session {
|
|
|
|
|
/* Session to this slot */
|
|
|
|
|
struct sc_pkcs11_slot *slot;
|
|
|
|
|
CK_FLAGS flags;
|
|
|
|
|
/* Notifications */
|
|
|
|
|
CK_NOTIFY notify_callback;
|
|
|
|
|
CK_VOID_PTR notify_data;
|
2002-12-17 11:49:12 +00:00
|
|
|
|
/* Active operations - one per type */
|
|
|
|
|
struct sc_pkcs11_operation *operation[SC_PKCS11_OPERATION_MAX];
|
2002-01-16 22:49:03 +00:00
|
|
|
|
};
|
2002-12-17 11:49:12 +00:00
|
|
|
|
typedef struct sc_pkcs11_session sc_pkcs11_session_t;
|
2002-01-16 22:49:03 +00:00
|
|
|
|
|
|
|
|
|
/* Module variables */
|
|
|
|
|
extern struct sc_context *context;
|
|
|
|
|
extern struct sc_pkcs11_pool session_pool;
|
|
|
|
|
extern struct sc_pkcs11_slot virtual_slots[SC_PKCS11_MAX_VIRTUAL_SLOTS];
|
|
|
|
|
extern struct sc_pkcs11_card card_table[SC_PKCS11_MAX_READERS];
|
2002-12-21 16:45:37 +00:00
|
|
|
|
extern struct sc_pkcs11_config sc_pkcs11_conf;
|
2002-01-16 22:49:03 +00:00
|
|
|
|
|
|
|
|
|
/* Framework definitions */
|
|
|
|
|
extern struct sc_pkcs11_framework_ops framework_pkcs15;
|
2002-04-05 15:02:41 +00:00
|
|
|
|
extern struct sc_pkcs11_framework_ops framework_pkcs15init;
|
2002-01-16 22:49:03 +00:00
|
|
|
|
|
2002-01-17 12:05:44 +00:00
|
|
|
|
void strcpy_bp(u8 *dst, const char *src, int dstsize);
|
2002-01-16 22:49:03 +00:00
|
|
|
|
CK_RV sc_to_cryptoki_error(int rc, int reader);
|
|
|
|
|
void dump_template(const char *info, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount);
|
|
|
|
|
|
|
|
|
|
/* Slot and card handling functions */
|
|
|
|
|
CK_RV card_initialize(int reader);
|
|
|
|
|
CK_RV card_detect(int reader);
|
|
|
|
|
CK_RV card_removed(int reader);
|
|
|
|
|
CK_RV slot_initialize(int id, struct sc_pkcs11_slot *);
|
|
|
|
|
CK_RV slot_get_slot(int id, struct sc_pkcs11_slot **);
|
|
|
|
|
CK_RV slot_get_token(int id, struct sc_pkcs11_slot **);
|
|
|
|
|
CK_RV slot_token_removed(int id);
|
|
|
|
|
CK_RV slot_allocate(struct sc_pkcs11_slot **, struct sc_pkcs11_card *);
|
|
|
|
|
|
|
|
|
|
/* Pool */
|
2002-11-22 09:10:10 +00:00
|
|
|
|
CK_RV pool_initialize(struct sc_pkcs11_pool *, int);
|
2002-01-16 22:49:03 +00:00
|
|
|
|
CK_RV pool_insert(struct sc_pkcs11_pool *, void *, CK_ULONG_PTR);
|
|
|
|
|
CK_RV pool_find(struct sc_pkcs11_pool *, CK_ULONG, void **);
|
|
|
|
|
CK_RV pool_find_and_delete(struct sc_pkcs11_pool *, CK_ULONG, void **);
|
|
|
|
|
|
|
|
|
|
/* Session manipulation */
|
2002-12-17 11:49:12 +00:00
|
|
|
|
CK_RV session_start_operation(struct sc_pkcs11_session *,
|
|
|
|
|
int, sc_pkcs11_mechanism_type_t *,
|
|
|
|
|
struct sc_pkcs11_operation **);
|
|
|
|
|
CK_RV session_get_operation(struct sc_pkcs11_session *, int,
|
|
|
|
|
struct sc_pkcs11_operation **);
|
|
|
|
|
CK_RV session_stop_operation(struct sc_pkcs11_session *, int);
|
2002-01-16 22:49:03 +00:00
|
|
|
|
|
2002-03-15 15:22:41 +00:00
|
|
|
|
/* Generic secret key stuff */
|
|
|
|
|
CK_RV sc_pkcs11_create_secret_key(struct sc_pkcs11_session *,
|
|
|
|
|
const u8 *, size_t,
|
|
|
|
|
CK_ATTRIBUTE_PTR, CK_ULONG,
|
|
|
|
|
struct sc_pkcs11_object **);
|
2002-03-18 11:05:21 +00:00
|
|
|
|
/* Generic object handling */
|
|
|
|
|
int sc_pkcs11_any_cmp_attribute(struct sc_pkcs11_session *,
|
|
|
|
|
void *, CK_ATTRIBUTE_PTR);
|
2002-03-15 15:22:41 +00:00
|
|
|
|
|
2002-04-11 15:17:33 +00:00
|
|
|
|
/* Get attributes from template (misc.c) */
|
|
|
|
|
CK_RV attr_find(CK_ATTRIBUTE_PTR, CK_ULONG, CK_ULONG, void *, size_t *);
|
|
|
|
|
CK_RV attr_find_ptr(CK_ATTRIBUTE_PTR, CK_ULONG, CK_ULONG, void **, size_t *);
|
|
|
|
|
CK_RV attr_find_var(CK_ATTRIBUTE_PTR, CK_ULONG, CK_ULONG, void *, size_t *);
|
|
|
|
|
CK_RV attr_extract(CK_ATTRIBUTE_PTR, void *, size_t *);
|
|
|
|
|
|
2002-12-17 11:49:12 +00:00
|
|
|
|
/* Generic Mechanism functions */
|
|
|
|
|
CK_RV sc_pkcs11_register_mechanism(struct sc_pkcs11_card *,
|
|
|
|
|
sc_pkcs11_mechanism_type_t *);
|
|
|
|
|
CK_RV sc_pkcs11_get_mechanism_list(struct sc_pkcs11_card *,
|
|
|
|
|
CK_MECHANISM_TYPE_PTR, CK_ULONG_PTR);
|
|
|
|
|
CK_RV sc_pkcs11_get_mechanism_info(struct sc_pkcs11_card *, CK_MECHANISM_TYPE,
|
|
|
|
|
CK_MECHANISM_INFO_PTR);
|
|
|
|
|
CK_RV sc_pkcs11_md_init(struct sc_pkcs11_session *, CK_MECHANISM_PTR);
|
|
|
|
|
CK_RV sc_pkcs11_md_update(struct sc_pkcs11_session *, CK_BYTE_PTR, CK_ULONG);
|
|
|
|
|
CK_RV sc_pkcs11_md_final(struct sc_pkcs11_session *, CK_BYTE_PTR, CK_ULONG_PTR);
|
|
|
|
|
CK_RV sc_pkcs11_sign_init(struct sc_pkcs11_session *, CK_MECHANISM_PTR,
|
|
|
|
|
struct sc_pkcs11_object *, CK_MECHANISM_TYPE);
|
|
|
|
|
CK_RV sc_pkcs11_sign_update(struct sc_pkcs11_session *, CK_BYTE_PTR, CK_ULONG);
|
|
|
|
|
CK_RV sc_pkcs11_sign_final(struct sc_pkcs11_session *, CK_BYTE_PTR, CK_ULONG_PTR);
|
|
|
|
|
CK_RV sc_pkcs11_sign_hash(struct sc_pkcs11_session *, CK_BYTE_PTR, CK_ULONG,
|
|
|
|
|
CK_BYTE_PTR, CK_ULONG_PTR);
|
|
|
|
|
sc_pkcs11_mechanism_type_t *sc_pkcs11_find_mechanism(struct sc_pkcs11_card *,
|
|
|
|
|
CK_MECHANISM_TYPE, int);
|
|
|
|
|
sc_pkcs11_mechanism_type_t *sc_pkcs11_new_fw_mechanism(CK_MECHANISM_TYPE,
|
|
|
|
|
CK_MECHANISM_INFO_PTR, CK_KEY_TYPE,
|
|
|
|
|
void *);
|
|
|
|
|
sc_pkcs11_operation_t *sc_pkcs11_new_operation(sc_pkcs11_session_t *,
|
|
|
|
|
sc_pkcs11_mechanism_type_t *);
|
|
|
|
|
void sc_pkcs11_release_operation(sc_pkcs11_operation_t **);
|
|
|
|
|
CK_RV sc_pkcs11_register_generic_mechanisms(struct sc_pkcs11_card *);
|
|
|
|
|
#ifdef HAVE_OPENSSL
|
|
|
|
|
void sc_pkcs11_register_openssl_mechanisms(struct sc_pkcs11_card *);
|
|
|
|
|
#endif
|
2002-12-17 20:16:31 +00:00
|
|
|
|
CK_RV sc_pkcs11_register_sign_and_hash_mechanism(struct sc_pkcs11_card *,
|
|
|
|
|
CK_MECHANISM_TYPE, CK_MECHANISM_TYPE,
|
|
|
|
|
sc_pkcs11_mechanism_type_t *);
|
2002-12-17 11:49:12 +00:00
|
|
|
|
|
2002-12-21 16:45:37 +00:00
|
|
|
|
/* Load configuration defaults */
|
|
|
|
|
void load_pkcs11_parameters(struct sc_pkcs11_config *, struct sc_context *);
|
|
|
|
|
|
2002-04-19 14:23:31 +00:00
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2002-01-16 22:49:03 +00:00
|
|
|
|
#endif
|