Lines Matching refs:template

150 kms_validate_attr(CK_ATTRIBUTE_PTR template, CK_ULONG ulAttrNum,
159 switch (template[i].type) {
161 *class = *((CK_OBJECT_CLASS*)template[i].pValue);
175 switch (template[i].type) {
196 rv = kms_lookup_attr(template[i].type);
247 kms_add_extra_attr(CK_ATTRIBUTE_PTR template, kms_object_t *object_p)
259 attrp->attr.type = template->type;
260 attrp->attr.ulValueLen = template->ulValueLen;
262 if ((template->pValue != NULL) &&
263 (template->ulValueLen > 0)) {
265 attrp->attr.pValue = malloc(template->ulValueLen);
271 (void) memcpy(attrp->attr.pValue, template->pValue,
272 template->ulValueLen);
337 * (if the specified attribute type is found), and copy it to a template.
338 * Note the type of the attribute to be copied is specified by the template,
339 * and the storage is pre-allocated for the atrribute value in the template
343 get_extra_attr_from_object(kms_object_t *object_p, CK_ATTRIBUTE_PTR template)
346 CK_ATTRIBUTE_TYPE type = template->type;
362 template->ulValueLen = 0;
369 if (template->pValue == NULL) {
370 template->ulValueLen = extra_attr->attr.ulValueLen;
374 if (template->ulValueLen >= extra_attr->attr.ulValueLen) {
379 (void) memcpy(template->pValue, extra_attr->attr.pValue,
381 template->ulValueLen = extra_attr->attr.ulValueLen;
388 template->ulValueLen = (CK_ULONG)-1;
400 CK_ATTRIBUTE_PTR template)
421 return (kms_add_extra_attr(template, object_p));
425 if ((template->pValue != NULL) &&
426 (template->ulValueLen > 0)) {
427 if (template->ulValueLen > extra_attr->attr.ulValueLen) {
434 extra_attr->attr.pValue = malloc(template->ulValueLen);
441 extra_attr->attr.ulValueLen = template->ulValueLen;
442 (void) memcpy(extra_attr->attr.pValue, template->pValue,
443 template->ulValueLen);
453 * specified attribute to the template.
457 CK_ATTRIBUTE_PTR template)
460 if (template->pValue == NULL) {
461 template->ulValueLen = sizeof (CK_BBOOL);
465 if (template->ulValueLen >= sizeof (CK_BBOOL)) {
471 *((CK_BBOOL *)template->pValue) = B_TRUE;
473 *((CK_BBOOL *)template->pValue) = B_FALSE;
476 template->ulValueLen = sizeof (CK_BBOOL);
483 template->ulValueLen = (CK_ULONG)-1;
493 CK_ATTRIBUTE_PTR template)
496 if (*(CK_BBOOL *)template->pValue)
507 * template.
510 get_ulong_attr_from_object(CK_ULONG value, CK_ATTRIBUTE_PTR template)
513 if (template->pValue == NULL) {
514 template->ulValueLen = sizeof (CK_ULONG);
518 if (template->ulValueLen >= sizeof (CK_ULONG)) {
523 *(CK_ULONG_PTR)template->pValue = value;
524 template->ulValueLen = sizeof (CK_ULONG);
531 template->ulValueLen = (CK_ULONG)-1;
562 string_attr_cleanup(CK_ATTRIBUTE_PTR template)
565 if (template->pValue) {
566 free(template->pValue);
567 template->pValue = NULL;
568 template->ulValueLen = 0;
574 * value to indicate if the supplied template specifies a valid attribute
578 kms_parse_common_attrs(CK_ATTRIBUTE_PTR template, uint64_t *attr_mask_p)
583 switch (template->type) {
587 if ((*(CK_BBOOL *)template->pValue) == TRUE)
592 if ((*(CK_BBOOL *)template->pValue) == TRUE) {
606 if ((*(CK_BBOOL *)template->pValue) == FALSE) {
624 * - Parse the object's template, and when an error is detected such as
639 kms_build_secret_key_object(CK_ATTRIBUTE_PTR template,
659 * template says differently.
679 switch (template[i].type) {
683 keytype = *((CK_KEY_TYPE*)template[i].pValue);
694 rv = kms_add_extra_attr(&template[i],
714 if (*(CK_BBOOL *)template[i].pValue)
719 if (*(CK_BBOOL *)template[i].pValue)
724 if (*(CK_BBOOL *)template[i].pValue)
731 if (*(CK_BBOOL *)template[i].pValue)
738 if (*(CK_BBOOL *)template[i].pValue)
745 if (*(CK_BBOOL *)template[i].pValue)
752 if (*(CK_BBOOL *)template[i].pValue)
757 if (*(CK_BBOOL *)template[i].pValue)
762 if (*(CK_BBOOL *)template[i].pValue)
769 if ((template[i].ulValueLen == 0) ||
770 (template[i].pValue == NULL)) {
775 * Copyin attribute from template
778 sck->sk_value = malloc(template[i].ulValueLen);
783 (void) memcpy(sck->sk_value, template[i].pValue,
784 template[i].ulValueLen);
785 sck->sk_value_len = template[i].ulValueLen;
790 if (template[i].pValue != NULL)
792 *(CK_ULONG_PTR)template[i].pValue;
800 &template[i]);
806 rv = kms_parse_common_attrs(&template[i], &attr_mask);
874 * Validate the attribute types in the object's template. Then,
876 * the object specified in the template.
882 kms_build_object(CK_ATTRIBUTE_PTR template, CK_ULONG ulAttrNum,
888 if (template == NULL) {
892 /* Validate the attribute type in the template. */
893 rv = kms_validate_attr(template, ulAttrNum, &class);
907 rv = kms_build_secret_key_object(template, ulAttrNum,
931 kms_get_common_attrs(kms_object_t *object_p, CK_ATTRIBUTE_PTR template)
936 switch (template->type) {
940 template));
944 template->ulValueLen = sizeof (CK_BBOOL);
945 if (template->pValue == NULL) {
949 *((CK_BBOOL *)template->pValue) = B_FALSE;
954 template->ulValueLen = sizeof (CK_BBOOL);
955 if (template->pValue == NULL) {
959 *((CK_BBOOL *)template->pValue) = B_TRUE;
961 *((CK_BBOOL *)template->pValue) = B_FALSE;
966 template->ulValueLen = sizeof (CK_BBOOL);
967 if (template->pValue == NULL) {
971 *((CK_BBOOL *)template->pValue) = B_TRUE;
973 *((CK_BBOOL *)template->pValue) = B_FALSE;
978 template));
986 template->ulValueLen = (CK_ULONG)-1;
999 CK_ATTRIBUTE_PTR template)
1002 switch (template->type) {
1006 template));
1015 template));
1020 LOCAL_BOOL_ON, template));
1024 DERIVE_BOOL_ON, template));
1028 template));
1045 CK_ATTRIBUTE_PTR template)
1051 switch (template->type) {
1056 SENSITIVE_BOOL_ON, template));
1060 ENCRYPT_BOOL_ON, template));
1064 DECRYPT_BOOL_ON, template));
1068 SIGN_BOOL_ON, template));
1072 VERIFY_BOOL_ON, template));
1076 WRAP_BOOL_ON, template));
1080 UNWRAP_BOOL_ON, template));
1084 EXTRACTABLE_BOOL_ON, template));
1088 ALWAYS_SENSITIVE_BOOL_ON, template));
1092 NEVER_EXTRACTABLE_BOOL_ON, template));
1102 template->ulValueLen = (CK_ULONG)-1;
1109 * Copy secret key object attributes to template.
1111 if (template->pValue == NULL) {
1112 template->ulValueLen =
1118 template->ulValueLen = 0;
1122 if (template->ulValueLen >=
1124 (void) memcpy(template->pValue,
1127 template->ulValueLen =
1131 template->ulValueLen = (CK_ULONG)-1;
1144 template->ulValueLen = (CK_ULONG)-1;
1152 template));
1161 rv = kms_get_common_key_attrs(object_p, template);
1163 rv = kms_get_common_attrs(object_p, template);
1179 kms_get_attribute(kms_object_t *object_p, CK_ATTRIBUTE_PTR template)
1187 rv = kms_get_secret_key_attribute(object_p, template);
1198 template->ulValueLen = (CK_ULONG)-1;
1212 CK_ATTRIBUTE_PTR template, boolean_t copy)
1218 switch (template->type) {
1226 CKA_LABEL, template));
1230 CKA_ID, template));
1234 CKA_START_DATE, template));
1238 CKA_END_DATE, template));
1242 DERIVE_BOOL_ON, template));
1256 if ((*(CK_BBOOL *)template->pValue) != B_TRUE) {
1269 PRIVATE_BOOL_ON, template);
1277 MODIFIABLE_BOOL_ON, template);
1297 CK_ATTRIBUTE_PTR template, boolean_t copy)
1301 switch (template->type) {
1307 if (((*(CK_BBOOL *)template->pValue) == B_FALSE) &&
1312 if (*(CK_BBOOL *)template->pValue)
1318 ENCRYPT_BOOL_ON, template));
1322 DECRYPT_BOOL_ON, template));
1326 SIGN_BOOL_ON, template));
1330 VERIFY_BOOL_ON, template));
1334 WRAP_BOOL_ON, template));
1338 UNWRAP_BOOL_ON, template));
1344 if ((*(CK_BBOOL *)template->pValue) &&
1349 if ((*(CK_BBOOL *)template->pValue) == B_FALSE)
1369 template, copy));
1389 kms_set_attribute(kms_object_t *object_p, CK_ATTRIBUTE_PTR template,
1399 rv = kms_set_secret_key_attribute(object_p, template,
1407 * If the template specifies a value of an attribute
1449 * attributes on template.
1452 * of these attributes are in the template, make a list of classes
1507 CK_ULONG num_pclasses, CK_ATTRIBUTE *template, CK_ULONG num_attr)
1536 tmpl_attr = &(template[i]);
1691 * this case, it only matches the template's
1692 * attribute if the template's value length