Lines Matching refs:template

257 kernel_validate_attr(CK_ATTRIBUTE_PTR template, CK_ULONG ulAttrNum,
266 switch (template[i].type) {
268 *class = *((CK_OBJECT_CLASS*)template[i].pValue);
282 switch (template[i].type) {
303 rv = kernel_lookup_attr(template[i].type);
352 kernel_add_extra_attr(CK_ATTRIBUTE_PTR template, kernel_object_t *object_p)
364 attrp->attr.type = template->type;
365 attrp->attr.ulValueLen = template->ulValueLen;
367 if ((template->pValue != NULL) &&
368 (template->ulValueLen > 0)) {
370 attrp->attr.pValue = malloc(template->ulValueLen);
376 (void) memcpy(attrp->attr.pValue, template->pValue,
377 template->ulValueLen);
444 * (if the specified attribute type is found), and copy it to a template.
445 * Note the type of the attribute to be copied is specified by the template,
446 * and the storage is pre-allocated for the attribute value in the template
450 get_extra_attr_from_object(kernel_object_t *object_p, CK_ATTRIBUTE_PTR template)
454 CK_ATTRIBUTE_TYPE type = template->type;
470 template->ulValueLen = 0;
477 if (template->pValue == NULL) {
478 template->ulValueLen = extra_attr->attr.ulValueLen;
482 if (template->ulValueLen >= extra_attr->attr.ulValueLen) {
487 (void) memcpy(template->pValue, extra_attr->attr.pValue,
489 template->ulValueLen = extra_attr->attr.ulValueLen;
496 template->ulValueLen = (CK_ULONG)-1;
509 CK_ATTRIBUTE_PTR template)
531 return (kernel_add_extra_attr(template, object_p));
535 if ((template->pValue != NULL) &&
536 (template->ulValueLen > 0)) {
537 if (template->ulValueLen > extra_attr->attr.ulValueLen) {
544 extra_attr->attr.pValue = malloc(template->ulValueLen);
551 extra_attr->attr.ulValueLen = template->ulValueLen;
552 (void) memcpy(extra_attr->attr.pValue, template->pValue,
553 template->ulValueLen);
563 * Copy the big integer attribute value from template to a biginteger_t struct.
566 get_bigint_attr_from_template(biginteger_t *big, CK_ATTRIBUTE_PTR template)
569 if ((template->pValue != NULL) &&
570 (template->ulValueLen > 0)) {
572 big->big_value = malloc(template->ulValueLen);
577 (void) memcpy(big->big_value, template->pValue,
578 template->ulValueLen);
579 big->big_value_len = template->ulValueLen;
591 * object to a template.
594 get_bigint_attr_from_object(biginteger_t *big, CK_ATTRIBUTE_PTR template)
597 if (template->pValue == NULL) {
598 template->ulValueLen = big->big_value_len;
603 template->ulValueLen = 0;
607 if (template->ulValueLen >= big->big_value_len) {
612 (void) memcpy(template->pValue, big->big_value,
614 template->ulValueLen = big->big_value_len;
621 template->ulValueLen = (CK_ULONG)-1;
629 * specified attribute to the template.
633 CK_ATTRIBUTE_PTR template)
636 if (template->pValue == NULL) {
637 template->ulValueLen = sizeof (CK_BBOOL);
641 if (template->ulValueLen >= sizeof (CK_BBOOL)) {
647 *((CK_BBOOL *)template->pValue) = B_TRUE;
649 *((CK_BBOOL *)template->pValue) = B_FALSE;
652 template->ulValueLen = sizeof (CK_BBOOL);
659 template->ulValueLen = (CK_ULONG)-1;
669 CK_ATTRIBUTE_PTR template)
672 if (*(CK_BBOOL *)template->pValue)
683 * template.
686 get_ulong_attr_from_object(CK_ULONG value, CK_ATTRIBUTE_PTR template)
689 if (template->pValue == NULL) {
690 template->ulValueLen = sizeof (CK_ULONG);
694 if (template->ulValueLen >= sizeof (CK_ULONG)) {
699 *(CK_ULONG_PTR)template->pValue = value;
700 template->ulValueLen = sizeof (CK_ULONG);
707 template->ulValueLen = (CK_ULONG)-1;
714 * Copy the CK_ULONG data type attribute value from a template to the
718 get_ulong_attr_from_template(CK_ULONG *value, CK_ATTRIBUTE_PTR template)
721 if (template->pValue != NULL) {
722 *value = *(CK_ULONG_PTR)template->pValue;
817 string_attr_cleanup(CK_ATTRIBUTE_PTR template)
820 if (template->pValue) {
821 free(template->pValue);
822 template->pValue = NULL;
823 template->ulValueLen = 0;
954 * value to indicate if the supplied template specifies a valid attribute
958 kernel_parse_common_attrs(CK_ATTRIBUTE_PTR template, kernel_session_t *sp,
965 switch (template->type) {
971 if ((*(CK_BBOOL *)template->pValue) == TRUE) {
977 if ((*(CK_BBOOL *)template->pValue) == TRUE) {
992 if ((*(CK_BBOOL *)template->pValue) == FALSE) {
1013 * - Parse the object's template, and when an error is detected such as
1028 kernel_build_public_key_object(CK_ATTRIBUTE_PTR template,
1076 switch (template[i].type) {
1080 keytype = *((CK_KEY_TYPE*)template[i].pValue);
1094 rv = kernel_add_extra_attr(&template[i],
1112 if (*(CK_BBOOL *)template[i].pValue)
1117 if (*(CK_BBOOL *)template[i].pValue)
1124 if (*(CK_BBOOL *)template[i].pValue)
1131 if (*(CK_BBOOL *)template[i].pValue)
1138 if (*(CK_BBOOL *)template[i].pValue)
1143 if (*(CK_BBOOL *)template[i].pValue)
1155 * Copyin big integer attribute from template
1159 &template[i]);
1167 &template[i]);
1175 &template[i]);
1183 &template[i]);
1191 &template[i]);
1199 &template[i]);
1207 &template[i]);
1213 &template[i]);
1221 &template[i]);
1229 &template[i]);
1235 rv = kernel_parse_common_attrs(&template[i], sp,
1390 * - Parse the object's template, and when an error is detected such as
1405 kernel_build_private_key_object(CK_ATTRIBUTE_PTR template,
1471 switch (template[i].type) {
1475 keytype = *((CK_KEY_TYPE*)template[i].pValue);
1489 rv = kernel_add_extra_attr(&template[i],
1510 if (*(CK_BBOOL *)template[i].pValue)
1515 if (*(CK_BBOOL *)template[i].pValue)
1520 if (*(CK_BBOOL *)template[i].pValue) {
1527 if (*(CK_BBOOL *)template[i].pValue)
1534 if (*(CK_BBOOL *)template[i].pValue)
1541 if (*(CK_BBOOL *)template[i].pValue)
1548 if (*(CK_BBOOL *)template[i].pValue)
1553 if (*(CK_BBOOL *)template[i].pValue)
1567 * Copyin big integer attribute from template
1571 &template[i]);
1579 &template[i]);
1587 &template[i]);
1595 &template[i]);
1603 &template[i]);
1611 &template[i]);
1619 &template[i]);
1627 &template[i]);
1635 &template[i]);
1643 &template[i]);
1651 &template[i]);
1659 &template[i]);
1667 &template[i]);
1673 &template[i]);
1681 &template[i]);
1687 rv = kernel_parse_common_attrs(&template[i], sp,
1875 * - Parse the object's template, and when an error is detected such as
1890 kernel_build_secret_key_object(CK_ATTRIBUTE_PTR template,
1924 switch (template[i].type) {
1928 keytype = *((CK_KEY_TYPE*)template[i].pValue);
1939 rv = kernel_add_extra_attr(&template[i],
1959 if (*(CK_BBOOL *)template[i].pValue)
1964 if (*(CK_BBOOL *)template[i].pValue)
1969 if (*(CK_BBOOL *)template[i].pValue)
1976 if (*(CK_BBOOL *)template[i].pValue)
1983 if (*(CK_BBOOL *)template[i].pValue)
1990 if (*(CK_BBOOL *)template[i].pValue)
1997 if (*(CK_BBOOL *)template[i].pValue)
2002 if (*(CK_BBOOL *)template[i].pValue)
2007 if (*(CK_BBOOL *)template[i].pValue)
2015 if ((template[i].ulValueLen == 0) ||
2016 (template[i].pValue == NULL)) {
2022 * Copyin attribute from template
2025 sck->sk_value = malloc(template[i].ulValueLen);
2030 (void) memcpy(sck->sk_value, template[i].pValue,
2031 template[i].ulValueLen);
2032 sck->sk_value_len = template[i].ulValueLen;
2042 &template[i]);
2048 rv = kernel_parse_common_attrs(&template[i], sp,
2182 * Validate the attribute types in the object's template. Then,
2184 * the object specified in the template.
2192 kernel_build_object(CK_ATTRIBUTE_PTR template, CK_ULONG ulAttrNum,
2199 if (template == NULL) {
2203 /* Validate the attribute type in the template. */
2204 rv = kernel_validate_attr(template, ulAttrNum, &class);
2217 rv = kernel_build_public_key_object(template, ulAttrNum,
2222 rv = kernel_build_private_key_object(template, ulAttrNum,
2227 rv = kernel_build_secret_key_object(template, ulAttrNum,
2249 kernel_get_common_attrs(kernel_object_t *object_p, CK_ATTRIBUTE_PTR template)
2254 switch (template->type) {
2258 template));
2263 template->ulValueLen = sizeof (CK_BBOOL);
2264 if (template->pValue == NULL) {
2272 *((CK_BBOOL *)template->pValue) = B_FALSE;
2277 template->ulValueLen = sizeof (CK_BBOOL);
2278 if (template->pValue == NULL) {
2282 *((CK_BBOOL *)template->pValue) = B_TRUE;
2284 *((CK_BBOOL *)template->pValue) = B_FALSE;
2289 template->ulValueLen = sizeof (CK_BBOOL);
2290 if (template->pValue == NULL) {
2294 *((CK_BBOOL *)template->pValue) = B_TRUE;
2296 *((CK_BBOOL *)template->pValue) = B_FALSE;
2301 template));
2310 template->ulValueLen = (CK_ULONG)-1;
2323 CK_ATTRIBUTE_PTR template)
2326 switch (template->type) {
2330 template));
2339 template));
2344 LOCAL_BOOL_ON, template));
2348 DERIVE_BOOL_ON, template));
2352 template));
2367 CK_ATTRIBUTE_PTR template)
2373 switch (template->type) {
2381 template));
2386 ENCRYPT_BOOL_ON, template));
2390 VERIFY_BOOL_ON, template));
2394 VERIFY_RECOVER_BOOL_ON, template));
2398 WRAP_BOOL_ON, template));
2402 TRUSTED_BOOL_ON, template));
2411 OBJ_PUB_RSA_MOD(object_p), template));
2413 template->ulValueLen = (CK_ULONG)-1;
2420 OBJ_PUB_RSA_PUBEXPO(object_p), template));
2422 template->ulValueLen = (CK_ULONG)-1;
2429 OBJ_PUB_RSA_MOD_BITS(object_p), template));
2431 template->ulValueLen = (CK_ULONG)-1;
2439 OBJ_PUB_DSA_PRIME(object_p), template));
2442 OBJ_PUB_DH_PRIME(object_p), template));
2444 template->ulValueLen = (CK_ULONG)-1;
2452 OBJ_PUB_DSA_SUBPRIME(object_p), template));
2454 template->ulValueLen = (CK_ULONG)-1;
2462 OBJ_PUB_DSA_BASE(object_p), template));
2465 OBJ_PUB_DH_BASE(object_p), template));
2467 template->ulValueLen = (CK_ULONG)-1;
2475 OBJ_PUB_DSA_VALUE(object_p), template));
2478 OBJ_PUB_DH_VALUE(object_p), template));
2480 template->ulValueLen = (CK_ULONG)-1;
2488 OBJ_PUB_EC_POINT(object_p), template));
2490 template->ulValueLen = (CK_ULONG)-1;
2500 rv = kernel_get_common_key_attrs(object_p, template);
2502 rv = kernel_get_common_attrs(object_p, template);
2521 CK_ATTRIBUTE_PTR template)
2536 switch (template->type) {
2544 template->ulValueLen = (CK_ULONG)-1;
2549 switch (template->type) {
2557 template));
2562 SENSITIVE_BOOL_ON, template));
2566 SECONDARY_AUTH_BOOL_ON, template));
2570 DECRYPT_BOOL_ON, template));
2574 SIGN_BOOL_ON, template));
2578 SIGN_RECOVER_BOOL_ON, template));
2582 UNWRAP_BOOL_ON, template));
2586 EXTRACTABLE_BOOL_ON, template));
2590 ALWAYS_SENSITIVE_BOOL_ON, template));
2594 NEVER_EXTRACTABLE_BOOL_ON, template));
2599 OBJ_PRI_RSA_MOD(object_p), template));
2601 template->ulValueLen = (CK_ULONG)-1;
2609 OBJ_PRI_RSA_PUBEXPO(object_p), template));
2611 template->ulValueLen = (CK_ULONG)-1;
2619 OBJ_PRI_RSA_PRIEXPO(object_p), template));
2621 template->ulValueLen = (CK_ULONG)-1;
2629 OBJ_PRI_RSA_PRIME1(object_p), template));
2631 template->ulValueLen = (CK_ULONG)-1;
2639 OBJ_PRI_RSA_PRIME2(object_p), template));
2641 template->ulValueLen = (CK_ULONG)-1;
2649 OBJ_PRI_RSA_EXPO1(object_p), template));
2651 template->ulValueLen = (CK_ULONG)-1;
2659 OBJ_PRI_RSA_EXPO2(object_p), template));
2661 template->ulValueLen = (CK_ULONG)-1;
2669 OBJ_PRI_RSA_COEF(object_p), template));
2671 template->ulValueLen = (CK_ULONG)-1;
2679 OBJ_PRI_DH_VAL_BITS(object_p), template));
2681 template->ulValueLen = (CK_ULONG)-1;
2690 OBJ_PRI_DSA_PRIME(object_p), template));
2693 OBJ_PRI_DH_PRIME(object_p), template));
2695 template->ulValueLen = (CK_ULONG)-1;
2703 OBJ_PRI_DSA_SUBPRIME(object_p), template));
2705 template->ulValueLen = (CK_ULONG)-1;
2713 OBJ_PRI_DSA_BASE(object_p), template));
2716 OBJ_PRI_DH_BASE(object_p), template));
2718 template->ulValueLen = (CK_ULONG)-1;
2726 OBJ_PRI_DSA_VALUE(object_p), template));
2729 OBJ_PRI_DH_VALUE(object_p), template));
2732 OBJ_PRI_EC_VALUE(object_p), template));
2734 template->ulValueLen = (CK_ULONG)-1;
2745 rv = kernel_get_common_key_attrs(object_p, template);
2747 rv = kernel_get_common_attrs(object_p, template);
2766 CK_ATTRIBUTE_PTR template)
2772 switch (template->type) {
2777 SENSITIVE_BOOL_ON, template));
2781 ENCRYPT_BOOL_ON, template));
2785 DECRYPT_BOOL_ON, template));
2789 SIGN_BOOL_ON, template));
2793 VERIFY_BOOL_ON, template));
2797 WRAP_BOOL_ON, template));
2801 UNWRAP_BOOL_ON, template));
2805 EXTRACTABLE_BOOL_ON, template));
2809 ALWAYS_SENSITIVE_BOOL_ON, template));
2813 NEVER_EXTRACTABLE_BOOL_ON, template));
2823 template->ulValueLen = (CK_ULONG)-1;
2838 * Copy secret key object attributes to template.
2840 if (template->pValue == NULL) {
2841 template->ulValueLen =
2847 template->ulValueLen = 0;
2851 if (template->ulValueLen >=
2853 (void) memcpy(template->pValue,
2856 template->ulValueLen =
2860 template->ulValueLen = (CK_ULONG)-1;
2865 template->ulValueLen = (CK_ULONG)-1;
2873 template));
2882 rv = kernel_get_common_key_attrs(object_p, template);
2884 rv = kernel_get_common_attrs(object_p, template);
2903 kernel_get_attribute(kernel_object_t *object_p, CK_ATTRIBUTE_PTR template)
2912 rv = kernel_get_public_key_attribute(object_p, template);
2916 rv = kernel_get_private_key_attribute(object_p, template);
2920 rv = kernel_get_secret_key_attribute(object_p, template);
2929 template->ulValueLen = (CK_ULONG)-1;
2943 CK_ATTRIBUTE_PTR template, boolean_t copy, kernel_session_t *sp)
2949 switch (template->type) {
2957 CKA_LABEL, template));
2961 CKA_ID, template));
2965 CKA_START_DATE, template));
2969 CKA_END_DATE, template));
2973 DERIVE_BOOL_ON, template));
2987 if ((*(CK_BBOOL *)template->pValue) != B_TRUE) {
3001 PRIVATE_BOOL_ON, template);
3009 MODIFIABLE_BOOL_ON, template);
3030 CK_ATTRIBUTE_PTR template, boolean_t copy, kernel_session_t *sp)
3034 switch (template->type) {
3038 CKA_SUBJECT, template));
3042 ENCRYPT_BOOL_ON, template));
3046 VERIFY_BOOL_ON, template));
3050 VERIFY_RECOVER_BOOL_ON, template));
3054 WRAP_BOOL_ON, template));
3076 template, copy, sp));
3096 CK_ATTRIBUTE_PTR template, boolean_t copy, kernel_session_t *sp)
3100 switch (template->type) {
3104 CKA_SUBJECT, template));
3110 if (((*(CK_BBOOL *)template->pValue) == B_FALSE) &&
3115 if (*(CK_BBOOL *)template->pValue)
3121 DECRYPT_BOOL_ON, template));
3125 SIGN_BOOL_ON, template));
3129 SIGN_RECOVER_BOOL_ON, template));
3133 UNWRAP_BOOL_ON, template));
3139 if ((*(CK_BBOOL *)template->pValue) &&
3144 if ((*(CK_BBOOL *)template->pValue) == B_FALSE)
3174 template, copy, sp));
3194 CK_ATTRIBUTE_PTR template, boolean_t copy, kernel_session_t *sp)
3198 switch (template->type) {
3204 if (((*(CK_BBOOL *)template->pValue) == B_FALSE) &&
3209 if (*(CK_BBOOL *)template->pValue)
3215 ENCRYPT_BOOL_ON, template));
3219 DECRYPT_BOOL_ON, template));
3223 SIGN_BOOL_ON, template));
3227 VERIFY_BOOL_ON, template));
3231 WRAP_BOOL_ON, template));
3235 UNWRAP_BOOL_ON, template));
3241 if ((*(CK_BBOOL *)template->pValue) &&
3246 if ((*(CK_BBOOL *)template->pValue) == B_FALSE)
3266 template, copy, sp));
3287 kernel_set_attribute(kernel_object_t *object_p, CK_ATTRIBUTE_PTR template,
3297 rv = kernel_set_public_key_attribute(object_p, template,
3302 rv = kernel_set_private_key_attribute(object_p, template,
3307 rv = kernel_set_secret_key_attribute(object_p, template,
3313 * If the template specifies a value of an attribute
3624 * attributes on template .
3627 * of these attributes are in the template, make a list of classes
3758 CK_ULONG num_pclasses, CK_ATTRIBUTE *template, CK_ULONG num_attr)
3788 tmpl_attr = &(template[i]);
4152 * this case, it only matches the template's
4153 * attribute if the template's value length