Lines Matching refs:rc

197 	enum pkcs11_rc rc = PKCS11_CKR_OK;  in pkcs11_import_object_boolprop()  local
202 rc = get_attribute(templ, attribute, &bbool, &size); in pkcs11_import_object_boolprop()
203 if (rc) { in pkcs11_import_object_boolprop()
204 if (rc != PKCS11_RV_NOT_FOUND) in pkcs11_import_object_boolprop()
205 return rc; in pkcs11_import_object_boolprop()
222 enum pkcs11_rc rc = PKCS11_CKR_OK; in set_mandatory_boolprops() local
226 rc = pkcs11_import_object_boolprop(out, temp, bp[n]); in set_mandatory_boolprops()
227 if (rc) in set_mandatory_boolprops()
228 return rc; in set_mandatory_boolprops()
231 return rc; in set_mandatory_boolprops()
239 enum pkcs11_rc rc = PKCS11_CKR_OK; in set_mandatory_attributes() local
249 rc = add_attribute(out, attrs[n], value, size); in set_mandatory_attributes()
250 if (rc) in set_mandatory_attributes()
251 return rc; in set_mandatory_attributes()
254 return rc; in set_mandatory_attributes()
275 enum pkcs11_rc rc = PKCS11_CKR_OK; in set_optional_attributes_with_def() local
282 rc = get_attribute_ptr(temp, attrs[n], &value, &size); in set_optional_attributes_with_def()
283 if (rc == PKCS11_RV_NOT_FOUND) { in set_optional_attributes_with_def()
285 rc = get_default_value(attrs[n], &value, &size); in set_optional_attributes_with_def()
287 rc = PKCS11_CKR_OK; in set_optional_attributes_with_def()
291 if (rc) in set_optional_attributes_with_def()
292 return rc; in set_optional_attributes_with_def()
294 rc = add_attribute(out, attrs[n], value, size); in set_optional_attributes_with_def()
295 if (rc) in set_optional_attributes_with_def()
296 return rc; in set_optional_attributes_with_def()
299 return rc; in set_optional_attributes_with_def()
477 enum pkcs11_rc rc = PKCS11_CKR_OK; in create_storage_attributes() local
479 rc = init_attributes_head(out); in create_storage_attributes()
480 if (rc) in create_storage_attributes()
481 return rc; in create_storage_attributes()
490 rc = add_attribute(out, PKCS11_CKA_CLASS, &class, sizeof(uint32_t)); in create_storage_attributes()
491 if (rc) in create_storage_attributes()
492 return rc; in create_storage_attributes()
494 rc = set_mandatory_boolprops(out, temp, any_object_boolprops, in create_storage_attributes()
496 if (rc) in create_storage_attributes()
497 return rc; in create_storage_attributes()
507 enum pkcs11_rc rc = PKCS11_CKR_OK; in create_genkey_attributes() local
509 rc = create_storage_attributes(out, temp); in create_genkey_attributes()
510 if (rc) in create_genkey_attributes()
511 return rc; in create_genkey_attributes()
519 rc = add_attribute(out, PKCS11_CKA_KEY_TYPE, &type, sizeof(uint32_t)); in create_genkey_attributes()
520 if (rc) in create_genkey_attributes()
521 return rc; in create_genkey_attributes()
523 rc = set_mandatory_boolprops(out, temp, any_key_boolprops, in create_genkey_attributes()
525 if (rc) in create_genkey_attributes()
526 return rc; in create_genkey_attributes()
528 rc = set_attributes_opt_or_null(out, temp, any_key_opt_or_null, in create_genkey_attributes()
530 if (rc) in create_genkey_attributes()
531 return rc; in create_genkey_attributes()
541 enum pkcs11_rc rc = PKCS11_CKR_OK; in create_symm_key_attributes() local
545 rc = create_genkey_attributes(out, temp); in create_symm_key_attributes()
546 if (rc) in create_symm_key_attributes()
547 return rc; in create_symm_key_attributes()
568 rc = set_mandatory_boolprops(out, temp, symm_key_boolprops, in create_symm_key_attributes()
570 if (rc) in create_symm_key_attributes()
571 return rc; in create_symm_key_attributes()
573 rc = set_attributes_opt_or_null(out, temp, symm_key_opt_or_null, in create_symm_key_attributes()
575 if (rc) in create_symm_key_attributes()
576 return rc; in create_symm_key_attributes()
585 enum pkcs11_rc rc = PKCS11_CKR_OK; in create_data_attributes() local
589 rc = create_storage_attributes(out, temp); in create_data_attributes()
590 if (rc) in create_data_attributes()
591 return rc; in create_data_attributes()
612 enum pkcs11_rc rc = PKCS11_CKR_OK; in create_certificate_attributes() local
616 rc = create_storage_attributes(out, temp); in create_certificate_attributes()
617 if (rc) in create_certificate_attributes()
618 return rc; in create_certificate_attributes()
622 rc = set_mandatory_boolprops(out, temp, pkcs11_certificate_boolprops, in create_certificate_attributes()
624 if (rc) in create_certificate_attributes()
625 return rc; in create_certificate_attributes()
627 rc = set_mandatory_attributes(out, temp, pkcs11_certificate_mandated, in create_certificate_attributes()
629 if (rc) in create_certificate_attributes()
630 return rc; in create_certificate_attributes()
632 rc = set_optional_attributes(out, temp, pkcs11_certificate_optional, in create_certificate_attributes()
634 if (rc) in create_certificate_attributes()
635 return rc; in create_certificate_attributes()
652 rc = set_mandatory_attributes(out, temp, mandated, mandated_count); in create_certificate_attributes()
653 if (rc) in create_certificate_attributes()
654 return rc; in create_certificate_attributes()
656 rc = set_optional_attributes(out, temp, optional, optional_count); in create_certificate_attributes()
657 if (rc) in create_certificate_attributes()
658 return rc; in create_certificate_attributes()
661 rc = get_attribute_ptr(*out, PKCS11_CKA_CERTIFICATE_CATEGORY, in create_certificate_attributes()
663 if (rc == PKCS11_CKR_OK && attr_size == sizeof(cert_category)) { in create_certificate_attributes()
679 } else if (rc == PKCS11_RV_NOT_FOUND) { in create_certificate_attributes()
681 rc = set_attribute(out, PKCS11_CKA_CERTIFICATE_CATEGORY, in create_certificate_attributes()
684 if (rc) in create_certificate_attributes()
685 return rc; in create_certificate_attributes()
694 rc = get_attribute_ptr(*out, PKCS11_CKA_NAME_HASH_ALGORITHM, NULL, in create_certificate_attributes()
696 if (rc == PKCS11_CKR_OK && attr_size == sizeof(uint32_t)) { in create_certificate_attributes()
698 } else if (rc == PKCS11_RV_NOT_FOUND) { in create_certificate_attributes()
700 rc = set_attribute(out, PKCS11_CKA_NAME_HASH_ALGORITHM, in create_certificate_attributes()
703 if (rc) in create_certificate_attributes()
704 return rc; in create_certificate_attributes()
712 return rc; in create_certificate_attributes()
723 enum pkcs11_rc rc = PKCS11_CKR_OK; in create_pub_key_attributes() local
727 rc = create_genkey_attributes(out, temp); in create_pub_key_attributes()
728 if (rc) in create_pub_key_attributes()
729 return rc; in create_pub_key_attributes()
733 rc = set_mandatory_boolprops(out, temp, public_key_boolprops, in create_pub_key_attributes()
735 if (rc) in create_pub_key_attributes()
736 return rc; in create_pub_key_attributes()
738 rc = set_mandatory_attributes(out, temp, public_key_mandated, in create_pub_key_attributes()
740 if (rc) in create_pub_key_attributes()
741 return rc; in create_pub_key_attributes()
743 rc = set_attributes_opt_or_null(out, temp, in create_pub_key_attributes()
746 if (rc) in create_pub_key_attributes()
747 return rc; in create_pub_key_attributes()
782 rc = set_mandatory_attributes(out, temp, mandated, mandated_count); in create_pub_key_attributes()
783 if (rc) in create_pub_key_attributes()
784 return rc; in create_pub_key_attributes()
796 enum pkcs11_rc rc = PKCS11_CKR_OK; in create_priv_key_attributes() local
800 rc = create_genkey_attributes(out, temp); in create_priv_key_attributes()
801 if (rc) in create_priv_key_attributes()
802 return rc; in create_priv_key_attributes()
806 rc = set_mandatory_boolprops(out, temp, private_key_boolprops, in create_priv_key_attributes()
808 if (rc) in create_priv_key_attributes()
809 return rc; in create_priv_key_attributes()
811 rc = set_mandatory_attributes(out, temp, private_key_mandated, in create_priv_key_attributes()
813 if (rc) in create_priv_key_attributes()
814 return rc; in create_priv_key_attributes()
816 rc = set_attributes_opt_or_null(out, temp, private_key_opt_or_null, in create_priv_key_attributes()
818 if (rc) in create_priv_key_attributes()
819 return rc; in create_priv_key_attributes()
839 rc = set_mandatory_attributes(out, temp, mandated, mandated_count); in create_priv_key_attributes()
840 if (rc) in create_priv_key_attributes()
841 return rc; in create_priv_key_attributes()
850 enum pkcs11_rc rc = PKCS11_CKR_OK; in sanitize_symm_key_attributes() local
855 rc = get_attribute_ptr(*temp, PKCS11_CKA_VALUE, NULL, &a_size); in sanitize_symm_key_attributes()
869 if (rc || a_size == 0) in sanitize_symm_key_attributes()
879 if (rc != PKCS11_RV_NOT_FOUND) in sanitize_symm_key_attributes()
924 enum pkcs11_rc rc = PKCS11_CKR_OK; in create_attributes_from_template() local
998 rc = sanitize_client_object(&temp, template, template_size, class, in create_attributes_from_template()
1000 if (rc) in create_attributes_from_template()
1012 return rc; in create_attributes_from_template()
1020 rc = get_attribute_ptr(parent, indirect_template, in create_attributes_from_template()
1022 if (rc == PKCS11_CKR_OK && size != 0) { in create_attributes_from_template()
1023 rc = attributes_match_add_reference(&temp, req_attrs); in create_attributes_from_template()
1024 if (rc) in create_attributes_from_template()
1039 rc = PKCS11_CKR_TEMPLATE_INCONSISTENT; in create_attributes_from_template()
1046 rc = PKCS11_CKR_TEMPLATE_INCONSISTENT; in create_attributes_from_template()
1054 rc = PKCS11_CKR_TEMPLATE_INCONSISTENT; in create_attributes_from_template()
1062 rc = PKCS11_CKR_TEMPLATE_INCONSISTENT; in create_attributes_from_template()
1072 rc = PKCS11_CKR_TEMPLATE_INCONSISTENT; in create_attributes_from_template()
1086 rc = create_data_attributes(&attrs, temp); in create_attributes_from_template()
1089 rc = create_certificate_attributes(&attrs, temp); in create_attributes_from_template()
1092 rc = sanitize_symm_key_attributes(&temp, function); in create_attributes_from_template()
1093 if (rc) in create_attributes_from_template()
1095 rc = create_symm_key_attributes(&attrs, temp); in create_attributes_from_template()
1098 rc = create_pub_key_attributes(&attrs, temp, function); in create_attributes_from_template()
1101 rc = create_priv_key_attributes(&attrs, temp); in create_attributes_from_template()
1107 rc = PKCS11_CKR_TEMPLATE_INCONSISTENT; in create_attributes_from_template()
1110 if (rc) in create_attributes_from_template()
1115 rc = PKCS11_CKR_TEMPLATE_INCONSISTENT; in create_attributes_from_template()
1121 rc = PKCS11_CKR_TEMPLATE_INCONSISTENT; in create_attributes_from_template()
1137 rc = add_attribute(&attrs, PKCS11_CKA_LOCAL, &local, sizeof(local)); in create_attributes_from_template()
1138 if (rc) in create_attributes_from_template()
1170 rc = set_attribute(&attrs, in create_attributes_from_template()
1174 if (rc) in create_attributes_from_template()
1189 rc = add_attribute(&attrs, PKCS11_CKA_ALWAYS_SENSITIVE, in create_attributes_from_template()
1191 if (rc) in create_attributes_from_template()
1194 rc = add_attribute(&attrs, PKCS11_CKA_NEVER_EXTRACTABLE, in create_attributes_from_template()
1196 if (rc) in create_attributes_from_template()
1205 rc = add_attribute(&attrs, PKCS11_CKA_KEY_GEN_MECHANISM, in create_attributes_from_template()
1207 if (rc) in create_attributes_from_template()
1223 if (rc) in create_attributes_from_template()
1226 return rc; in create_attributes_from_template()
1308 enum pkcs11_rc rc = PKCS11_CKR_OK; in check_created_attrs_against_token() local
1310 rc = check_attrs_misc_integrity(head); in check_created_attrs_against_token()
1311 if (rc) in check_created_attrs_against_token()
1312 return rc; in check_created_attrs_against_token()
1464 enum pkcs11_rc rc = PKCS11_CKR_OK; in check_created_attrs() local
1524 rc = get_u32_attribute(secret, PKCS11_CKA_VALUE_LEN, in check_created_attrs()
1526 if (rc) in check_created_attrs()
1533 rc = get_u32_attribute(public, PKCS11_CKA_MODULUS_BITS, in check_created_attrs()
1535 if (rc) in check_created_attrs()
1590 enum pkcs11_rc rc = PKCS11_CKR_GENERAL_ERROR; in parent_key_complies_allowed_processings() local
1592 rc = get_attribute_ptr(head, PKCS11_CKA_ALLOWED_MECHANISMS, in parent_key_complies_allowed_processings()
1594 if (rc == PKCS11_RV_NOT_FOUND) in parent_key_complies_allowed_processings()
1596 if (rc) { in parent_key_complies_allowed_processings()
1814 enum pkcs11_rc rc = PKCS11_CKR_GENERAL_ERROR; in attribute_is_exportable() local
1830 rc = get_attribute(obj->attributes, PKCS11_CKA_EXTRACTABLE, in attribute_is_exportable()
1832 if (rc || boolval == PKCS11_FALSE) in attribute_is_exportable()
1836 rc = get_attribute(obj->attributes, PKCS11_CKA_SENSITIVE, in attribute_is_exportable()
1838 if (rc || boolval == PKCS11_TRUE) in attribute_is_exportable()
1952 enum pkcs11_rc rc = PKCS11_CKR_GENERAL_ERROR; in attr_is_modifiable_certificate() local
1955 rc = get_attribute(obj->attributes, PKCS11_CKA_TRUSTED, in attr_is_modifiable_certificate()
1957 if (rc || boolval == PKCS11_TRUE) in attr_is_modifiable_certificate()
2145 enum pkcs11_rc rc = PKCS11_CKR_GENERAL_ERROR; in set_secret_key_data() local
2148 rc = get_attribute(*head, PKCS11_CKA_VALUE_LEN, &key_length, &size); in set_secret_key_data()
2149 if (rc && rc != PKCS11_RV_NOT_FOUND) in set_secret_key_data()
2150 return rc; in set_secret_key_data()
2157 rc = set_attribute(head, PKCS11_CKA_VALUE_LEN, &key_length, in set_secret_key_data()
2159 if (rc) in set_secret_key_data()
2160 return rc; in set_secret_key_data()
2164 rc = check_created_attrs(*head, NULL); in set_secret_key_data()
2165 if (rc) in set_secret_key_data()
2166 return rc; in set_secret_key_data()
2169 rc = remove_empty_attribute(head, PKCS11_CKA_VALUE); in set_secret_key_data()
2170 if (rc != PKCS11_CKR_OK && rc != PKCS11_RV_NOT_FOUND) in set_secret_key_data()
2205 enum pkcs11_rc rc = PKCS11_CKR_GENERAL_ERROR; in add_missing_attribute_id() local
2214 rc = get_attribute_ptr(*pub_head, PKCS11_CKA_ID, &id1, &id1_size); in add_missing_attribute_id()
2215 if (rc) { in add_missing_attribute_id()
2216 if (rc != PKCS11_RV_NOT_FOUND) in add_missing_attribute_id()
2217 return rc; in add_missing_attribute_id()
2223 rc = get_attribute_ptr(*priv_head, PKCS11_CKA_ID, &id2, &id2_size); in add_missing_attribute_id()
2224 if (rc) { in add_missing_attribute_id()
2225 if (rc != PKCS11_RV_NOT_FOUND) in add_missing_attribute_id()
2226 return rc; in add_missing_attribute_id()