Lines Matching defs:session
35 #define META_DESTROY_KEY(session, hObject) \
36 if ((session) && \
38 CK_SLOT_ID fw_st_id = (session)->fw_st_id; \
39 CK_SESSION_HANDLE hSession = (session)->hSession; \
50 meta_operation_init_defer(CK_FLAGS optype, meta_session_t *session,
54 if (session->init.pMech == NULL) {
55 session->init.pMech = malloc(sizeof (CK_MECHANISM));
56 if (session->init.pMech == NULL)
59 (void) memcpy(session->init.pMech, pMechanism,
64 session->init.pMech->pParameter =
66 if (session->init.pMech->pParameter == NULL) {
67 free(session->init.pMech);
68 session->init.pMech = NULL;
71 (void) memcpy(session->init.pMech->pParameter,
74 session->init.pMech->pParameter = NULL;
80 session->init.pMech->ulParameterLen) {
81 if (session->init.pMech->pParameter != NULL)
82 free(session->init.pMech->pParameter);
83 session->init.pMech->pParameter =
85 if (session->init.pMech->pParameter == NULL) {
86 free(session->init.pMech);
87 session->init.pMech = NULL;
91 (void) memcpy(session->init.pMech->pParameter,
98 if (session->init.pMech->pParameter != NULL) {
99 free(session->init.pMech->pParameter);
100 session->init.pMech->pParameter = NULL;
104 session->init.pMech->mechanism =
106 session->init.pMech->ulParameterLen =
110 session->init.session = session;
111 session->init.optype = optype;
112 session->init.key = key;
113 session->init.done = B_FALSE;
114 session->init.app = B_TRUE;
123 meta_operation_init(CK_FLAGS optype, meta_session_t *session,
137 if (session->op1.type != 0) {
158 meta_operation_cleanup(session, session->op1.type,
160 rv = meta_operation_init_defer(optype, session,
168 meta_operation_cleanup(session, session->op1.type,
179 * If the specified mechanism is used in this session last time,
183 if (((session->mech_support_info).mech != pMechanism->mechanism) ||
184 ((session->mech_support_info).num_supporting_slots == 0)) {
185 (session->mech_support_info).mech = pMechanism->mechanism;
186 rv = meta_mechManager_get_slots(&(session->mech_support_info),
196 slotCount = (session->mech_support_info).num_supporting_slots;
197 supporting_slots = (session->mech_support_info).supporting_slots;
209 * An actual session with the underlying slot is required
211 * completed, the underlying session with the slot
215 * one extra trip to the session pool to get an idle session.
217 * we release the session back to the session pool then.
219 if (session->op1.session != NULL) {
221 if ((session->op1.session)->slotnum == slotnum) {
222 init_session = session->op1.session;
227 session->op1.session = NULL;
236 session->session_flags);
313 * If currently stored session is not the one being in use now,
316 if ((session->op1.session) &&
317 (session->op1.session != init_session)) {
318 meta_release_slot_session(session->op1.session);
321 /* Save the session */
322 session->op1.session = init_session;
323 session->op1.type = optype;
325 session->init.slotnum = slotnum;
326 session->init.done = B_TRUE;
340 meta_operation_init_softtoken(CK_FLAGS optype, meta_session_t *session,
354 if (session->op1.type != 0) {
372 meta_operation_cleanup(session, session->op1.type, B_FALSE);
373 rv = meta_operation_init_defer(optype, session, &mech,
383 * An actual session with the underlying slot is required
385 * completed, the underlying session with the slot
389 * one extra trip to the session pool to get an idle session.
391 * we release the session back to the session pool.
393 if (session->op1.session != NULL) {
394 if ((session->op1.session)->slotnum ==
396 init_session = session->op1.session;
401 session->op1.session = NULL;
408 /* get the active session from softtoken slot */
410 &init_session, session->session_flags);
462 * If currently stored session is not the one being in use now,
465 if ((session->op1.session) &&
466 (session->op1.session != init_session)) {
467 meta_release_slot_session(session->op1.session);
470 /* Save the session */
471 session->op1.session = init_session;
472 session->op1.type = optype;
478 session->init.done = B_TRUE;
479 session->init.slotnum = softtoken_slot_num;
523 meta_session_t *session, meta_object_t *object,
545 if (!session->init.app) {
549 session->init.pMech->mechanism);
553 if ((session->init.app) && (!session->init.done)) {
561 session->init.session,
562 session->init.pMech,
563 session->init.key);
566 } else if (!session->init.app) {
580 if ((session->init.app) && (!session->init.done)) {
588 session->init.session,
589 session->init.pMech,
590 session->init.key);
598 session->init.session,
599 session->init.pMech,
600 session->init.key);
604 } else if (!session->init.app) {
613 } else if (optype != session->op1.type) {
617 slot_session = session->op1.session;
744 session->init.app = B_FALSE;
747 meta_operation_cleanup(session, optype, finished_normally);
754 free_session_mechanism(meta_session_t *session)
756 if (session->init.pMech != NULL) {
757 if (session->init.pMech->pParameter != NULL) {
758 free(session->init.pMech->pParameter);
759 session->init.pMech->pParameter = NULL;
760 session->init.pMech->ulParameterLen = 0;
762 free(session->init.pMech);
763 session->init.pMech = NULL;
770 * Cleans up an operation in the specified session.
775 meta_operation_cleanup(meta_session_t *session, CK_FLAGS optype,
785 if (session->op1.type == optype) {
786 op = &session->op1;
791 session->op1.type = 0;
792 session->init.app = B_FALSE;
793 session->init.done = B_FALSE;
794 free_session_mechanism(session);
799 hSession = op->session->hSession;
800 fw_st_id = op->session->fw_st_id;
848 meta_release_slot_session(session->op1.session);
849 session->op1.session = NULL;
854 session->init.done = B_FALSE;
855 free_session_mechanism(session);
857 session->op1.type = 0;
932 meta_generate_keys(meta_session_t *session, CK_MECHANISM *pMechanism,
986 /* Can't create token objects in a read-only session. */
987 if ((IS_READ_ONLY_SESSION(session->session_flags)) &&
992 if (meta_freeobject_check(session, key1, pMechanism, k1Template,
1030 &(session->mech_support_info), &slots, &slotCount, token_only,
1052 if (session->op1.session != NULL) {
1053 if ((session->op1.session)->slotnum == slotnum) {
1054 gen_session = session->op1.session;
1059 session->op1.session = NULL;
1067 session->session_flags);
1145 rv = meta_freeobject_clone(session, key1);
1161 rv = meta_freeobject_clone(session, key2);
1177 /* Save the session in case it can be used later */
1180 * If currently stored session is not the one being in use now,
1183 if ((session->op1.session) &&
1184 (session->op1.session != gen_session)) {
1185 meta_release_slot_session(session->op1.session);
1188 /* Save the session */
1189 session->op1.session = gen_session;
1192 (session->op1.session != gen_session)) {
1206 meta_wrap_key(meta_session_t *session, CK_MECHANISM *pMechanism,
1224 &(session->mech_support_info), &slots, &slotCount,
1237 if (session->op1.session != NULL) {
1238 if ((session->op1.session)->slotnum == slotnum) {
1239 wrap_session = session->op1.session;
1244 session->op1.session = NULL;
1252 session->session_flags);
1296 /* Save the session in case it can be used later */
1299 * If currently stored session is not the one being in use now,
1302 if ((session->op1.session) &&
1303 (session->op1.session != wrap_session)) {
1304 meta_release_slot_session(session->op1.session);
1307 /* Save the session */
1308 session->op1.session = wrap_session;
1311 (wrap_session != session->op1.session)) {
1326 meta_unwrap_key(meta_session_t *session,
1341 /* Can't create token objects in a read-only session. */
1342 if ((IS_READ_ONLY_SESSION(session->session_flags)) &&
1354 &(session->mech_support_info), &slots, &slotCount,
1372 if (session->op1.session != NULL) {
1373 if ((session->op1.session)->slotnum == slotnum) {
1374 unwrap_session = session->op1.session;
1379 session->op1.session = NULL;
1387 session->session_flags);
1442 /* Save the session in case it can be used later */
1445 * If currently stored session is not the one being in use now,
1448 if ((session->op1.session) &&
1449 (session->op1.session != unwrap_session)) {
1450 meta_release_slot_session(session->op1.session);
1453 /* Save the session */
1454 session->op1.session = unwrap_session;
1457 (unwrap_session != session->op1.session)) {
1485 meta_derive_key(meta_session_t *session, CK_MECHANISM *pMechanism,
1521 /* Can't create token objects in a read-only session. */
1522 if ((IS_READ_ONLY_SESSION(session->session_flags)) &&
1528 if (meta_freeobject_check(session, newKey1, pMechanism, pTemplate,
1541 &(session->mech_support_info), &slots, &slot_count,
1573 if (session->op1.session != NULL) {
1574 if ((session->op1.session)->slotnum == slotnum) {
1575 derive_session = session->op1.session;
1580 session->op1.session = NULL;
1588 session->session_flags);
1730 (void) meta_freeobject_clone(session, newKey1);
1759 /* Save the session in case it can be used later */
1762 * If currently stored session is not the one being in use now,
1765 if ((session->op1.session) &&
1766 (session->op1.session != derive_session)) {
1767 meta_release_slot_session(session->op1.session);
1770 /* Save the session */
1771 session->op1.session = derive_session;
1774 (derive_session != session->op1.session)) {