Lines Matching full:otp
35 * @brief This struct documents the layout of the CC312 OTP. It documents both
106 * number of zeroes is compared with the actual number in the asset. Due to OTP
286 /* CC312 OTP can only be read / written in 32 bit words. In order to allow in otp_read()
290 * the OTP address), and the offset between the OTP address and that aligned in otp_read()
390 * the OTP in case the zero_count buffer write fails. in otp_write()
395 /* If the buffer is smaller than the OTP item, count the remainder in otp_write()
396 * of the OTP item as well. in otp_write()
407 /* CC312 OTP can only be read / written in 32 bit words. In order to allow in otp_write()
411 * the OTP address), and the offset between the OTP address and that aligned in otp_write()
414 * back to OTP. in otp_write()
473 struct plat_otp_layout_t *otp = get_cc312_otp_ptr(); in check_keys_for_tampering() local
475 err = verify_zero_bits_count(otp->boot_seed, in check_keys_for_tampering()
476 sizeof(otp->boot_seed), in check_keys_for_tampering()
477 (uint8_t*)&otp->boot_seed_zero_bits); in check_keys_for_tampering()
482 err = verify_zero_bits_count(otp->implementation_id, in check_keys_for_tampering()
483 sizeof(otp->implementation_id), in check_keys_for_tampering()
484 (uint8_t*)&otp->implementation_id_zero_bits); in check_keys_for_tampering()
489 err = verify_zero_bits_count(otp->cert_ref, in check_keys_for_tampering()
490 sizeof(otp->cert_ref), in check_keys_for_tampering()
491 (uint8_t*)&otp->cert_ref_zero_bits); in check_keys_for_tampering()
496 err = verify_zero_bits_count(otp->verification_service_url, in check_keys_for_tampering()
497 sizeof(otp->verification_service_url), in check_keys_for_tampering()
498 (uint8_t*)&otp->verification_service_url_zero_bits); in check_keys_for_tampering()
503 err = verify_zero_bits_count(otp->profile_definition, in check_keys_for_tampering()
504 sizeof(otp->profile_definition), in check_keys_for_tampering()
505 (uint8_t*)&otp->profile_definition_zero_bits); in check_keys_for_tampering()
510 err = verify_zero_bits_count(otp->iak_len, in check_keys_for_tampering()
511 sizeof(otp->iak_len), in check_keys_for_tampering()
512 (uint8_t*)&otp->iak_len_zero_bits); in check_keys_for_tampering()
517 err = verify_zero_bits_count(otp->iak_type, in check_keys_for_tampering()
518 sizeof(otp->iak_type), in check_keys_for_tampering()
519 (uint8_t*)&otp->iak_type_zero_bits); in check_keys_for_tampering()
525 err = verify_zero_bits_count(otp->iak_id, in check_keys_for_tampering()
526 sizeof(otp->iak_id), in check_keys_for_tampering()
527 (uint8_t*)&otp->iak_id_zero_bits); in check_keys_for_tampering()
534 err = verify_zero_bits_count(otp->bl2_rotpk[idx], in check_keys_for_tampering()
535 sizeof(otp->bl2_rotpk[idx]), in check_keys_for_tampering()
536 (uint8_t*)&otp->bl2_rotpk_zero_bits[idx]); in check_keys_for_tampering()
544 err = verify_zero_bits_count(otp->secure_debug_pk, in check_keys_for_tampering()
545 sizeof(otp->secure_debug_pk), in check_keys_for_tampering()
546 (uint8_t*)&otp->secure_debug_pk_zero_bits); in check_keys_for_tampering()
552 err = verify_zero_bits_count(otp->bl1_rotpk_0, in check_keys_for_tampering()
553 sizeof(otp->bl1_rotpk_0), in check_keys_for_tampering()
554 (uint8_t*)&otp->bl1_rotpk_0_zero_bits); in check_keys_for_tampering()
560 err = verify_zero_bits_count(otp->bl2_encryption_key, in check_keys_for_tampering()
561 sizeof(otp->bl2_encryption_key), in check_keys_for_tampering()
562 (uint8_t*)&otp->bl2_encryption_key_zero_bits); in check_keys_for_tampering()
567 err = verify_zero_bits_count(otp->bl1_2_image_hash, in check_keys_for_tampering()
568 sizeof(otp->bl1_2_image_hash), in check_keys_for_tampering()
569 (uint8_t*)&otp->bl1_2_image_hash_zero_bits); in check_keys_for_tampering()
574 err = verify_zero_bits_count(otp->bl2_image_hash, in check_keys_for_tampering()
575 sizeof(otp->bl2_image_hash), in check_keys_for_tampering()
576 (uint8_t*)&otp->bl2_image_hash_zero_bits); in check_keys_for_tampering()
633 * OTP is present. ADDR_WIDTH measures the amount of bits that are used to in tfm_plat_otp_init()
665 struct plat_otp_layout_t *otp = get_cc312_otp_ptr(); in tfm_plat_otp_read() local
669 return otp_read(otp->huk, sizeof(otp->huk), out_len, out); in tfm_plat_otp_read()
672 return otp_read(otp->rot_public_key, in tfm_plat_otp_read()
673 sizeof(otp->rot_public_key), out_len, out); in tfm_plat_otp_read()
676 return otp_read(otp->boot_seed, sizeof(otp->boot_seed), out_len, in tfm_plat_otp_read()
681 return otp_read(otp->implementation_id, in tfm_plat_otp_read()
682 sizeof(otp->implementation_id), out_len, out); in tfm_plat_otp_read()
684 return otp_read(otp->cert_ref, sizeof(otp->cert_ref), out_len, in tfm_plat_otp_read()
687 return otp_read(otp->verification_service_url, in tfm_plat_otp_read()
688 sizeof(otp->verification_service_url), out_len, in tfm_plat_otp_read()
691 return otp_read(otp->profile_definition, in tfm_plat_otp_read()
692 sizeof(otp->profile_definition), out_len, out); in tfm_plat_otp_read()
695 return otp_read(otp->iak_len, in tfm_plat_otp_read()
696 sizeof(otp->iak_len), out_len, out); in tfm_plat_otp_read()
698 return otp_read(otp->iak_type, in tfm_plat_otp_read()
699 sizeof(otp->iak_type), out_len, out); in tfm_plat_otp_read()
701 return otp_read(otp->iak_id, in tfm_plat_otp_read()
702 sizeof(otp->iak_id), out_len, out); in tfm_plat_otp_read()
705 return otp_read(otp->bl2_rotpk[0], sizeof(otp->bl2_rotpk[0]), out_len, in tfm_plat_otp_read()
708 return otp_read(otp->bl2_nv_counter[0], in tfm_plat_otp_read()
709 sizeof(otp->bl2_nv_counter[0]), out_len, out); in tfm_plat_otp_read()
712 return otp_read(otp->bl2_rotpk[1], sizeof(otp->bl2_rotpk[1]), out_len, in tfm_plat_otp_read()
715 return otp_read(otp->bl2_nv_counter[1], in tfm_plat_otp_read()
716 sizeof(otp->bl2_nv_counter[1]), out_len, out); in tfm_plat_otp_read()
719 return otp_read(otp->bl2_rotpk[2], sizeof(otp->bl2_rotpk[2]), out_len, in tfm_plat_otp_read()
722 return otp_read(otp->bl2_nv_counter[2], in tfm_plat_otp_read()
723 sizeof(otp->bl2_nv_counter[2]), out_len, out); in tfm_plat_otp_read()
726 return otp_read(otp->bl2_rotpk[3], sizeof(otp->bl2_rotpk[3]), out_len, in tfm_plat_otp_read()
729 return otp_read(otp->bl2_nv_counter[3], in tfm_plat_otp_read()
730 sizeof(otp->bl2_nv_counter[3]), out_len, out); in tfm_plat_otp_read()
734 return otp_read(otp->bl1_rotpk_0, in tfm_plat_otp_read()
735 sizeof(otp->bl1_rotpk_0), out_len, out); in tfm_plat_otp_read()
737 return otp_read(otp->bl1_nv_counter, in tfm_plat_otp_read()
738 sizeof(otp->bl1_nv_counter), out_len, out); in tfm_plat_otp_read()
741 return otp_read(otp->bl2_encryption_key, in tfm_plat_otp_read()
742 sizeof(otp->bl2_encryption_key), out_len, out); in tfm_plat_otp_read()
744 return otp_read(otp->bl1_2_image_hash, in tfm_plat_otp_read()
745 sizeof(otp->bl1_2_image_hash), out_len, out); in tfm_plat_otp_read()
747 return otp_read(otp->bl2_image_hash, in tfm_plat_otp_read()
748 sizeof(otp->bl2_image_hash), out_len, out); in tfm_plat_otp_read()
750 return otp_read(otp->bl1_2_image, in tfm_plat_otp_read()
751 sizeof(otp->bl1_2_image), out_len, out); in tfm_plat_otp_read()
753 return otp_read(otp->bl1_2_image_len, in tfm_plat_otp_read()
754 sizeof(otp->bl1_2_image_len), out_len, out); in tfm_plat_otp_read()
761 return otp_read(otp->ns_nv_counter_0, in tfm_plat_otp_read()
762 sizeof(otp->ns_nv_counter_0), out_len, out); in tfm_plat_otp_read()
766 return otp_read(otp->ns_nv_counter_1, in tfm_plat_otp_read()
767 sizeof(otp->ns_nv_counter_1), out_len, out); in tfm_plat_otp_read()
771 return otp_read(otp->ns_nv_counter_2, in tfm_plat_otp_read()
772 sizeof(otp->ns_nv_counter_2), out_len, out); in tfm_plat_otp_read()
779 return otp_read(otp->secure_debug_pk, in tfm_plat_otp_read()
780 sizeof(otp->secure_debug_pk), out_len, out); in tfm_plat_otp_read()
797 struct plat_otp_layout_t *otp = get_cc312_otp_ptr(); in otp_write_lcs() local
817 err = otp_read(&otp->icv_programmed_flags.huk_zero_bits, in otp_write_lcs()
818 sizeof(otp->icv_programmed_flags.huk_zero_bits), in otp_write_lcs()
830 err = otp_write(&otp->icv_programmed_flags.icv_provisioning_key_zero_bits, in otp_write_lcs()
831 sizeof(otp->icv_programmed_flags.icv_provisioning_key_zero_bits), in otp_write_lcs()
837 err = otp_write(&otp->icv_programmed_flags.icv_code_encryption_key_zero_bits, in otp_write_lcs()
838 sizeof(otp->icv_programmed_flags.icv_code_encryption_key_zero_bits), in otp_write_lcs()
844 err = otp_write(&otp->icv_programmed_flags.icv_rot_public_key_zero_bits, in otp_write_lcs()
845 sizeof(otp->icv_programmed_flags.icv_rot_public_key_zero_bits), in otp_write_lcs()
859 err = otp_read(&otp->oem_programmed_flags.oem_rot_public_key_zero_bits, in otp_write_lcs()
860 sizeof(otp->oem_programmed_flags.oem_rot_public_key_zero_bits), in otp_write_lcs()
872 err = otp_write(&otp->oem_programmed_flags.oem_provisioning_secret_zero_bits, in otp_write_lcs()
873 sizeof(otp->oem_programmed_flags.oem_provisioning_secret_zero_bits), in otp_write_lcs()
879 err = otp_write(&otp->oem_programmed_flags.oem_code_encryption_key_zero_bits, in otp_write_lcs()
880 sizeof(otp->oem_programmed_flags.oem_code_encryption_key_zero_bits), in otp_write_lcs()
896 struct plat_otp_layout_t *otp = get_cc312_otp_ptr(); in tfm_plat_otp_write() local
900 return otp_write(otp->huk, sizeof(otp->huk), in_len, in, in tfm_plat_otp_write()
901 (uint8_t*)&otp->icv_programmed_flags.huk_zero_bits); in tfm_plat_otp_write()
904 return otp_write(otp->rot_public_key, sizeof(otp->rot_public_key), in tfm_plat_otp_write()
906 (uint8_t*)&otp->oem_programmed_flags.oem_rot_public_key_zero_bits); in tfm_plat_otp_write()
909 return otp_write(otp->boot_seed, sizeof(otp->boot_seed), in tfm_plat_otp_write()
910 in_len, in, (uint8_t*)&otp->boot_seed_zero_bits); in tfm_plat_otp_write()
914 return otp_write(otp->implementation_id, in tfm_plat_otp_write()
915 sizeof(otp->implementation_id), in_len, in, in tfm_plat_otp_write()
916 (uint8_t*)&otp->implementation_id_zero_bits); in tfm_plat_otp_write()
918 return otp_write(otp->cert_ref, sizeof(otp->cert_ref), in_len, in tfm_plat_otp_write()
919 in, (uint8_t*)&otp->cert_ref_zero_bits); in tfm_plat_otp_write()
921 return otp_write(otp->verification_service_url, in tfm_plat_otp_write()
922 sizeof(otp->verification_service_url), in_len, in, in tfm_plat_otp_write()
923 (uint8_t*)&otp->verification_service_url_zero_bits); in tfm_plat_otp_write()
925 return otp_write(otp->profile_definition, in tfm_plat_otp_write()
926 sizeof(otp->profile_definition), in_len, in tfm_plat_otp_write()
927 in, (uint8_t*)&otp->profile_definition_zero_bits); in tfm_plat_otp_write()
930 return otp_write(otp->iak_len, in tfm_plat_otp_write()
931 sizeof(otp->iak_len), in_len, in tfm_plat_otp_write()
932 in, (uint8_t*)&otp->iak_len_zero_bits); in tfm_plat_otp_write()
934 return otp_write(otp->iak_type, in tfm_plat_otp_write()
935 sizeof(otp->iak_type), in_len, in tfm_plat_otp_write()
936 in, (uint8_t*)&otp->iak_type_zero_bits); in tfm_plat_otp_write()
938 return otp_write(otp->iak_id, in tfm_plat_otp_write()
939 sizeof(otp->iak_id), in_len, in tfm_plat_otp_write()
940 in, (uint8_t*)&otp->iak_id_zero_bits); in tfm_plat_otp_write()
943 return otp_write(otp->bl2_rotpk[0], sizeof(otp->bl2_rotpk[0]), in_len, in tfm_plat_otp_write()
944 in, (uint8_t*)&otp->bl2_rotpk_zero_bits[0]); in tfm_plat_otp_write()
946 return otp_write(otp->bl2_nv_counter[0], in tfm_plat_otp_write()
947 sizeof(otp->bl2_nv_counter[0]), in_len, in, NULL); in tfm_plat_otp_write()
950 return otp_write(otp->bl2_rotpk[1], sizeof(otp->bl2_rotpk[1]), in_len, in tfm_plat_otp_write()
951 in, (uint8_t*)&otp->bl2_rotpk_zero_bits[1]); in tfm_plat_otp_write()
953 return otp_write(otp->bl2_nv_counter[1], in tfm_plat_otp_write()
954 sizeof(otp->bl2_nv_counter[1]), in_len, in, NULL); in tfm_plat_otp_write()
957 return otp_write(otp->bl2_rotpk[2], sizeof(otp->bl2_rotpk[2]), in_len, in tfm_plat_otp_write()
958 in, (uint8_t*)&otp->bl2_rotpk_zero_bits[2]); in tfm_plat_otp_write()
960 return otp_write(otp->bl2_nv_counter[2], in tfm_plat_otp_write()
961 sizeof(otp->bl2_nv_counter[2]), in_len, in, NULL); in tfm_plat_otp_write()
964 return otp_write(otp->bl2_rotpk[3], sizeof(otp->bl2_rotpk[3]), in_len, in tfm_plat_otp_write()
965 in, (uint8_t*)&otp->bl2_rotpk_zero_bits[3]); in tfm_plat_otp_write()
967 return otp_write(otp->bl2_nv_counter[3], in tfm_plat_otp_write()
968 sizeof(otp->bl2_nv_counter[3]), in_len, in, NULL); in tfm_plat_otp_write()
972 return otp_write(otp->bl1_rotpk_0, sizeof(otp->bl1_rotpk_0), in_len, in, in tfm_plat_otp_write()
973 (uint8_t*)&otp->bl1_rotpk_0_zero_bits); in tfm_plat_otp_write()
975 return otp_write(otp->bl1_nv_counter, in tfm_plat_otp_write()
976 sizeof(otp->bl1_nv_counter), in_len, in, NULL); in tfm_plat_otp_write()
979 return otp_write(otp->bl2_encryption_key, in tfm_plat_otp_write()
980 sizeof(otp->bl2_encryption_key), in_len, in, in tfm_plat_otp_write()
981 (uint8_t*)&otp->bl2_encryption_key_zero_bits); in tfm_plat_otp_write()
983 return otp_write(otp->bl1_2_image_hash, in tfm_plat_otp_write()
984 sizeof(otp->bl1_2_image_hash), in_len, in, in tfm_plat_otp_write()
985 (uint8_t*)&otp->bl1_2_image_hash_zero_bits); in tfm_plat_otp_write()
987 return otp_write(otp->bl2_image_hash, in tfm_plat_otp_write()
988 sizeof(otp->bl2_image_hash), in_len, in, in tfm_plat_otp_write()
989 (uint8_t*)&otp->bl2_image_hash_zero_bits); in tfm_plat_otp_write()
991 return otp_write(otp->bl1_2_image, in tfm_plat_otp_write()
992 sizeof(otp->bl1_2_image), in_len, in, NULL); in tfm_plat_otp_write()
994 return otp_write(otp->bl1_2_image_len, in tfm_plat_otp_write()
995 sizeof(otp->bl1_2_image_len), in_len, in, NULL); in tfm_plat_otp_write()
1002 return otp_write(otp->ns_nv_counter_0, in tfm_plat_otp_write()
1003 sizeof(otp->ns_nv_counter_0), in_len, in, NULL); in tfm_plat_otp_write()
1007 return otp_write(otp->ns_nv_counter_1, in tfm_plat_otp_write()
1008 sizeof(otp->ns_nv_counter_1), in_len, in, NULL); in tfm_plat_otp_write()
1012 return otp_write(otp->ns_nv_counter_2, in tfm_plat_otp_write()
1013 sizeof(otp->ns_nv_counter_2), in_len, in, NULL); in tfm_plat_otp_write()
1020 return otp_write(otp->secure_debug_pk, in tfm_plat_otp_write()
1021 sizeof(otp->secure_debug_pk), in_len, in, in tfm_plat_otp_write()
1022 (uint8_t*)&otp->secure_debug_pk_zero_bits); in tfm_plat_otp_write()
1033 struct plat_otp_layout_t *otp = get_cc312_otp_ptr(); in tfm_plat_otp_get_size() local
1037 *size = sizeof(otp->huk); in tfm_plat_otp_get_size()
1041 *size = sizeof(otp->rot_public_key); in tfm_plat_otp_get_size()
1045 *size = sizeof(otp->boot_seed); in tfm_plat_otp_get_size()
1051 *size = sizeof(otp->implementation_id); in tfm_plat_otp_get_size()
1054 *size = sizeof(otp->cert_ref); in tfm_plat_otp_get_size()
1057 *size = sizeof(otp->verification_service_url); in tfm_plat_otp_get_size()
1060 *size = sizeof(otp->profile_definition); in tfm_plat_otp_get_size()
1064 *size = sizeof(otp->iak_len); in tfm_plat_otp_get_size()
1067 *size = sizeof(otp->iak_type); in tfm_plat_otp_get_size()
1070 *size = sizeof(otp->iak_id); in tfm_plat_otp_get_size()
1074 *size = sizeof(otp->bl2_rotpk[0]); in tfm_plat_otp_get_size()
1077 *size = sizeof(otp->bl2_nv_counter[0]); in tfm_plat_otp_get_size()
1081 *size = sizeof(otp->bl2_rotpk[1]); in tfm_plat_otp_get_size()
1084 *size = sizeof(otp->bl2_nv_counter[1]); in tfm_plat_otp_get_size()
1088 *size = sizeof(otp->bl2_rotpk[2]); in tfm_plat_otp_get_size()
1091 *size = sizeof(otp->bl2_nv_counter[2]); in tfm_plat_otp_get_size()
1095 *size = sizeof(otp->bl2_rotpk[3]); in tfm_plat_otp_get_size()
1098 *size = sizeof(otp->bl2_nv_counter[3]); in tfm_plat_otp_get_size()
1103 *size = sizeof(otp->bl1_rotpk_0); in tfm_plat_otp_get_size()
1106 *size = sizeof(otp->bl1_nv_counter); in tfm_plat_otp_get_size()
1110 *size = sizeof(otp->bl2_encryption_key); in tfm_plat_otp_get_size()
1113 *size = sizeof(otp->bl1_2_image_hash); in tfm_plat_otp_get_size()
1116 *size = sizeof(otp->bl2_image_hash); in tfm_plat_otp_get_size()
1119 *size = sizeof(otp->bl1_2_image); in tfm_plat_otp_get_size()
1126 *size = sizeof(otp->ns_nv_counter_0); in tfm_plat_otp_get_size()
1131 *size = sizeof(otp->ns_nv_counter_1); in tfm_plat_otp_get_size()
1136 *size = sizeof(otp->ns_nv_counter_2); in tfm_plat_otp_get_size()
1144 *size = sizeof(otp->secure_debug_pk); in tfm_plat_otp_get_size()