@@ -592,6 +592,29 @@ START_TEST(test_wolfBoot_unseal_blob_zeroes_unseal_output)
592592}
593593END_TEST
594594
595+ START_TEST (test_wolfBoot_unseal_blob_rejects_oversized_auth )
596+ {
597+ WOLFTPM2_KEYBLOB blob ;
598+ uint8_t auth [sizeof (((WOLFTPM2_KEYBLOB * )0 )-> handle .auth .buffer ) + 1 ];
599+ uint8_t secret [WOLFBOOT_MAX_SEAL_SZ ];
600+ uint8_t pubkey_hint [WOLFBOOT_SHA_DIGEST_SIZE ] = {0 };
601+ uint8_t policy [sizeof (uint32_t ) + 4 ] = {0 };
602+ int secret_sz ;
603+ int rc ;
604+
605+ memset (& blob , 0 , sizeof (blob ));
606+ memset (auth , 0x88 , sizeof (auth ));
607+ memset (secret , 0 , sizeof (secret ));
608+ secret_sz = (int )sizeof (secret );
609+ current_mode = MOCK_OVERSIZE_PUB ;
610+
611+ rc = wolfBoot_unseal_blob (pubkey_hint , policy , sizeof (policy ), & blob ,
612+ secret , & secret_sz , auth , (int )sizeof (auth ));
613+
614+ ck_assert_int_eq (rc , BAD_FUNC_ARG );
615+ }
616+ END_TEST
617+
595618START_TEST (test_wolfBoot_unseal_blob_rejects_output_larger_than_capacity )
596619{
597620 struct {
@@ -655,6 +678,7 @@ static Suite *tpm_blob_suite(void)
655678 tcase_add_test (tc , test_wolfBoot_read_blob_rejects_oversized_public_area );
656679 tcase_add_test (tc , test_wolfBoot_read_blob_rejects_oversized_private_area );
657680 tcase_add_test (tc , test_wolfBoot_unseal_blob_zeroes_unseal_output );
681+ tcase_add_test (tc , test_wolfBoot_unseal_blob_rejects_oversized_auth );
658682 tcase_add_test (tc , test_wolfBoot_unseal_blob_rejects_output_larger_than_capacity );
659683 suite_add_tcase (s , tc );
660684 return s ;
0 commit comments