load_vfy_boot_ab.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546
  1. /* Copyright Statement:
  2. *
  3. * This software/firmware and related documentation ("MediaTek Software") are
  4. * protected under relevant copyright laws. The information contained herein
  5. * is confidential and proprietary to MediaTek Inc. and/or its licensors.
  6. * Without the prior written permission of MediaTek inc. and/or its licensors,
  7. * any reproduction, modification, use or disclosure of MediaTek Software,
  8. * and information contained herein, in whole or in part, shall be strictly prohibited.
  9. */
  10. /* MediaTek Inc. (C) 2015. All rights reserved.
  11. *
  12. * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
  13. * THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
  14. * RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO RECEIVER ON
  15. * AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
  16. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
  17. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
  18. * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
  19. * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
  20. * SUPPLIED WITH THE MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
  21. * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
  22. * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
  23. * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
  24. * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
  25. * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
  26. * CUMULATIVE LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
  27. * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
  28. * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
  29. * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
  30. */
  31. #include <pal_typedefs.h>
  32. #include <pal_log.h>
  33. #include <platform/verified_boot.h>
  34. #include <platform/boot_mode.h>
  35. #include <platform/mtk_wdt.h>
  36. #include <bootimg.h>
  37. #include <load_vfy_boot.h>
  38. #include <verified_boot_error.h>
  39. #include <verified_boot_common.h>
  40. #include <avb_slot_verify.h>
  41. #include <avb_ops.h>
  42. #include <avb_ab_flow.h>
  43. #include <avb_ab_ops.h>
  44. #include <string.h>
  45. #include <vboot_state.h>
  46. #include <avb_cmdline.h>
  47. #include <libfdt.h>
  48. #include <target.h>
  49. #include <avb_user_verification.h>
  50. #include <bootctrl.h>
  51. #include <bootargs.h>
  52. #include <preload_partition.h>
  53. #include <mt_boot.h>
  54. #include <boot_info.h>
  55. #include <avb_persist.h>
  56. #include <dm_verity_status.h>
  57. #include <avb_RoT.h>
  58. #define KB (1024)
  59. #define MB (1024 * KB)
  60. #define AVB_HEAP_SZ (100 * MB)
  61. #define TMPBUF_SIZE (200)
  62. #define CMDLINE_ROOT_RAM "root=/dev/ram"
  63. #define CMDLINE_ROOT_SYSTEM_COMMON "skip_initramfs ro rootwait init=/init"
  64. extern BOOT_ARGUMENT *g_boot_arg;
  65. extern AvbABOps ab_ops;
  66. unsigned long get_timer(unsigned long base);
  67. void *avb_heap;
  68. uint32_t avb_heap_sz;
  69. static const char *boot_partitions[] = {"boot", NULL};
  70. static const char *recovery_partitions[] = {"recovery", NULL};
  71. static uint32_t boot_partitions_sz = sizeof(boot_partitions) / sizeof(char *) - 1;
  72. static uint32_t recovery_partitions_sz = sizeof(recovery_partitions) / sizeof(char *) - 1;
  73. /* please keep avb_cmdline_attrs and avb_dt_attrs sync since we
  74. * use them for cmdline attrs to dt attrs conversion */
  75. static const char *avb_cmdline_attrs[] = {
  76. "androidboot.vbmeta.hash_alg",
  77. "androidboot.vbmeta.size",
  78. "androidboot.vbmeta.digest",
  79. NULL
  80. };
  81. static const char *avb_dt_attrs[] = {
  82. "vbmeta.hash_alg",
  83. "vbmeta.size",
  84. "vbmeta.digest",
  85. NULL
  86. };
  87. uint32_t __attribute__((weak)) collect_rot_info(AvbSlotVerifyData *slot_data)
  88. {
  89. return 0;
  90. }
  91. static uint32_t preload_partitions(uint32_t bootimg_type)
  92. {
  93. uint32_t ret = 0;
  94. uint32_t i;
  95. /* please add load address to load_addrs[] for new partition */
  96. uint32_t load_addrs[] = {0};
  97. uint32_t load_addrs_sz = sizeof(load_addrs) / sizeof(uint32_t);
  98. if (bootimg_type == BOOTIMG_TYPE_BOOT && load_addrs_sz != boot_partitions_sz)
  99. return 0x1;
  100. else if (bootimg_type == BOOTIMG_TYPE_RECOVERY && load_addrs_sz != recovery_partitions_sz)
  101. return 0x2;
  102. load_addrs[0] = (uint32_t)target_get_scratch_address();
  103. i = 0;
  104. switch (bootimg_type) {
  105. case BOOTIMG_TYPE_BOOT:
  106. case BOOTIMG_TYPE_RECOVERY:
  107. while (boot_partitions[i] != NULL) {
  108. pal_log_err("preloading %s\n", boot_partitions[i]);
  109. ret = preload_partition(boot_partitions[i], load_addrs[i]);
  110. if (ret)
  111. return ret;
  112. i++;
  113. }
  114. break;
  115. default:
  116. break;
  117. }
  118. return ret;
  119. }
  120. static uint32_t record_avb_version(AvbSlotVerifyData *slot_data)
  121. {
  122. uint32_t ret = 0;
  123. #ifdef MTK_SECURITY_ANTI_ROLLBACK
  124. uint32_t i = 0;
  125. uint64_t min_ver = 0;
  126. if (slot_data == NULL) {
  127. ret = AVB_IO_RESULT_ERROR_IO;
  128. goto end;
  129. }
  130. min_ver = slot_data->rollback_indexes[0];
  131. if (min_ver == AVB_VER_INITIAL_VALUE) {
  132. ret = AVB_IO_RESULT_ERROR_OOM;
  133. goto end;
  134. }
  135. /* We do not take recovery image version into consideration here
  136. * since there is no recovery image when AB system is turned on.
  137. */
  138. for (i = 0; i < AVB_MAX_NUMBER_OF_ROLLBACK_INDEX_LOCATIONS; i++) {
  139. pal_log_info("ver(%d) = %llu\n", i, slot_data->rollback_indexes[i]);
  140. if (slot_data->rollback_indexes[i] != AVB_VER_INITIAL_VALUE)
  141. if (slot_data->rollback_indexes[i] < min_ver)
  142. min_ver = slot_data->rollback_indexes[i];
  143. }
  144. pal_log_err("[avb] min_ver = %llu\n", min_ver);
  145. /* update AVB otp field*/
  146. ret = set_avb_otp_ver(AVB_GROUP, (uint32_t)min_ver);
  147. end:
  148. #endif
  149. return ret;
  150. }
  151. static uint32_t boot_authentication(uint32_t bootimg_type)
  152. {
  153. #ifdef MTK_SECURITY_SW_SUPPORT
  154. uint32_t policy_entry_idx = 0;
  155. uint32_t img_auth_required = 0;
  156. if (bootimg_type == BOOTIMG_TYPE_BOOT || bootimg_type == BOOTIMG_TYPE_RECOVERY)
  157. policy_entry_idx = get_policy_entry_idx(boot_partitions[0]);
  158. else {
  159. pal_log_err("[avb] invalid boot image type\n");
  160. return 1;
  161. }
  162. img_auth_required = get_vfy_policy(policy_entry_idx);
  163. pal_log_err("[avb] img_auth_required = %d\n", img_auth_required);
  164. return img_auth_required;
  165. #else
  166. pal_log_err("[avb] img_auth_required = 0\n");
  167. return 0;
  168. #endif
  169. }
  170. static uint32_t avb_cmdline_postprocessing(char *cmdline, void *fdt)
  171. {
  172. uint32_t ret = 0;
  173. uint32_t i = 0;
  174. int nodeoffset;
  175. int fdt_ret = 0;
  176. char fdt_value[MAX_VALUE_SZ + 1] = {0};
  177. /* extract avb parameters from cmdline */
  178. for (i = 0; ; i++) {
  179. if (avb_cmdline_attrs[i] == NULL)
  180. break;
  181. ret = avb_extract_from_cmdline(cmdline,
  182. strlen(cmdline),
  183. avb_cmdline_attrs[i]);
  184. if (ret) {
  185. pal_log_err("[avb] extract %s fails\n", avb_cmdline_attrs[i]);
  186. return -1;
  187. }
  188. }
  189. /* create /firmware/android if it does not exist */
  190. nodeoffset = fdt_path_offset(fdt, "/firmware/android");
  191. if (nodeoffset < 0) {
  192. nodeoffset = fdt_path_offset(fdt, "/firmware");
  193. if (nodeoffset < 0) {
  194. /* Add subnode "firmware" in root */
  195. nodeoffset = fdt_add_subnode(fdt, 0, "firmware");
  196. if (nodeoffset < 0) {
  197. pal_log_err("Warning: can't add firmware node in device tree\n");
  198. return -1;
  199. }
  200. }
  201. /* Add subnode "android" in "/firmware" */
  202. nodeoffset = fdt_add_subnode(fdt, nodeoffset, "android");
  203. if (nodeoffset < 0) {
  204. pal_log_err("Warning: can't add firmware/android node in device tree\n");
  205. return -1;
  206. }
  207. }
  208. /* set cmdline attributes to device tree */
  209. for (i = 0; ; i++) {
  210. if (avb_dt_attrs[i] == NULL)
  211. break;
  212. ret = avb_get_cmdline(avb_cmdline_attrs[i], fdt_value, MAX_VALUE_SZ);
  213. if (ret == STATUS_OK) {
  214. fdt_ret = fdt_setprop_string(fdt, nodeoffset, avb_dt_attrs[i], fdt_value);
  215. if (fdt_ret) {
  216. pal_log_err("Error: can't set property in device tree\n");
  217. return -1;
  218. }
  219. }
  220. /* we allow the case that entry is not found */
  221. if (ret == ERR_AVB_CMDLINE_ENTRY_NOT_FOUND)
  222. ret = STATUS_OK;
  223. }
  224. return ret;
  225. }
  226. static uint32_t boot_post_processing(AvbOps *ops, uint32_t bootimg_type,
  227. AvbSlotVerifyData *slot_data)
  228. {
  229. uint32_t ret = 0;
  230. uint32_t i = 0;
  231. bool out_verification_enabled = true;
  232. #ifndef PRELOAD_PARTITION_SUPPORT
  233. uint32_t boot_load_addr = 0;
  234. #endif
  235. char *part_name = get_bootimg_partition_name(bootimg_type);
  236. char vboot_cmdline_ab[TMPBUF_SIZE] = {0};
  237. if (part_name == NULL)
  238. return AVB_IO_RESULT_ERROR_IO;
  239. if (slot_data == NULL)
  240. return AVB_IO_RESULT_ERROR_IO;
  241. ret = collect_rot_info(slot_data);
  242. if (ret)
  243. return AVB_IO_RESULT_ERROR_IO;
  244. #ifndef PRELOAD_PARTITION_SUPPORT
  245. boot_load_addr = (uint32_t)target_get_scratch_address();
  246. /* relocate boot image from slot data to its target buffer */
  247. for (i = 0; i < slot_data->num_loaded_partitions; i++) {
  248. if (!strcmp(part_name,
  249. slot_data->loaded_partitions[i].partition_name)) {
  250. memcpy((void *)boot_load_addr,
  251. (void *)((uint8_t *)slot_data->loaded_partitions[i].data),
  252. slot_data->loaded_partitions[i].data_size);
  253. break;
  254. }
  255. }
  256. #endif
  257. load_bootinfo_bootimg((void *)boot_load_addr);
  258. prepare_kernel_dtb();
  259. if (i == slot_data->num_loaded_partitions) {
  260. ret = AVB_SLOT_VERIFY_RESULT_ERROR_INVALID_ARGUMENT;
  261. goto end;
  262. }
  263. /* process kernel cmdline */
  264. #ifdef SYSTEM_AS_ROOT
  265. if (bootimg_type == BOOTIMG_TYPE_BOOT) {
  266. cmdline_append(CMDLINE_ROOT_SYSTEM_COMMON);
  267. /* root file system is already in avb slot data when
  268. * BOARD_BUILD_SYSTEM_ROOT_IMAGE is true, so we don't
  269. * have to handle it again here.
  270. */
  271. } else
  272. #endif
  273. cmdline_append(CMDLINE_ROOT_RAM);
  274. if(!avb_user_verification_get(ops, get_suffix(), &out_verification_enabled)) {
  275. pal_log_err("[avb] Fail to get verification state\n");
  276. out_verification_enabled = true;
  277. }
  278. if (out_verification_enabled) {
  279. ret = avb_cmdline_postprocessing(slot_data->cmdline, get_kernel_fdt());
  280. if (ret)
  281. goto end;
  282. }
  283. pal_log_err("[avb] cmdline = %s\n", slot_data->cmdline);
  284. cmdline_append(slot_data->cmdline);
  285. ret = write_persist_value(ops, PERSIST_PART_NAME);
  286. if (ret)
  287. goto end;
  288. snprintf(vboot_cmdline_ab, TMPBUF_SIZE,
  289. "androidboot.slot_suffix=%s androidboot.slot=%s",
  290. get_suffix(), get_suffix() + 1);
  291. cmdline_append(vboot_cmdline_ab);
  292. set_bootimg_loaded(boot_load_addr);
  293. end:
  294. return ret;
  295. }
  296. static uint32_t handle_vboot_state(uint32_t bootimg_type)
  297. {
  298. uint32_t ret = STATUS_OK;
  299. int32_t vboot_state_ret = 0;
  300. /* device should not boot if any error occurs
  301. * in this function
  302. */
  303. /* be careful that error code should not be overriden by
  304. * return value of the following error handling functions.
  305. */
  306. vboot_state_ret = print_boot_state();
  307. if (vboot_state_ret)
  308. return ERR_VB_STATE_PRINT_FAIL;
  309. if (bootimg_type == BOOTIMG_TYPE_BOOT ||
  310. bootimg_type == BOOTIMG_TYPE_RECOVERY)
  311. vboot_state_ret = show_warning(boot_partitions[0]);
  312. else
  313. return ERR_VB_STATE_SHOW_WARNING_FAIL;
  314. if (vboot_state_ret)
  315. return ERR_VB_STATE_SHOW_WARNING_FAIL;
  316. vboot_state_ret = set_boot_state_to_cmdline();
  317. if (vboot_state_ret)
  318. return ERR_VB_STATE_SET_CMDLINE_FAIL;
  319. return ret;
  320. }
  321. int load_vfy_boot(uint32_t bootimg_type, uint32_t addr)
  322. {
  323. int ret = STATUS_OK;
  324. uint32_t img_vfy_time = 0;
  325. AvbSlotVerifyResult avb_ret = AVB_SLOT_VERIFY_RESULT_OK;
  326. AvbSlotVerifyData *slot_data = NULL;
  327. AvbSlotVerifyFlags avb_flag = AVB_SLOT_VERIFY_FLAGS_NONE;
  328. uint32_t lock_state = LKS_DEFAULT;
  329. uint32_t dm_status = 0;
  330. AvbHashtreeErrorMode hashtree_error_mode = AVB_HASHTREE_ERROR_MODE_RESTART_AND_INVALIDATE;
  331. img_vfy_time = get_timer(0);
  332. g_boot_state = BOOT_STATE_RED;
  333. /* heap initialization for avb */
  334. avb_heap_sz = AVB_HEAP_SZ;
  335. pal_log_debug("[avb] avb heap alloc size 0x%x\n", avb_heap_sz);
  336. avb_heap = (void *)(uint32_t)mblock_reserve_ext(&g_boot_arg->mblock_info,
  337. avb_heap_sz,
  338. 4 * KB,
  339. 0xc0000000,
  340. 0,
  341. "avb");
  342. if (avb_heap == 0) {
  343. pal_log_err("[avb] avb heap alloc fails\n");
  344. avb_heap_sz = 0;
  345. return -1;
  346. } else
  347. pal_log_debug("[avb] avb heap alloc 0x%x\n", (uint32_t)avb_heap);
  348. #ifdef MTK_SEC_FASTBOOT_UNLOCK_SUPPORT
  349. #if defined(MTK_DM_VERITY_OFF) || defined(MTK_BUILD_DEFAULT_UNLOCK) || !defined(MTK_SECURITY_SW_SUPPORT)
  350. /* This feature is for test purpose only.
  351. * we unlock device without wiping userdata, which should not
  352. * happen for MP product. We do this because after userdata
  353. * has been wiped, Android will fail to mount userdata and reboot
  354. * to recovery to format userdata, and then reboot. If we always
  355. * wipe userdata in boot process, Android will never get a properly
  356. * formatted userdata.
  357. */
  358. #ifdef MTK_SECURITY_SW_SUPPORT
  359. /* unlock device */
  360. if (sec_set_device_lock(0) != 0) {
  361. ret = ERR_AVB_UNLOCK_DEVICE_FAILED;
  362. goto end;
  363. }
  364. #endif
  365. /* disable verification */
  366. if (avb_user_verification_set(ab_ops.ops, get_suffix(), 0) != true) {
  367. ret = ERR_AVB_SET_VERIFICATION_FAILED;
  368. goto end;
  369. }
  370. #endif
  371. #endif
  372. if (boot_authentication(bootimg_type) == 0)
  373. avb_flag = AVB_SLOT_VERIFY_FLAGS_ALLOW_VERIFICATION_ERROR;
  374. #ifdef PRELOAD_PARTITION_SUPPORT
  375. if (preload_partitions(bootimg_type)) {
  376. avb_ret = AVB_SLOT_VERIFY_RESULT_ERROR_IO;
  377. goto end;
  378. }
  379. #endif
  380. get_dm_verity_status(&dm_status);
  381. if (dm_status)
  382. avb_flag |= AVB_SLOT_VERIFY_FLAGS_RESTART_CAUSED_BY_HASHTREE_CORRUPTION;
  383. get_hash_tree_error_mode((uint32_t *)&hashtree_error_mode);
  384. ret = init_persist_value(ab_ops.ops, PERSIST_PART_NAME, PERSIST_VALUE_OFFSET);
  385. if (ret) {
  386. pal_log_err("init_persist_value ret = 0x%x\n", ret);
  387. goto end;
  388. }
  389. switch (bootimg_type) {
  390. case BOOTIMG_TYPE_BOOT:
  391. case BOOTIMG_TYPE_RECOVERY:
  392. // Both preloader and avb_ab_flow function decrease tries_remaining variable
  393. // when successfully_boot is equal to 0, so it needs to increase tries_remaining
  394. // here.
  395. // Increase tries_remaining only in following three conditions
  396. // 1. tries_remaining < AVB_AB_MAX_TRIES_REMAINING
  397. // 2. tries_remaining > 0
  398. // 3. successful_boot is equal to 0
  399. increase_tries_remaining();
  400. avb_ret = avb_ab_flow(&ab_ops,
  401. boot_partitions,
  402. avb_flag,
  403. hashtree_error_mode,
  404. &slot_data);
  405. if (avb_flag & AVB_SLOT_VERIFY_FLAGS_ALLOW_VERIFICATION_ERROR)
  406. avb_ret = AVB_SLOT_VERIFY_RESULT_OK;
  407. if (avb_ret != AVB_SLOT_VERIFY_RESULT_OK)
  408. goto end;
  409. break;
  410. default:
  411. avb_ret = AVB_SLOT_VERIFY_RESULT_ERROR_INVALID_ARGUMENT;
  412. goto end;
  413. }
  414. if (avb_ret == AVB_SLOT_VERIFY_RESULT_OK) {
  415. ret = boot_post_processing(ab_ops.ops, bootimg_type, slot_data);
  416. if (ret)
  417. goto end;
  418. g_boot_state = BOOT_STATE_GREEN;
  419. #ifdef MTK_SECURITY_YELLOW_STATE_SUPPORT
  420. if (vb_custom_key_exist())
  421. g_boot_state = BOOT_STATE_YELLOW;
  422. #endif
  423. if (boot_authentication(bootimg_type) != 0 &&
  424. g_boot_state == BOOT_STATE_GREEN) {
  425. ret = record_avb_version(slot_data);
  426. if (ret != AVB_IO_RESULT_OK) {
  427. pal_log_err("update avb otp version fail.\n");
  428. ret = AVB_IO_RESULT_OK;
  429. }
  430. }
  431. }
  432. end:
  433. pal_log_err("[avb] boot/recovery vfy time = %d ms\n",
  434. (unsigned int)get_timer(img_vfy_time));
  435. if (slot_data != NULL)
  436. hashtree_error_mode = slot_data->resolved_hashtree_error_mode;
  437. /* After this function call, memory is returned to lk.
  438. * Please avoid using avb_heap after this function call
  439. */
  440. mblock_create(&g_boot_arg->mblock_info,
  441. &g_boot_arg->orig_dram_info,
  442. (uint64_t)(uint32_t)avb_heap & 0xffffffff,
  443. (uint64_t)avb_heap_sz & 0xffffffff);
  444. pal_log_err("[avb] avb_ret = %d\n", avb_ret);
  445. pal_log_err("[avb] ret = %d\n", ret);
  446. /* if device state is "unlocked," override
  447. * boot state with "ORANGE."
  448. */
  449. #ifdef MTK_SECURITY_SW_SUPPORT
  450. ret = get_lock_state(&lock_state);
  451. if (ret == 0 && lock_state == LKS_UNLOCK)
  452. g_boot_state = BOOT_STATE_ORANGE;
  453. #endif
  454. dm_verity_handler((uint32_t)hashtree_error_mode);
  455. ret = (int)handle_vboot_state(bootimg_type);
  456. if (ret != STATUS_OK)
  457. mtk_arch_reset(1);
  458. if (avb_ret != AVB_SLOT_VERIFY_RESULT_OK)
  459. ret = ERR_AVB_VERIFICAITON_FAILED;
  460. return ret;
  461. }