Lines Matching defs: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 attribute 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));
987 template->ulValueLen = (CK_ULONG)-1;
1000 CK_ATTRIBUTE_PTR template)
1003 switch (template->type) {
1007 template));
1016 template));
1021 LOCAL_BOOL_ON, template));
1025 DERIVE_BOOL_ON, template));
1029 template));
1046 CK_ATTRIBUTE_PTR template)
1052 switch (template->type) {
1057 SENSITIVE_BOOL_ON, template));
1061 ENCRYPT_BOOL_ON, template));
1065 DECRYPT_BOOL_ON, template));
1069 SIGN_BOOL_ON, template));
1073 VERIFY_BOOL_ON, template));
1077 WRAP_BOOL_ON, template));
1081 UNWRAP_BOOL_ON, template));
1085 EXTRACTABLE_BOOL_ON, template));
1089 ALWAYS_SENSITIVE_BOOL_ON, template));
1093 NEVER_EXTRACTABLE_BOOL_ON, template));
1103 template->ulValueLen = (CK_ULONG)-1;
1110 * Copy secret key object attributes to template.
1112 if (template->pValue == NULL) {
1113 template->ulValueLen =
1119 template->ulValueLen = 0;
1123 if (template->ulValueLen >=
1125 (void) memcpy(template->pValue,
1128 template->ulValueLen =
1132 template->ulValueLen = (CK_ULONG)-1;
1145 template->ulValueLen = (CK_ULONG)-1;
1153 template));
1162 rv = kms_get_common_key_attrs(object_p, template);
1164 rv = kms_get_common_attrs(object_p, template);
1180 kms_get_attribute(kms_object_t *object_p, CK_ATTRIBUTE_PTR template)
1188 rv = kms_get_secret_key_attribute(object_p, template);
1199 template->ulValueLen = (CK_ULONG)-1;
1213 CK_ATTRIBUTE_PTR template, boolean_t copy)
1219 switch (template->type) {
1227 CKA_LABEL, template));
1231 CKA_ID, template));
1235 CKA_START_DATE, template));
1239 CKA_END_DATE, template));
1243 DERIVE_BOOL_ON, template));
1257 if ((*(CK_BBOOL *)template->pValue) != B_TRUE) {
1270 PRIVATE_BOOL_ON, template);
1278 MODIFIABLE_BOOL_ON, template);
1298 CK_ATTRIBUTE_PTR template, boolean_t copy)
1302 switch (template->type) {
1308 if (((*(CK_BBOOL *)template->pValue) == B_FALSE) &&
1313 if (*(CK_BBOOL *)template->pValue)
1319 ENCRYPT_BOOL_ON, template));
1323 DECRYPT_BOOL_ON, template));
1327 SIGN_BOOL_ON, template));
1331 VERIFY_BOOL_ON, template));
1335 WRAP_BOOL_ON, template));
1339 UNWRAP_BOOL_ON, template));
1345 if ((*(CK_BBOOL *)template->pValue) &&
1350 if ((*(CK_BBOOL *)template->pValue) == B_FALSE)
1370 template, copy));
1390 kms_set_attribute(kms_object_t *object_p, CK_ATTRIBUTE_PTR template,
1400 rv = kms_set_secret_key_attribute(object_p, template,
1408 * If the template specifies a value of an attribute
1450 * attributes on template.
1453 * of these attributes are in the template, make a list of classes
1508 CK_ULONG num_pclasses, CK_ATTRIBUTE *template, CK_ULONG num_attr)
1537 tmpl_attr = &(template[i]);
1692 * this case, it only matches the template's
1693 * attribute if the template's value length