34#include <openssl/rsa.h>
41#define YUBIHSM_PKCS11_MANUFACTURER "Yubico (www.yubico.com)"
42#define YUBIHSM_PKCS11_LIBDESC "YubiHSM PKCS#11 Library"
43#define YUBIHSM_PKCS11_MIN_PIN_LEN 12
44#define YUBIHSM_PKCS11_MAX_PIN_LEN 68
46#define UNUSED(x) (void) (x)
48#define GLOBAL_LOCK_OR_RETURN \
50 if (g_ctx.mutex != NULL) { \
51 CK_RV lock_rv = g_ctx.lock_mutex(g_ctx.mutex); \
52 if (lock_rv != CKR_OK) { \
53 DBG_ERR("Unable to acquire global lock"); \
59#define GLOBAL_UNLOCK_OR_RETURN \
61 if (g_ctx.mutex != NULL) { \
62 CK_RV lock_rv = g_ctx.unlock_mutex(g_ctx.mutex); \
63 if (lock_rv != CKR_OK) { \
64 DBG_ERR("Unable to release global lock"); \
72static bool g_yh_initialized =
false;
76static void destroy_slot_mutex(
void *data) {
85static bool compare_ecdh_keys(
void *data,
void *item) {
86 if (data == NULL || item == NULL) {
90 CK_OBJECT_HANDLE *
a = data;
94 CK_OBJECT_HANDLE b = key->id;
105 if (g_yh_initialized ==
true) {
113 if (pInitArgs != NULL) {
115 init_args->CreateMutex == NULL && init_args->DestroyMutex == NULL &&
116 init_args->LockMutex == NULL && init_args->UnlockMutex == NULL) {
124 init_args->CreateMutex == NULL &&
125 init_args->DestroyMutex == NULL &&
126 init_args->LockMutex == NULL && init_args->UnlockMutex == NULL) {
130 init_args->CreateMutex != NULL &&
131 init_args->DestroyMutex != NULL &&
132 init_args->LockMutex != NULL && init_args->UnlockMutex != NULL) {
139 init_args->CreateMutex != NULL &&
140 init_args->DestroyMutex != NULL &&
141 init_args->LockMutex != NULL && init_args->UnlockMutex != NULL) {
154 DBG_ERR(
"Unable to create global mutex");
161 struct cmdline_parser_params
params;
163 struct gengetopt_args_info args_info;
165 cmdline_parser_params_init(&
params);
168 params.check_required = 1;
172 if (cmdline_parser(0, &tmp, &args_info) != 0) {
173 DBG_ERR(
"Unable to initialize ggo structure");
181 char *args_parsed = NULL;
185 if (init_args != NULL && init_args->pReserved != NULL) {
186 args = strdup(init_args->pReserved);
188 DBG_ERR(
"Failed copying reserved string");
195 while ((part = strtok_r(str,
" \r\n\t", &save))) {
198 if (args_parsed == NULL) {
199 new_ptr = calloc(strlen(part) + 4,
sizeof(
char));
201 new_ptr = realloc(args_parsed, strlen(args_parsed) + strlen(part) + 4);
204 args_parsed = new_ptr;
205 sprintf(args_parsed + strlen(args_parsed),
"--%s ", part);
207 DBG_ERR(
"Failed allocating memory for args");
212 DBG_INFO(
"Now parsing supplied init args as '%s'", args_parsed);
214 if (cmdline_parser_string_ext(args_parsed, &args_info,
215 "yubihsm_pkcs11 module", &
params) != 0) {
216 DBG_ERR(
"Parsing of the reserved init args '%s' failed", args);
227 char *config_file = args_info.config_file_arg;
229 if (stat(config_file, &sb) == -1) {
230 config_file = getenv(
"YUBIHSM_PKCS11_CONF");
235 if (config_file != NULL &&
236 cmdline_parser_config_file(config_file, &args_info, &
params) != 0) {
237 DBG_ERR(
"Unable to parse configuration file");
241 yh_dbg_init(args_info.debug_flag, args_info.dinout_flag,
242 args_info.libdebug_flag, args_info.debug_file_arg);
246 if (args_info.connector_given == 0) {
247 DBG_ERR(
"No connector defined");
252 DBG_ERR(
"Unable to initialize libyubihsm");
256 DBG_INFO(
"Found %u configured connector(s)", args_info.connector_given);
258 connector_list = calloc(args_info.connector_given,
sizeof(
yh_connector *));
259 if (connector_list == NULL) {
260 DBG_ERR(
"Failed allocating memory");
263 size_t n_connectors = 0;
264 for (
unsigned int i = 0; i < args_info.connector_given; i++) {
267 DBG_ERR(
"Failed to init connector");
270 if (args_info.cacert_given) {
273 DBG_ERR(
"Failed to set HTTPS CA option");
277 if (args_info.proxy_given) {
280 DBG_ERR(
"Failed to set proxy server option");
286 DBG_ERR(
"Failed to connect '%s'", args_info.connector_arg[i]);
293 if (
add_connectors(&g_ctx, args_info.connector_given, args_info.connector_arg,
294 connector_list) ==
false) {
295 DBG_ERR(
"Failed building connectors list");
299 cmdline_parser_free(&args_info);
300 free(connector_list);
302 DBG_INFO(
"Found %zu usable connector(s)", n_connectors);
304 g_yh_initialized =
true;
317 if (connector_list) {
318 for (
unsigned int i = 0; i < args_info.connector_given; i++) {
323 cmdline_parser_free(&args_info);
324 free(connector_list);
326 if (g_ctx.
mutex != NULL) {
339 DBG_ERR(
"Finalized called with pReserved != NULL");
343 if (g_yh_initialized ==
false) {
344 DBG_ERR(
"libyubihsm is not initialized or already finalized");
351 if (g_ctx.
mutex != NULL) {
356 g_yh_initialized =
false;
375 if (g_yh_initialized ==
false) {
376 DBG_ERR(
"libyubihsm is not initialized or already finalized");
383 CK_VERSION ver = {VERSION_MAJOR, (VERSION_MINOR * 10) + VERSION_PATCH};
410 DBG_ERR(
"GetFunctionList called with ppFunctionList = NULL");
427 if (g_yh_initialized ==
false) {
428 DBG_ERR(
"libyubihsm is not initialized or already finalized");
433 DBG_ERR(
"pulCount argument bad");
508 if (g_yh_initialized ==
false) {
509 DBG_ERR(
"libyubihsm is not initialized or already finalized");
527 s =
"YubiHSM Connector ";
571 if (g_yh_initialized ==
false) {
572 DBG_ERR(
"libyubihsm is not initialized or already finalized");
614 &
serial, NULL, NULL, NULL, NULL);
616 DBG_ERR(
"Unable to get device version and serial number: %s",
628 l = sprintf((
char *)
pInfo->serialNumber,
"%08u",
serial);
693 if (g_yh_initialized ==
false) {
694 DBG_ERR(
"libyubihsm is not initialized or already finalized");
699 DBG_ERR(
"Wrong/missing parameter");
711 DBG_ERR(
"Mechanism buffer too small");
714 DBG_ERR(
"Failed getting device info");
736 if (g_yh_initialized ==
false) {
737 DBG_ERR(
"libyubihsm is not initialized or already finalized");
742 DBG_ERR(
"Wrong/missing parameter");
753 DBG_ERR(
"Invalid mechanism %lu", type);
819 if (g_yh_initialized ==
false) {
820 DBG_ERR(
"libyubihsm is not initialized or already finalized");
825 DBG_ERR(
"Wrong/Missing parameter");
831 DBG_ERR(
"Open session called without CKF_SERIAL_SESSION set");
872 if (g_yh_initialized ==
false) {
873 DBG_ERR(
"libyubihsm is not initialized or already finalized");
884 DBG_ERR(
"Failed closing device session, continuing");
888 DBG_ERR(
"Failed destroying session");
898 DBG_ERR(
"Trying to close invalid session");
906 DBG_ERR(
"Trying to close invalid session");
922 if (g_yh_initialized ==
false) {
923 DBG_ERR(
"libyubihsm is not initialized or already finalized");
937 DBG_ERR(
"Failed closing device session, continuing");
941 DBG_ERR(
"Failed destroying device session");
962 if (g_yh_initialized ==
false) {
963 DBG_ERR(
"libyubihsm is not initialized or already finalized");
968 DBG_ERR(
"Wrong/Missing parameter");
975 DBG_ERR(
"Session handle invalid");
1049static void login_sessions(
void *data) {
1064static void logout_sessions(
void *data) {
1087 if (g_yh_initialized ==
false) {
1088 DBG_ERR(
"libyubihsm is not initialized or already finalized");
1093 DBG_ERR(
"Inalid user type, only regular user allowed");
1099 DBG_ERR(
"Wrong PIN length, must be [%d, %d] got %lu",
1108 "PIN contains invalid characters, first four digits must be [0-9A-Fa-f]");
1166 if (g_yh_initialized ==
false) {
1167 DBG_ERR(
"libyubihsm is not initialized or already finalized");
1179 DBG_ERR(
"Failed closing session");
1185 DBG_ERR(
"Failed destroying session");
1211 if (g_yh_initialized ==
false) {
1212 DBG_ERR(
"libyubihsm is not initialized or already finalized");
1217 DBG_ERR(
"Called with invalid parameters: pTemplate=%p ulCount=%lu "
1231 DBG_ERR(
"A different operation is already active");
1240 class.set =
key_type.set =
id.set =
false;
1248 if (
class.set ==
false) {
1268 if (
id.set ==
false) {
1299 if (
class.set ==
false) {
1313 DBG_ERR(
"Failed setting exportable-under-wrap capability");
1353 template.algorithm,
template.obj.rsa.p,
1355 DBG_ERR(
"Failed writing RSA key to device");
1388 DBG_ERR(
"Failed writing EC key to device");
1430 template.algorithm,
template.obj.buf,
1432 DBG_ERR(
"Failed writing HMAC key to device");
1446 DBG_INFO(
"parsed WRAP key, objlen: %d",
template.objlen);
1490 DBG_ERR(
"Failed writing WRAP key to device");
1510 if (
template.obj.buf == NULL) {
1512 template.objlen =
pTemplate[i].ulValueLen;
1513 DBG_INFO(
"Object will be stored with length %d",
template.objlen);
1515 DBG_ERR(
"Object buffer already set");
1523 DBG_ERR(
"Certificate type invalid");
1535 DBG_ERR(
"Failed writing Opaque object to device");
1547 DBG_ERR(
"Failed executing get object info after creating");
1551 *
phObject =
object.sequence << 24 |
object.
type << 16 |
object.id;
1588 if (g_yh_initialized ==
false) {
1589 DBG_ERR(
"libyubihsm is not initialized or already finalized");
1601 DBG_ERR(
"Other operation in progress");
1619 DBG_INFO(
"Trying to delete public key, returning success with noop");
1626 if (
object == NULL) {
1634 DBG_ERR(
"Failed deleting object");
1659 if (g_yh_initialized ==
false) {
1660 DBG_ERR(
"libyubihsm is not initialized or already finalized");
1692 if (
object == NULL) {
1695 *
pulSize =
object->object.len;
1713 if (g_yh_initialized ==
false) {
1714 DBG_ERR(
"libyubihsm is not initialized or already finalized");
1734 bool object_found =
false;
1738 object_found =
true;
1739 DBG_INFO(
"Object is an ECDH key available only in the current session. "
1747 if ((
rv ==
CKR_OK) && !object_found) {
1748 DBG_ERR(
"Unable to retrieve session ECDH key with ID: %08lx",
hObject);
1760 if (
object == NULL) {
1761 DBG_ERR(
"Unable to retrieve object");
1790 if (g_yh_initialized ==
false) {
1791 DBG_ERR(
"libyubihsm is not initialized or already finalized");
1796 DBG_ERR(
"Called with invalid parameters: pTemplate=%p ulCount=%lu",
1810 DBG_INFO(
"Refusing to change attributes of an ECDH session key");
1818 if (
object == NULL) {
1819 DBG_ERR(
"Unable to retrieve object");
1830 DBG_INFO(
"Refusing to change id of object (old:%x, new:%x",
1841 DBG_INFO(
"Refusing to change label of object");
1848 DBG_INFO(
"Refusing to change attribute %lx of object",
1862static bool should_include_sessionkeys(
bool is_secret_key,
bool extractable_set,
1863 bool is_extractable,
int object_id) {
1864 if (object_id != 0) {
1868 if (!is_secret_key) {
1885 if (g_yh_initialized ==
false) {
1886 DBG_ERR(
"libyubihsm is not initialized or already finalized");
1891 DBG_ERR(
"Asking for specific objects but no template given");
1941 DBG_ERR(
"Failed to parse ID from template");
1952 DBG_INFO(
"Filtering for certificate");
1975 DBG_INFO(
"Asking for unknown class %x, returning empty set",
1984 DBG_ERR(
"Label value too long, found %lu, maximum is %d",
len,
1990 label = calloc(
len + 1,
sizeof(
char));
1991 if (
label == NULL) {
1992 DBG_ERR(
"Unable to allocate label memory");
2004 "sign-pkcs,sign-pss,sign-ecdsa,sign-hmac", &
capabilities);
2085 DBG_INFO(
"Got type %x, ignoring it for results",
2091 DBG_INFO(
"Got type %x, returning empty set",
2110 DBG_ERR(
"Failed to get object list");
2115 for (
uint16_t i = 0; i < tmp_n_objects; i++) {
2131 DBG_ERR(
"Failed to get object list");
2151 item = item->
next) {
2154 if (
label == NULL || strcmp(
label, key->label) == 0) {
2157 memset(&desc, 0,
sizeof(desc));
2158 desc.
id = key->id & 0xffff;
2159 desc.
len = key->len;
2161 memcpy(desc.
label, key->label, strlen(key->label) + 1);
2184 if (
label != NULL) {
2202 if (g_yh_initialized ==
false) {
2203 DBG_ERR(
"libyubihsm is not initialized or already finalized");
2241 id =
object->sequence << 24;
2242 id |=
object->type << 16;
2261 object->type |= 0x80;
2266 DBG_INFO(
"Returning object %d as %08x",
2287 if (g_yh_initialized ==
false) {
2288 DBG_ERR(
"libyubihsm is not initialized or already finalized");
2326 if (g_yh_initialized ==
false) {
2327 DBG_ERR(
"libyubihsm is not initialized or already finalized");
2344 DBG_ERR(
"Other operation in progress");
2349 DBG_INFO(
"Trying to encrypt data with mechanism 0x%04lx and key %08lx",
2352 int type =
hKey >> 16;
2363 if (
object == NULL) {
2364 DBG_ERR(
"Unable to retrieve object");
2377 DBG_ERR(
"Wrong key type or algorithm");
2404 if (g_yh_initialized ==
false) {
2405 DBG_ERR(
"libyubihsm is not initialized or already finalized");
2417 DBG_ERR(
"Encryption operation not initialized");
2442 DBG_ERR(
"pulEncryptedDataLen too small, expected = %lu, got %lu)",
datalen,
2454 DBG_ERR(
"Unable to perform encrypt operation step");
2461 DBG_ERR(
"Unable to encrypt data");
2490 if (g_yh_initialized ==
false) {
2491 DBG_ERR(
"libyubihsm is not initialized or already finalized");
2503 DBG_ERR(
"Decrypt operation not initialized");
2518 DBG_ERR(
"Unable to perform encryption operation step");
2549 if (g_yh_initialized ==
false) {
2550 DBG_ERR(
"libyubihsm is not initialized or already finalized");
2562 DBG_ERR(
"Encrypt operation not initialized");
2571 DBG_ERR(
"Mechanism %lu not supported",
2578 DBG_ERR(
"pulLastEncryptedPartLen too small, data will not fit, expected = "
2591 DBG_ERR(
"No buffer provided");
2601 DBG_ERR(
"Unable to encrypt data");
2623 CK_OBJECT_HANDLE
hKey) {
2630 if (g_yh_initialized ==
false) {
2631 DBG_ERR(
"libyubihsm is not initialized or already finalized");
2648 DBG_ERR(
"Other operation in progress");
2653 DBG_INFO(
"Trying to decrypt data with mechanism 0x%04lx and key %08lx",
2656 int type =
hKey >> 16;
2667 if (
object == NULL) {
2668 DBG_ERR(
"Unable to retrieve object");
2682 DBG_INFO(
"RSA decryption requested");
2696 DBG_ERR(
"Length of mechanism parameters does not match expected value: "
2697 "found %lu, expected %zu",
2705 if (
params->source == 0 &&
params->ulSourceDataLen != 0) {
2706 DBG_ERR(
"Source parameter empty but sourceDataLen != 0");
2710 DBG_ERR(
"Unknown value in parameter source");
2733 const EVP_MD *md = NULL;
2735 switch (
params->hashAlg) {
2752 mdctx = EVP_MD_CTX_create();
2754 if (EVP_DigestInit_ex(
mdctx, md, NULL) == 0) {
2760 params->ulSourceDataLen) != 1) {
2791 DBG_ERR(
"Unable to initialize decryption operation");
2801 if (
mdctx != NULL) {
2802 EVP_MD_CTX_destroy(
mdctx);
2821 if (g_yh_initialized ==
false) {
2822 DBG_ERR(
"libyubihsm is not initialized or already finalized");
2834 DBG_ERR(
"Decryption operation not initialized");
2849 DBG_ERR(
"Encrypted data is to short to possibly come from aes-ccm-wrap");
2855 DBG_ERR(
"Mechanism %lu not supported",
2884 DBG_ERR(
"Unable to perform decrypt operation step");
2890 DBG_ERR(
"Unable to finalize decrypt operation");
2900 DBG_ERR(
"Unable to decrypt data");
2938 if (g_yh_initialized ==
false) {
2939 DBG_ERR(
"libyubihsm is not initialized or already finalized");
2951 DBG_ERR(
"Decrypt operation not initialized");
2967 DBG_ERR(
"Unable to perform decryption operation step");
3001 if (g_yh_initialized ==
false) {
3002 DBG_ERR(
"libyubihsm is not initialized or already finalized");
3014 DBG_ERR(
"Decrypt operation not initialized");
3028 DBG_ERR(
"Encrypted data is to short to possibly come from aes-ccm-wrap");
3034 DBG_ERR(
"Mechanism %lu not supported",
3041 DBG_ERR(
"No buffer provided, length check only");
3052 DBG_ERR(
"Unable to finalize decryption operation");
3060 DBG_ERR(
"Unable to decrypt data");
3090 if (g_yh_initialized ==
false) {
3091 DBG_ERR(
"libyubihsm is not initialized or already finalized");
3108 DBG_ERR(
"Other operation in progress");
3113 DBG_INFO(
"Trying to digest data with mechanism 0x%04lx",
3130 DBG_ERR(
"Unable to initialize digest operation");
3156 if (g_yh_initialized ==
false) {
3157 DBG_ERR(
"libyubihsm is not initialized or already finalized");
3169 DBG_ERR(
"Digest operation not initialized");
3175 DBG_ERR(
"Another digest operation is already active");
3181 DBG_ERR(
"Wrong/missing parameter");
3188 DBG_INFO(
"The size of the digest will be %lu",
3201 DBG_ERR(
"pulDigestLen too small, data will not fit, expected = %lu, got "
3216 DBG_ERR(
"Unable to perform digest operation step");
3222 DBG_ERR(
"Unable to finalize digest operation");
3230 DBG_ERR(
"Unable to digest data");
3262 if (g_yh_initialized ==
false) {
3263 DBG_ERR(
"libyubihsm is not initialized or already finalized");
3275 DBG_ERR(
"Digest operation not initialized");
3280 if (
pPart == NULL) {
3290 DBG_ERR(
"Unable to perform digest operation step");
3332 if (g_yh_initialized ==
false) {
3333 DBG_ERR(
"libyubihsm is not initialized or already finalized");
3345 DBG_ERR(
"Wrong/missing parameter");
3351 DBG_ERR(
"Digest operation not initialized");
3357 DBG_ERR(
"Another digest operation is already active");
3364 DBG_INFO(
"The size of the digest will be %lu",
3377 DBG_ERR(
"pulDigestLen too small, data will not fit, expected = %lu, got "
3390 DBG_ERR(
"Unable to finalize digest operation");
3396 DBG_ERR(
"Unable to digest data");
3418 CK_OBJECT_HANDLE
hKey) {
3424 if (g_yh_initialized ==
false) {
3425 DBG_ERR(
"libyubihsm is not initialized or already finalized");
3442 DBG_ERR(
"Other operation in progress");
3447 DBG_INFO(
"Trying to sign data with mechanism 0x%04lx and key %08lx",
3450 int type =
hKey >> 16;
3452 DBG_ERR(
"Signing using an ECDH session key is not supported");
3461 if (
object == NULL) {
3462 DBG_ERR(
"Unable to retrieve object");
3490 DBG_INFO(
"RSA signature requested");
3495 DBG_ERR(
"Length of mechanism parameters does not match expected "
3506 if (
params->sLen > 0xffff) {
3507 DBG_ERR(
"Salt is too big for device");
3532 DBG_ERR(
"Mechanism %lu not supported",
3540 DBG_INFO(
"ECDSA signature requested");
3544 DBG_ERR(
"Mechanism %lu not supported",
3553 DBG_INFO(
"HMAC signature requested (len %lu)",
3558 DBG_ERR(
"Mechanism %lu not supported",
3576 DBG_ERR(
"Unable to initialize signing operation");
3602 if (g_yh_initialized ==
false) {
3603 DBG_ERR(
"libyubihsm is not initialized or already finalized");
3615 DBG_ERR(
"Signature operation not initialized");
3634 DBG_ERR(
"pulSignatureLen too small, signature will not fit, expected %u, "
3647 DBG_ERR(
"Unable to perform signing operation step");
3653 DBG_ERR(
"Unable to finalize signing operation");
3658 DBG_INFO(
"After padding and transformation there are %u bytes",
3664 DBG_ERR(
"Unable to sign data");
3696 if (g_yh_initialized ==
false) {
3697 DBG_ERR(
"libyubihsm is not initialized or already finalized");
3709 DBG_ERR(
"Signature operation not initialized");
3714 if (
pPart == NULL) {
3724 DBG_ERR(
"Unable to perform signing operation step");
3753 if (g_yh_initialized ==
false) {
3754 DBG_ERR(
"libyubihsm is not initialized or already finalized");
3766 DBG_ERR(
"Signature operation not initialized");
3772 DBG_ERR(
"No buffer provided, length check only");
3783 DBG_ERR(
"Unable to finalize signing operation");
3790 DBG_ERR(
"Unable to sign data");
3812 CK_OBJECT_HANDLE
hKey) {
3842 CK_OBJECT_HANDLE
hKey) {
3848 if (g_yh_initialized ==
false) {
3849 DBG_ERR(
"libyubihsm is not initialized or already finalized");
3866 DBG_ERR(
"Other operation in progress");
3871 DBG_INFO(
"Trying to verify data with mechanism 0x%04lx and key %lx",
3874 int type =
hKey >> 16;
3885 if (
object == NULL) {
3886 DBG_ERR(
"Unable to retrieve object");
3911 DBG_INFO(
"HMAC verification requested");
3913 DBG_INFO(
"Asymmetric verification requested");
3923 DBG_ERR(
"Unable to initialize verification operation");
3930 DBG_ERR(
"Length of mechanism parameters does not match expected value, "
3960 switch (
params->hashAlg) {
3974 DBG_ERR(
"Unsupported pss hash algorithm: %lu",
params->hashAlg);
4005 if (g_yh_initialized ==
false) {
4006 DBG_ERR(
"libyubihsm is not initialized or already finalized");
4018 DBG_ERR(
"Invalid parameters");
4024 DBG_ERR(
"Verification operation not initialized");
4057 DBG_ERR(
"Mechanism %lu not supported",
4071 DBG_ERR(
"Unable to perform verification operation step");
4077 DBG_ERR(
"Unable to finalize verification operation");
4086 DBG_ERR(
"Unable to verify signature");
4116 if (g_yh_initialized ==
false) {
4117 DBG_ERR(
"libyubihsm is not initialized or already finalized");
4129 DBG_ERR(
"Verification operation not initialized");
4134 if (
pPart == NULL) {
4144 DBG_ERR(
"Unable to perform verification operation step");
4171 if (g_yh_initialized ==
false) {
4172 DBG_ERR(
"libyubihsm is not initialized or already finalized");
4184 DBG_ERR(
"Verification operation not initialized");
4190 DBG_ERR(
"No buffer provided");
4197 DBG_ERR(
"Unable to finalize verification operation");
4204 DBG_ERR(
"Unable to verify data");
4222 CK_OBJECT_HANDLE
hKey) {
4322 if (g_yh_initialized ==
false) {
4323 DBG_ERR(
"libyubihsm is not initialized or already finalized");
4340 DBG_ERR(
"A different operation is already active");
4357 class.set =
key_type.set =
id.set =
false;
4363 if (
class.set ==
false) {
4383 if (
id.set ==
false) {
4460 DBG_ERR(
"Failed generating HMAC key");
4474 DBG_INFO(
"parsed WRAP key, objlen: %d",
template.objlen);
4501 DBG_ERR(
"Failed generating wrap key");
4506 DBG_ERR(
"Unknown key_type: %lx",
class.
d);
4518 DBG_ERR(
"Failed getting new object %04x",
template.
id);
4522 *
phKey =
object.sequence << 24 |
object.type << 16 |
object.id;
4548 if (g_yh_initialized ==
false) {
4549 DBG_ERR(
"libyubihsm is not initialized or already finalized");
4568 DBG_ERR(
"A different operation is already active");
4590 DBG_ERR(
"Unable to parse generation template");
4628 template.algorithm);
4630 DBG_ERR(
"Failed writing RSA key to device");
4655 template.algorithm);
4657 DBG_ERR(
"Failed writing EC key to device");
4669 *
phPublicKey =
object.sequence << 24 | (
object.type | 0x80) << 16 |
object.
id;
4670 *
phPrivateKey =
object.sequence << 24 |
object.type << 16 |
object.id;
4692 if (g_yh_initialized ==
false) {
4693 DBG_ERR(
"libyubihsm is not initialized or already finalized");
4712 DBG_ERR(
"Wrapping involving ECDH session keys is not supported");
4720 if (
object == NULL) {
4721 DBG_ERR(
"Wrapped key not found");
4736 DBG_ERR(
"A different operation is already active");
4758 DBG_ERR(
"Wrap key does not have \"export-wrapped\" set");
4764 "exportable-under-wrap") ==
false) {
4765 DBG_ERR(
"Key to be wrapped does not have \"exportable-under-wrap\" set");
4783 DBG_ERR(
"buffer to small, needed %lu, got %lu", (
unsigned long)
len,
4815 if (g_yh_initialized ==
false) {
4816 DBG_ERR(
"libyubihsm is not initialized or already finalized");
4833 DBG_ERR(
"A different operation is already active");
4840 DBG_ERR(
"Unwrapping using ECDH session key is not supported");
4862 DBG_ERR(
"Wrap key can't unwrap");
4884 *
phKey =
object.sequence << 24 |
object.type << 16 |
object.id;
4906 if (g_yh_initialized ==
false) {
4907 DBG_ERR(
"libyubihsm is not initialized or already finalized");
4932 DBG_ERR(
"Cannot derive an ECDH key from another ECDH key");
4966 if ((
params->pSharedData != NULL) || (
params->ulSharedDataLen != 0)) {
4967 DBG_ERR(
"Mechanism parameters incompatible with key derivation function "
4973 DBG_ERR(
"Unsupported value of mechanism parameter key derivation function");
4988 DBG_ERR(
"There are already %d ECDH keys available for this session. "
4989 "Cannot derive more",
5009 DBG_ERR(
"Failed to derive a key with the expected length");
5057 if (g_yh_initialized ==
false) {
5058 DBG_ERR(
"libyubihsm is not initialized or already finalized");
5080 DBG_ERR(
"Failed to get random data");
5087 DBG_ERR(
"Incorrect amount of data returned");
5142 C_GetOperationState,
5143 C_SetOperationState,
5150 C_GetAttributeValue,
5151 C_SetAttributeValue,
5178 C_VerifyRecoverInit,
5180 C_DigestEncryptUpdate,
5181 C_DecryptDigestUpdate,
5182 C_SignEncryptUpdate,
5183 C_DecryptVerifyUpdate,
5191 C_GetFunctionStatus,
void yh_dbg_init(int dbg, int dinout, int libdbg, const char *debug_file)
#define insecure_memzero(buf, len)
const char * yh_strerror(yh_rc err)
bool list_append(List *list, void *item)
void list_delete(List *list, ListItem *item)
void list_iterate(List *list, IteratorFn iterator_fn)
ListItem * list_get(List *list, void *data, CompareItemFn compare_item_fn)
void list_create(List *list, int item_size, FreeItemFn free_item_fn)
void list_destroy(List *list)
void verify(const char *msg, const T &a, const S &b)
#define CKR_SESSION_COUNT
#define CKR_MECHANISM_INVALID
#define CKR_SLOT_ID_INVALID
#define CKF_LOGIN_REQUIRED
#define CKR_KEY_UNEXTRACTABLE
#define CKR_UNWRAPPING_KEY_HANDLE_INVALID
#define CK_DEFINE_FUNCTION(retval, name)
#define CKS_RW_PUBLIC_SESSION
#define CKR_MECHANISM_PARAM_INVALID
#define CKF_TOKEN_INITIALIZED
#define CKR_SESSION_PARALLEL_NOT_SUPPORTED
ck_session_handle_t * CK_SESSION_HANDLE_PTR
ck_mechanism_type_t * CK_MECHANISM_TYPE_PTR
#define CKR_WRAPPING_KEY_TYPE_INCONSISTENT
unsigned long int CK_ULONG
#define CRYPTOKI_VERSION_MINOR
#define CKM_RSA_PKCS_KEY_PAIR_GEN
#define CKR_SESSION_HANDLE_INVALID
#define CKF_USER_PIN_INITIALIZED
#define CKS_RO_USER_FUNCTIONS
#define CKR_ARGUMENTS_BAD
ck_slot_id_t * CK_SLOT_ID_PTR
#define CKR_TOKEN_NOT_PRESENT
#define CKR_CRYPTOKI_NOT_INITIALIZED
#define CKR_PIN_INCORRECT
ck_object_handle_t * CK_OBJECT_HANDLE_PTR
#define CKF_REMOVABLE_DEVICE
#define CKZ_DATA_SPECIFIED
#define CKM_RSA_PKCS_OAEP
#define CKR_WRAPPING_KEY_HANDLE_INVALID
#define CK_UNAVAILABLE_INFORMATION
#define CKF_OS_LOCKING_OK
#define CKR_OBJECT_HANDLE_INVALID
#define CKR_ENCRYPTED_DATA_INVALID
#define CKR_CRYPTOKI_ALREADY_INITIALIZED
#define CKM_GENERIC_SECRET_KEY_GEN
#define CKF_SERIAL_SESSION
#define CKR_FUNCTION_FAILED
#define CKR_OPERATION_NOT_INITIALIZED
#define CKM_EC_KEY_PAIR_GEN
#define CKR_TEMPLATE_INCONSISTENT
#define CKR_OPERATION_ACTIVE
#define CK_EFFECTIVELY_INFINITE
#define CKR_BUFFER_TOO_SMALL
#define CKS_RW_USER_FUNCTIONS
#define CKS_RO_PUBLIC_SESSION
#define CKR_ATTRIBUTE_VALUE_INVALID
#define CKA_ALWAYS_SENSITIVE
#define CKA_CERTIFICATE_TYPE
#define CKR_TEMPLATE_INCOMPLETE
#define CKR_SIGNATURE_LEN_RANGE
#define CKR_USER_TYPE_INVALID
#define CRYPTOKI_VERSION_MAJOR
#define CKR_KEY_HANDLE_INVALID
#define CKF_TOKEN_PRESENT
CK_UTF8CHAR * CK_UTF8CHAR_PTR
#define CKR_KEY_TYPE_INCONSISTENT
#define CKR_UNWRAPPING_KEY_TYPE_INCONSISTENT
#define CKK_YUBICO_AES192_CCM_WRAP
#define CKK_YUBICO_AES128_CCM_WRAP
#define CKM_YUBICO_AES_CCM_WRAP
#define CKK_YUBICO_AES256_CCM_WRAP
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
struct ck_version version
ck_mechanism_type_t mechanism
uint8_t ecdh_key[ECDH_KEY_BUF_SIZE]
The key itself.
size_t len
The length of the key.
char label[YH_OBJ_LABEL_LEN+1]
Object label.
yh_object_descriptor objects[YH_MAX_ITEMS_COUNT]
struct mechanism::@110::@112 oaep
struct mechanism::@110::@113 pss
CK_MECHANISM_TYPE mechanism
Capabilities representation.
yh_algorithm algorithm
Object algorithm.
uint16_t len
Object length.
yh_capabilities capabilities
Object capabilities.
char label[YH_OBJ_LABEL_LEN+1]
Object label.
yh_object_type type
Object type.
CK_UNLOCKMUTEX unlock_mutex
CK_DESTROYMUTEX destroy_mutex
CK_CREATEMUTEX create_mutex
yubihsm_pkcs11_op_type type
unsigned int buffer_length
yubihsm_pkcs11_op_info operation
yubihsm_pkcs11_slot * slot
yubihsm_pkcs11_session_state session_state
yh_session * device_session
yubihsm_pkcs11_object_desc objects[YH_MAX_ITEMS_COUNT]
account_query_db::get_accounts_by_authorizers_params params
bool is_PKCS1v1_5_sign_mechanism(CK_MECHANISM_TYPE m)
bool is_ECDSA_sign_mechanism(CK_MECHANISM_TYPE m)
CK_RV set_template_attribute(yubihsm_pkcs11_attribute *attribute, void *value)
CK_RV get_mechanism_list(yubihsm_pkcs11_slot *slot, CK_MECHANISM_TYPE_PTR pMechanismList, CK_ULONG_PTR count)
bool add_connectors(yubihsm_pkcs11_context *ctx, int n_connectors, char **connector_names, yh_connector **connectors)
CK_RV apply_verify_mechanism_finalize(yubihsm_pkcs11_op_info *op_info __attribute((unused)))
bool decrypt_mechanism_cleanup(yubihsm_pkcs11_op_info *op_info)
bool verify_mechanism_cleanup(yubihsm_pkcs11_op_info *op_info)
CK_RV populate_template(int type, void *object, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount, yh_session *session)
bool check_encrypt_mechanism(yubihsm_pkcs11_slot *slot, CK_MECHANISM_PTR pMechanism)
CK_RV parse_ec_generate_template(CK_ATTRIBUTE_PTR pPublicKeyTemplate, CK_ULONG ulPublicKeyAttributeCount, CK_ATTRIBUTE_PTR pPrivateKeyTemplate, CK_ULONG ulPrivateKeyAttributeCount, yubihsm_pkcs11_object_template *template)
CK_RV apply_verify_mechanism_init(yubihsm_pkcs11_op_info *op_info)
CK_RV perform_digest(yubihsm_pkcs11_op_info *op_info, uint8_t *digest, uint16_t *digest_len)
bool is_PSS_sign_mechanism(CK_MECHANISM_TYPE m)
void release_slot(yubihsm_pkcs11_context *ctx, yubihsm_pkcs11_slot *slot)
CK_RV apply_decrypt_mechanism_finalize(yubihsm_pkcs11_op_info *op_info __attribute((unused)))
CK_RV parse_rsa_generate_template(CK_ATTRIBUTE_PTR pPublicKeyTemplate, CK_ULONG ulPublicKeyAttributeCount, CK_ATTRIBUTE_PTR pPrivateKeyTemplate, CK_ULONG ulPrivateKeyAttributeCount, yubihsm_pkcs11_object_template *template)
bool is_HMAC_sign_mechanism(CK_MECHANISM_TYPE m)
CK_RV get_session(yubihsm_pkcs11_context *ctx, CK_SESSION_HANDLE hSession, yubihsm_pkcs11_session **session, int session_state)
bool parse_hex(CK_UTF8CHAR_PTR hex, CK_ULONG hex_len, uint8_t *parsed)
CK_RV apply_digest_mechanism_init(yubihsm_pkcs11_op_info *op_info)
CK_RV perform_signature(yh_session *session, yubihsm_pkcs11_op_info *op_info, uint8_t *signature, uint16_t *signature_len)
CK_RV validate_derive_key_attribute(CK_ATTRIBUTE_TYPE type, void *value)
CK_RV apply_encrypt_mechanism_update(yubihsm_pkcs11_op_info *op_info, CK_BYTE_PTR in, CK_ULONG in_len)
bool check_decrypt_mechanism(yubihsm_pkcs11_slot *slot, CK_MECHANISM_PTR pMechanism)
bool check_digest_mechanism(CK_MECHANISM_PTR pMechanism)
CK_RV parse_wrap_template(CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount, yubihsm_pkcs11_object_template *template, bool generate)
int parse_id_value(void *value, CK_ULONG len)
CK_RV parse_ec_template(CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount, yubihsm_pkcs11_object_template *template)
bool sign_mechanism_cleanup(yubihsm_pkcs11_op_info *op_info)
bool create_session(yubihsm_pkcs11_slot *slot, CK_FLAGS flags, CK_SESSION_HANDLE_PTR phSession)
CK_RV apply_sign_mechanism_finalize(yubihsm_pkcs11_op_info *op_info)
yubihsm_pkcs11_slot * get_slot(yubihsm_pkcs11_context *ctx, CK_ULONG id)
CK_RV parse_hmac_template(CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount, yubihsm_pkcs11_object_template *template, bool generate)
bool is_RSA_sign_mechanism(CK_MECHANISM_TYPE m)
CK_RV apply_sign_mechanism_update(yubihsm_pkcs11_op_info *op_info, CK_BYTE_PTR in, CK_ULONG in_len)
void set_native_locking(yubihsm_pkcs11_context *ctx)
CK_RV apply_decrypt_mechanism_update(yubihsm_pkcs11_op_info *op_info, CK_BYTE_PTR in, CK_ULONG in_len)
bool check_wrap_mechanism(yubihsm_pkcs11_slot *slot, CK_MECHANISM_PTR pMechanism)
yubihsm_pkcs11_object_desc * get_object_desc(yh_session *session, yubihsm_pkcs11_object_desc *objects, CK_OBJECT_HANDLE objHandle)
bool delete_session(yubihsm_pkcs11_context *ctx, CK_SESSION_HANDLE_PTR phSession)
CK_RV apply_digest_mechanism_update(yubihsm_pkcs11_op_info *op_info, CK_BYTE_PTR in, CK_ULONG in_len)
bool check_verify_mechanism(yubihsm_pkcs11_slot *slot, CK_MECHANISM_PTR pMechanism)
CK_RV perform_decrypt(yh_session *session, yubihsm_pkcs11_op_info *op_info, uint8_t *data, uint16_t *data_len)
CK_RV apply_decrypt_mechanism_init(yubihsm_pkcs11_op_info *op_info)
CK_RV apply_digest_mechanism_finalize(yubihsm_pkcs11_op_info *op_info)
bool get_mechanism_info(yubihsm_pkcs11_slot *slot, CK_MECHANISM_TYPE type, CK_MECHANISM_INFO_PTR pInfo)
void release_session(yubihsm_pkcs11_context *ctx, yubihsm_pkcs11_session *session)
CK_RV perform_verify(yh_session *session, yubihsm_pkcs11_op_info *op_info, uint8_t *signature, uint16_t signature_len)
CK_RV parse_rsa_template(CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount, yubihsm_pkcs11_object_template *template)
CK_ULONG get_digest_bytelength(CK_MECHANISM_TYPE m)
CK_RV apply_sign_mechanism_init(yubihsm_pkcs11_op_info *op_info)
bool digest_mechanism_cleanup(yubihsm_pkcs11_op_info *op_info)
CK_RV apply_verify_mechanism_update(yubihsm_pkcs11_op_info *op_info, CK_BYTE_PTR in, CK_ULONG in_len)
bool check_sign_mechanism(yubihsm_pkcs11_slot *slot, CK_MECHANISM_PTR pMechanism)
CK_RV perform_encrypt(yh_session *session, yubihsm_pkcs11_op_info *op_info, uint8_t *data, uint16_t *data_len)
bool yh_is_rsa(yh_algorithm algorithm)
yh_rc yh_util_import_opaque(yh_session *session, uint16_t *object_id, const char *label, uint16_t domains, const yh_capabilities *capabilities, yh_algorithm algorithm, const uint8_t *in, size_t in_len)
bool yh_connector_has_device(yh_connector *connector)
yh_rc yh_util_import_hmac_key(yh_session *session, uint16_t *key_id, const char *label, uint16_t domains, const yh_capabilities *capabilities, yh_algorithm algorithm, const uint8_t *key, size_t key_len)
yh_rc yh_destroy_session(yh_session **session)
yh_rc yh_util_generate_hmac_key(yh_session *session, uint16_t *key_id, const char *label, uint16_t domains, const yh_capabilities *capabilities, yh_algorithm algorithm)
yh_rc yh_util_generate_wrap_key(yh_session *session, uint16_t *key_id, const char *label, uint16_t domains, const yh_capabilities *capabilities, yh_algorithm algorithm, const yh_capabilities *delegated_capabilities)
yh_rc yh_util_derive_ecdh(yh_session *session, uint16_t key_id, const uint8_t *in, size_t in_len, uint8_t *out, size_t *out_len)
yh_rc yh_util_generate_ec_key(yh_session *session, uint16_t *key_id, const char *label, uint16_t domains, const yh_capabilities *capabilities, yh_algorithm algorithm)
yh_rc yh_get_key_bitlength(yh_algorithm algorithm, size_t *result)
yh_rc yh_util_import_wrap_key(yh_session *session, uint16_t *key_id, const char *label, uint16_t domains, const yh_capabilities *capabilities, yh_algorithm algorithm, const yh_capabilities *delegated_capabilities, const uint8_t *in, size_t in_len)
yh_rc yh_create_session_derived(yh_connector *connector, uint16_t authkey_id, const uint8_t *password, size_t password_len, bool recreate, yh_session **session)
yh_rc yh_util_close_session(yh_session *session)
yh_rc yh_util_get_device_info(yh_connector *connector, uint8_t *major, uint8_t *minor, uint8_t *patch, uint32_t *serial, uint8_t *log_total, uint8_t *log_used, yh_algorithm *algorithms, size_t *n_algorithms)
yh_rc yh_authenticate_session(yh_session *session)
yh_rc yh_util_get_object_info(yh_session *session, uint16_t id, yh_object_type type, yh_object_descriptor *object)
yh_rc yh_util_list_objects(yh_session *session, uint16_t id, yh_object_type type, uint16_t domains, const yh_capabilities *capabilities, yh_algorithm algorithm, const char *label, yh_object_descriptor *objects, size_t *n_objects)
yh_rc yh_set_connector_option(yh_connector *connector, yh_connector_option opt, const void *val)
yh_rc yh_init_connector(const char *url, yh_connector **connector)
yh_rc yh_connect(yh_connector *connector, int timeout)
yh_rc yh_util_export_wrapped(yh_session *session, uint16_t wrapping_key_id, yh_object_type target_type, uint16_t target_id, uint8_t *out, size_t *out_len)
yh_rc yh_string_to_capabilities(const char *capability, yh_capabilities *result)
yh_rc yh_util_import_rsa_key(yh_session *session, uint16_t *key_id, const char *label, uint16_t domains, const yh_capabilities *capabilities, yh_algorithm algorithm, const uint8_t *p, const uint8_t *q)
yh_rc yh_disconnect(yh_connector *connector)
yh_rc yh_util_generate_rsa_key(yh_session *session, uint16_t *key_id, const char *label, uint16_t domains, const yh_capabilities *capabilities, yh_algorithm algorithm)
bool yh_check_capability(const yh_capabilities *capabilities, const char *capability)
yh_rc yh_util_import_ec_key(yh_session *session, uint16_t *key_id, const char *label, uint16_t domains, const yh_capabilities *capabilities, yh_algorithm algorithm, const uint8_t *s)
yh_rc yh_util_import_wrapped(yh_session *session, uint16_t wrapping_key_id, const uint8_t *in, size_t in_len, yh_object_type *target_type, uint16_t *target_id)
yh_rc yh_util_delete_object(yh_session *session, uint16_t id, yh_object_type type)
yh_rc yh_util_get_pseudo_random(yh_session *session, size_t len, uint8_t *out, size_t *out_len)
@ YH_HMAC_KEY
HMAC Key is a secret key used when computing and verifying HMAC signatures.
@ YH_ASYMMETRIC_KEY
Asymmetric Key is the private key of an asymmetric key-pair.
#define YH_MAX_ITEMS_COUNT
Max items the device may hold.
#define YH_OBJ_LABEL_LEN
Max length of object labels.
@ YH_ALGO_MGF1_SHA512
mgf1-sha512
@ YH_ALGO_OPAQUE_X509_CERTIFICATE
opaque-x509-certificate
@ YH_ALGO_MGF1_SHA384
mgf1-sha384
@ YH_ALGO_OPAQUE_DATA
opaque-data
@ YH_ALGO_MGF1_SHA1
mgf1-sha1
@ YH_ALGO_MGF1_SHA256
mgf1-sha256
@ YH_CONNECTOR_PROXY_SERVER
#define YH_CCM_WRAP_OVERHEAD
@ YHR_SUCCESS
Returned value when function was successful.
@ YHR_CRYPTOGRAM_MISMATCH
Returned value when failing to verify cryptogram.
CK_SESSION_HANDLE CK_OBJECT_HANDLE CK_ULONG_PTR pulSize
yubihsm_pkcs11_slot * slot
CK_SESSION_HANDLE CK_OBJECT_HANDLE hObject
CK_SLOT_ID CK_SLOT_INFO_PTR pInfo
CK_SESSION_HANDLE CK_MECHANISM_PTR CK_ATTRIBUTE_PTR CK_ULONG CK_ATTRIBUTE_PTR CK_ULONG ulPrivateKeyAttributeCount
CK_SESSION_HANDLE CK_BYTE_PTR pPart
CK_SESSION_HANDLE CK_BYTE_PTR CK_ULONG CK_BYTE_PTR CK_ULONG_PTR pulDataLen
yh_capabilities capabilities
yubihsm_pkcs11_session * session
CK_SESSION_HANDLE CK_MECHANISM_PTR CK_OBJECT_HANDLE CK_OBJECT_HANDLE CK_BYTE_PTR CK_ULONG_PTR pulWrappedKeyLen
CK_SESSION_HANDLE CK_BYTE_PTR CK_ULONG CK_BYTE_PTR CK_ULONG_PTR pulEncryptedDataLen
CK_SESSION_HANDLE CK_BYTE_PTR CK_ULONG_PTR pulLastEncryptedPartLen
yh_object_type target_type
CK_SESSION_HANDLE hSession
#define YUBIHSM_PKCS11_MAX_PIN_LEN
CK_SLOT_ID CK_MECHANISM_TYPE type
CK_SESSION_HANDLE CK_OBJECT_HANDLE_PTR CK_ULONG ulMaxObjectCount
CK_SESSION_HANDLE CK_BYTE_PTR CK_ULONG ulPartLen
CK_SESSION_HANDLE CK_BYTE_PTR CK_ULONG CK_BYTE_PTR CK_ULONG ulSignatureLen
CK_SESSION_HANDLE CK_BYTE_PTR CK_ULONG ulOperationStateLen
CK_SESSION_HANDLE CK_MECHANISM_PTR CK_ATTRIBUTE_PTR CK_ULONG CK_ATTRIBUTE_PTR CK_ULONG CK_OBJECT_HANDLE_PTR CK_OBJECT_HANDLE_PTR phPrivateKey
return CKR_FUNCTION_NOT_PARALLEL
CK_SESSION_HANDLE CK_UTF8CHAR_PTR CK_ULONG CK_UTF8CHAR_PTR pNewPin
CK_SLOT_ID CK_FLAGS CK_VOID_PTR CK_NOTIFY Notify
yh_get_connector_version(slot->connector, &major, &minor, &patch)
CK_SESSION_HANDLE CK_MECHANISM_PTR CK_OBJECT_HANDLE hBaseKey
CK_SESSION_HANDLE CK_USER_TYPE userType
CK_BBOOL CK_SLOT_ID_PTR pSlotList
CK_SESSION_HANDLE CK_BYTE_PTR CK_ULONG CK_BYTE_PTR CK_ULONG_PTR pulPartLen
CK_SESSION_HANDLE CK_MECHANISM_PTR CK_OBJECT_HANDLE hWrappingKey
CK_SESSION_HANDLE CK_ATTRIBUTE_PTR CK_ULONG ulCount
CK_SLOT_ID CK_FLAGS CK_VOID_PTR CK_NOTIFY CK_SESSION_HANDLE_PTR phSession
CK_SESSION_HANDLE CK_BYTE_PTR CK_ULONG ulEncryptedPartLen
CK_FLAGS CK_SLOT_ID_PTR pSlot
CK_SESSION_HANDLE CK_BYTE_PTR CK_ULONG ulRandomLen
CK_SESSION_HANDLE CK_MECHANISM_PTR CK_OBJECT_HANDLE CK_OBJECT_HANDLE CK_BYTE_PTR pWrappedKey
CK_SESSION_HANDLE CK_MECHANISM_PTR CK_ATTRIBUTE_PTR CK_ULONG CK_ATTRIBUTE_PTR CK_ULONG CK_OBJECT_HANDLE_PTR phPublicKey
CK_SESSION_HANDLE CK_BYTE_PTR pData
CK_FUNCTION_LIST function_list
CK_SESSION_HANDLE CK_BYTE_PTR CK_ULONG CK_BYTE_PTR pEncryptedData
CK_SESSION_HANDLE CK_UTF8CHAR_PTR CK_ULONG CK_UTF8CHAR_PTR CK_ULONG ulNewLen
CK_SESSION_HANDLE CK_BYTE_PTR CK_ULONG_PTR pulLastPartLen
CK_SESSION_HANDLE CK_MECHANISM_PTR CK_OBJECT_HANDLE hKey
CK_SESSION_HANDLE CK_BYTE_PTR pRandomData
CK_SESSION_HANDLE CK_OBJECT_HANDLE CK_ATTRIBUTE_PTR CK_ULONG CK_OBJECT_HANDLE_PTR phNewObject
CK_SESSION_HANDLE CK_BYTE_PTR CK_ULONG CK_BYTE_PTR CK_ULONG_PTR pulSignatureLen
CK_SESSION_HANDLE CK_BYTE_PTR CK_ULONG CK_OBJECT_HANDLE hEncryptionKey
CK_SESSION_HANDLE CK_MECHANISM_PTR CK_OBJECT_HANDLE CK_BYTE_PTR CK_ULONG ulWrappedKeyLen
CK_FUNCTION_LIST_PTR_PTR ppFunctionList
CK_SLOT_ID CK_MECHANISM_TYPE_PTR pMechanismList
CK_SESSION_HANDLE CK_BYTE_PTR pOperationState
yh_object_descriptor object
CK_SLOT_ID CK_FLAGS CK_VOID_PTR pApplication
#define YUBIHSM_PKCS11_MANUFACTURER
CK_SESSION_HANDLE CK_BYTE_PTR CK_ULONG CK_BYTE_PTR CK_ULONG_PTR pulDigestLen
CK_SESSION_HANDLE CK_BYTE_PTR pSeed
CK_SESSION_HANDLE CK_BYTE_PTR pLastEncryptedPart
CK_SESSION_HANDLE CK_BYTE_PTR CK_ULONG ulSeedLen
CK_SESSION_HANDLE CK_MECHANISM_PTR CK_OBJECT_HANDLE CK_BYTE_PTR CK_ULONG CK_ATTRIBUTE_PTR CK_ULONG ulAttributeCount
CK_SESSION_HANDLE CK_BYTE_PTR CK_ULONG ulDataLen
CK_SESSION_HANDLE CK_MECHANISM_PTR CK_ATTRIBUTE_PTR CK_ULONG CK_ATTRIBUTE_PTR pPrivateKeyTemplate
CK_SESSION_HANDLE CK_ATTRIBUTE_PTR CK_ULONG CK_OBJECT_HANDLE_PTR phObject
CK_SESSION_HANDLE CK_ATTRIBUTE_PTR pTemplate
CK_SESSION_HANDLE CK_BYTE_PTR CK_ULONG CK_OBJECT_HANDLE CK_OBJECT_HANDLE hAuthenticationKey
CK_SESSION_HANDLE CK_MECHANISM_PTR CK_ATTRIBUTE_PTR CK_ULONG ulPublicKeyAttributeCount
size_t expected_key_length
#define YUBIHSM_PKCS11_MIN_PIN_LEN
delete_object_from_cache(session->slot->objects, hObject)
return CKR_RANDOM_SEED_NOT_SUPPORTED
CK_SESSION_HANDLE CK_MECHANISM_PTR pMechanism
CK_FLAGS CK_SLOT_ID_PTR CK_VOID_PTR pReserved
CK_SESSION_HANDLE CK_BYTE_PTR CK_ULONG CK_BYTE_PTR CK_ULONG_PTR pulEncryptedPartLen
CK_SESSION_HANDLE CK_BYTE_PTR CK_ULONG CK_BYTE_PTR pDigest
CK_SLOT_ID CK_UTF8CHAR_PTR CK_ULONG ulPinLen
CK_SESSION_HANDLE CK_UTF8CHAR_PTR CK_ULONG ulOldLen
CK_SLOT_ID CK_UTF8CHAR_PTR pPin
#define GLOBAL_UNLOCK_OR_RETURN
return CKR_FUNCTION_NOT_SUPPORTED
CK_SESSION_HANDLE CK_BYTE_PTR CK_ULONG ulEncryptedDataLen
#define GLOBAL_LOCK_OR_RETURN
CK_BBOOL CK_SLOT_ID_PTR CK_ULONG_PTR pulCount
memset(pInfo->slotDescription, ' ', 64)
CK_SESSION_HANDLE CK_MECHANISM_PTR CK_ATTRIBUTE_PTR pPublicKeyTemplate
ecdh_session_key ecdh_key
yh_get_connector_address(slot->connector, &s)
memcpy((char *) pInfo->slotDescription, s, l)
CK_SESSION_HANDLE CK_BYTE_PTR CK_ULONG CK_BYTE_PTR pEncryptedPart
#define YUBIHSM_PKCS11_LIBDESC
CK_SESSION_HANDLE CK_BYTE_PTR pLastPart
CK_SESSION_HANDLE CK_BYTE_PTR CK_ULONG_PTR pulOperationStateLen
CK_SESSION_HANDLE CK_UTF8CHAR_PTR pOldPin
CK_SESSION_HANDLE CK_MECHANISM_PTR CK_OBJECT_HANDLE hUnwrappingKey
yh_capabilities delegated_capabilities
CK_SESSION_HANDLE CK_OBJECT_HANDLE_PTR CK_ULONG CK_ULONG_PTR pulObjectCount
CK_SLOT_ID CK_UTF8CHAR_PTR CK_ULONG CK_UTF8CHAR_PTR pLabel
CK_SESSION_HANDLE CK_MECHANISM_PTR CK_ATTRIBUTE_PTR CK_ULONG CK_OBJECT_HANDLE_PTR phKey
CK_SESSION_HANDLE CK_BYTE_PTR CK_ULONG CK_BYTE_PTR pSignature
@ SESSION_AUTHENTICATED_RW
@ SESSION_AUTHENTICATED_RO
#define SESSION_NOT_AUTHENTICATED
#define MAX_ECDH_SESSION_KEYS
#define SESSION_AUTHENTICATED