@@ -495,6 +495,23 @@ START_TEST (test_invalid_update_type) {
495495 cleanup_flash ();
496496}
497497
498+ START_TEST (test_invalid_update_auth_type ) {
499+ reset_mock_stats ();
500+ prepare_flash ();
501+ uint16_t word16 = HDR_IMG_TYPE_AUTH_ECC256 | HDR_IMG_TYPE_APP ;
502+ add_payload (PART_BOOT , 1 , TEST_SIZE_SMALL );
503+ add_payload (PART_UPDATE , 2 , TEST_SIZE_SMALL );
504+ ext_flash_unlock ();
505+ ext_flash_write (WOLFBOOT_PARTITION_UPDATE_ADDRESS + 20 , (void * )& word16 , 2 );
506+ ext_flash_lock ();
507+ wolfBoot_update_trigger ();
508+ wolfBoot_start ();
509+ ck_assert (!wolfBoot_panicked );
510+ ck_assert (wolfBoot_staged_ok );
511+ ck_assert (wolfBoot_current_firmware_version () == 1 );
512+ cleanup_flash ();
513+ }
514+
498515START_TEST (test_update_toolarge ) {
499516 uint32_t very_large = WOLFBOOT_PARTITION_SIZE ;
500517 reset_mock_stats ();
@@ -684,6 +701,8 @@ Suite *wolfboot_suite(void)
684701 tcase_create ("Update to older version denied" );
685702 TCase * invalid_update_type =
686703 tcase_create ("Invalid update type" );
704+ TCase * invalid_update_auth_type =
705+ tcase_create ("Invalid update auth type" );
687706 TCase * update_toolarge = tcase_create ("Update too large" );
688707 TCase * invalid_sha = tcase_create ("Invalid SHA digest" );
689708 TCase * emergency_rollback = tcase_create ("Emergency rollback" );
@@ -714,6 +733,7 @@ Suite *wolfboot_suite(void)
714733 tcase_add_test (forward_update_sameversion_denied , test_forward_update_sameversion_denied );
715734 tcase_add_test (update_oldversion_denied , test_update_oldversion_denied );
716735 tcase_add_test (invalid_update_type , test_invalid_update_type );
736+ tcase_add_test (invalid_update_auth_type , test_invalid_update_auth_type );
717737 tcase_add_test (update_toolarge , test_update_toolarge );
718738 tcase_add_test (invalid_sha , test_invalid_sha );
719739 tcase_add_test (emergency_rollback , test_emergency_rollback );
@@ -735,6 +755,7 @@ Suite *wolfboot_suite(void)
735755 suite_add_tcase (s , forward_update_sameversion_denied );
736756 suite_add_tcase (s , update_oldversion_denied );
737757 suite_add_tcase (s , invalid_update_type );
758+ suite_add_tcase (s , invalid_update_auth_type );
738759 suite_add_tcase (s , update_toolarge );
739760 suite_add_tcase (s , invalid_sha );
740761 suite_add_tcase (s , emergency_rollback );
0 commit comments