#ifndef _SOFTKEYSTOREUTIL_H
#define _SOFTKEYSTOREUTIL_H
#ifdef __cplusplus
extern "C" {
#endif
#include <sys/types.h>
#define KEYSTORE_UNINITIALIZED 0
#define KEYSTORE_PRESENT 1
#define KEYSTORE_LOAD 2
#define KEYSTORE_INITIALIZED 3
#define KEYSTORE_UNAVAILABLE 4
typedef enum {
ALL_TOKENOBJS = 0,
PUB_TOKENOBJS = 1,
PRI_TOKENOBJS = 2
} ks_search_type_t;
typedef struct ks_obj_handle {
unsigned char name[256];
boolean_t public;
} ks_obj_handle_t;
typedef struct ks_obj {
ks_obj_handle_t ks_handle;
uint_t obj_version;
uchar_t *buf;
size_t size;
struct ks_obj *next;
} ks_obj_t;
int soft_keystore_readlock(boolean_t set_lock);
int soft_keystore_writelock(boolean_t set_lock);
int soft_keystore_lock_object(ks_obj_handle_t *ks_handle, boolean_t read_lock);
int soft_keystore_unlock_object(int fd);
int soft_keystore_get_version(uint_t *version, boolean_t lock_held);
int soft_keystore_get_object_version(ks_obj_handle_t *ks_handle,
uint_t *version, boolean_t lock_held);
int soft_keystore_getpin(char **hashed_pin, boolean_t lock_held);
int soft_keystore_setpin(uchar_t *oldpin, uchar_t *newpin, boolean_t lock_held);
int soft_keystore_authpin(uchar_t *pin);
CK_RV soft_keystore_get_objs(ks_search_type_t search_type,
ks_obj_t **result_objs, boolean_t lock_held);
CK_RV soft_keystore_get_single_obj(ks_obj_handle_t *ks_handle,
ks_obj_t **result_obj, boolean_t lock_held);
int soft_keystore_put_new_obj(uchar_t *buf, size_t len, boolean_t public,
boolean_t lock_held, ks_obj_handle_t *keyhandle);
int soft_keystore_modify_obj(ks_obj_handle_t *ks_handle, uchar_t *buf,
size_t len, boolean_t lock_held);
int soft_keystore_del_obj(ks_obj_handle_t *ks_handle, boolean_t lock_held);
int soft_keystore_get_pin_salt(char **salt);
CK_RV soft_keystore_pin_initialized(boolean_t *initialized, char **hashed_pin,
boolean_t lock_held);
boolean_t soft_keystore_status(int desired_state);
int soft_keystore_init(int desired_state);
int create_keystore();
#ifdef __cplusplus
}
#endif
#endif