Overview
Comment: | Updated to correctly deep copy pTemplate in C_FindObjectsInit
Added support for CKA_TRUSTED |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: | 965b9a28c78f430bc8a527f6f3abb421c3b12bc7 |
User & Date: | rkeene on 2010-06-05 20:17:31 |
Other Links: | manifest | tags |
Context
2010-06-05
| ||
20:18 | CACKey 0.5.11 check-in: 1a514f86a4 user: rkeene tags: trunk, 0.5.11 | |
20:17 |
Updated to correctly deep copy pTemplate in C_FindObjectsInit
Added support for CKA_TRUSTED check-in: 965b9a28c7 user: rkeene tags: trunk | |
2010-06-04
| ||
00:21 | Added script to build release packages check-in: 6b55b9da2d user: rkeene tags: trunk | |
Changes
Modified cackey.c from [67b5263486] to [c16f533241].
2510 2510 CACKEY_DEBUG_PRINTF("Requesting attribute CKA_TOKEN (0x%08lx) ...", (unsigned long) curr_attr_type); 2511 2511 2512 2512 pValue = &ck_true; 2513 2513 ulValueLen = sizeof(ck_true); 2514 2514 2515 2515 CACKEY_DEBUG_PRINTF(" ... returning %lu (%p/%lu)", (unsigned long) *((CK_BBOOL *) pValue), pValue, (unsigned long) ulValueLen); 2516 2516 2517 + break; 2518 + case CKA_TRUSTED: 2519 + CACKEY_DEBUG_PRINTF("Requesting attribute CKA_TRUSTED (0x%08lx) ...", (unsigned long) curr_attr_type); 2520 + 2521 + pValue = &ck_true; 2522 + ulValueLen = sizeof(ck_true); 2523 + 2524 + CACKEY_DEBUG_PRINTF(" ... returning %lu (%p/%lu)", (unsigned long) *((CK_BBOOL *) pValue), pValue, (unsigned long) ulValueLen); 2525 + 2517 2526 break; 2518 2527 case CKA_MODIFIABLE: 2519 2528 CACKEY_DEBUG_PRINTF("Requesting attribute CKA_MODIFIABLE (0x%08lx) ...", (unsigned long) curr_attr_type); 2520 2529 2521 2530 pValue = &ck_false; 2522 2531 ulValueLen = sizeof(ck_false); 2523 2532 ................................................................................ 4258 4267 CACKEY_DEBUG_PRINTF("Returning CKR_FUNCTION_NOT_SUPPORTED (%i)", CKR_FUNCTION_NOT_SUPPORTED); 4259 4268 4260 4269 return(CKR_FUNCTION_NOT_SUPPORTED); 4261 4270 } 4262 4271 4263 4272 CK_DEFINE_FUNCTION(CK_RV, C_FindObjectsInit)(CK_SESSION_HANDLE hSession, CK_ATTRIBUTE_PTR pTemplate, CK_ULONG ulCount) { 4264 4273 CK_SLOT_ID slotID; 4274 + CK_ULONG idx; 4265 4275 int mutex_retval; 4266 4276 4267 4277 CACKEY_DEBUG_PRINTF("Called."); 4268 4278 4269 4279 if (!cackey_initialized) { 4270 4280 CACKEY_DEBUG_PRINTF("Error. Not initialized."); 4271 4281 ................................................................................ 4342 4352 4343 4353 if (pTemplate != NULL) { 4344 4354 if (ulCount != 0) { 4345 4355 cackey_sessions[hSession].search_query_count = ulCount; 4346 4356 cackey_sessions[hSession].search_query = malloc(ulCount * sizeof(*pTemplate)); 4347 4357 4348 4358 memcpy(cackey_sessions[hSession].search_query, pTemplate, ulCount * sizeof(*pTemplate)); 4359 + for (idx = 0; idx < ulCount; idx++) { 4360 + if (pTemplate[idx].ulValueLen == 0) { 4361 + cackey_sessions[hSession].search_query[idx].pValue = NULL; 4362 + 4363 + continue; 4364 + } 4365 + 4366 + cackey_sessions[hSession].search_query[idx].pValue = malloc(pTemplate[idx].ulValueLen); 4367 + 4368 + if (cackey_sessions[hSession].search_query[idx].pValue) { 4369 + memcpy(cackey_sessions[hSession].search_query[idx].pValue, pTemplate[idx].pValue, pTemplate[idx].ulValueLen); 4370 + } 4371 + } 4349 4372 } else { 4350 4373 cackey_sessions[hSession].search_query_count = 0; 4351 4374 cackey_sessions[hSession].search_query = NULL; 4352 4375 } 4353 4376 } else { 4354 4377 if (ulCount != 0) { 4355 4378 cackey_mutex_unlock(cackey_biglock); ................................................................................ 4518 4541 4519 4542 CACKEY_DEBUG_PRINTF("Returning CKR_OK (%i), num objects = %lu", CKR_OK, *pulObjectCount); 4520 4543 4521 4544 return(CKR_OK); 4522 4545 } 4523 4546 4524 4547 CK_DEFINE_FUNCTION(CK_RV, C_FindObjectsFinal)(CK_SESSION_HANDLE hSession) { 4548 + CK_ULONG idx; 4525 4549 int mutex_retval; 4526 4550 4527 4551 CACKEY_DEBUG_PRINTF("Called."); 4528 4552 4529 4553 if (!cackey_initialized) { 4530 4554 CACKEY_DEBUG_PRINTF("Error. Not initialized."); 4531 4555 ................................................................................ 4558 4582 4559 4583 CACKEY_DEBUG_PRINTF("Error. Search not active."); 4560 4584 4561 4585 return(CKR_OPERATION_NOT_INITIALIZED); 4562 4586 } 4563 4587 4564 4588 cackey_sessions[hSession].search_active = 0; 4589 + 4590 + for (idx = 0; idx < cackey_sessions[hSession].search_query_count; idx++) { 4591 + if (cackey_sessions[hSession].search_query[idx].pValue) { 4592 + free(cackey_sessions[hSession].search_query[idx].pValue); 4593 + } 4594 + } 4595 + 4565 4596 if (cackey_sessions[hSession].search_query) { 4566 4597 free(cackey_sessions[hSession].search_query); 4567 4598 } 4568 4599 4569 4600 mutex_retval = cackey_mutex_unlock(cackey_biglock); 4570 4601 if (mutex_retval != 0) { 4571 4602 CACKEY_DEBUG_PRINTF("Error. Unlocking failed.");