diff --git a/test/test_acvp.c b/test/test_acvp.c index 20d01c19..c586742d 100644 --- a/test/test_acvp.c +++ b/test/test_acvp.c @@ -773,10 +773,10 @@ Test(PROCESS_TESTS, mark_as_get_only, .init = setup_full_ctx, .fini = teardown) rv = acvp_mark_as_get_only(ctx, "", NULL); cr_assert(rv == ACVP_INVALID_ARG); - rv = acvp_mark_as_get_only(ctx, "testFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLong", NULL); + rv = acvp_mark_as_get_only(ctx, ACVP_TEST_STRING_TOO_LONG, NULL); cr_assert(rv == ACVP_INVALID_ARG); - rv = acvp_mark_as_get_only(ctx, "test", "testFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLong"); + rv = acvp_mark_as_get_only(ctx, "test", ACVP_TEST_STRING_TOO_LONG); cr_assert(rv == ACVP_INVALID_ARG); rv = acvp_mark_as_get_only(ctx, "test", ""); @@ -797,7 +797,7 @@ Test(PROCESS_TESTS, mark_as_delete_only, .init = setup_full_ctx, .fini = teardow rv = acvp_mark_as_delete_only(ctx, "test"); cr_assert(rv == ACVP_SUCCESS); - rv = acvp_mark_as_delete_only(ctx, "testFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLong"); + rv = acvp_mark_as_delete_only(ctx, ACVP_TEST_STRING_TOO_LONG); cr_assert(rv == ACVP_INVALID_ARG); rv = acvp_mark_as_delete_only(ctx, ""); @@ -844,8 +844,8 @@ Test(PROCESS_TESTS, acvp_get_results_from_server, .init = setup_full_ctx, .fini rv = acvp_get_results_from_server(ctx, NULL); cr_assert(rv == ACVP_MISSING_ARG); - rv = acvp_get_results_from_server(ctx, "testFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLong"); - cr_assert(rv == ACVP_INVALID_ARG); + rv = acvp_get_results_from_server(ctx, ACVP_TEST_STRING_TOO_LONG); + cr_assert(rv == ACVP_INVALID_ARG); rv = acvp_get_results_from_server(ctx, "json/getResults.json"); cr_assert(rv = ACVP_MALFORMED_JSON); @@ -862,7 +862,7 @@ Test(PROCESS_TESTS, acvp_resume_test_session, .init = setup_full_ctx, .fini = te rv = acvp_resume_test_session(ctx, NULL, 0); cr_assert(rv == ACVP_MISSING_ARG); - rv = acvp_resume_test_session(ctx, "testFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLong", 0); + rv = acvp_resume_test_session(ctx, ACVP_TEST_STRING_TOO_LONG, 0); cr_assert(rv == ACVP_INVALID_ARG); rv = acvp_resume_test_session(ctx, "json/getResults.json", 1); @@ -880,10 +880,10 @@ Test(PROCESS_TESTS, acvp_cancel_test_session, .init = setup_full_ctx, .fini = te rv = acvp_cancel_test_session(ctx, NULL, "test"); cr_assert(rv == ACVP_MISSING_ARG); - rv = acvp_cancel_test_session(ctx, "testRequestUrlTooLongtestRequestUrlTooLongtestRequestUrlTooLongtestRequestUrlTooLongtestRequestUrlTooLongtestRequestUrlTooLongtestRequestUrlTooLongtestRequestUrlTooLongtestRequestUrlTooLong", NULL); + rv = acvp_cancel_test_session(ctx, ACVP_TEST_STRING_TOO_LONG, NULL); cr_assert(rv == ACVP_INVALID_ARG); - rv = acvp_cancel_test_session(ctx, "test", "testFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLong"); + rv = acvp_cancel_test_session(ctx, "test", ACVP_TEST_STRING_TOO_LONG); cr_assert(rv == ACVP_INVALID_ARG); rv = acvp_cancel_test_session(ctx, "", "test"); @@ -912,10 +912,10 @@ Test(PROCESS_TESTS, acvp_get_expected_results, .init = setup_full_ctx, .fini = t rv = acvp_get_expected_results(ctx, NULL, NULL); cr_assert(rv == ACVP_MISSING_ARG); - rv = acvp_get_expected_results(ctx, "testFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLong", NULL); + rv = acvp_get_expected_results(ctx, ACVP_TEST_STRING_TOO_LONG, NULL); cr_assert(rv == ACVP_INVALID_ARG); rv = acvp_get_expected_results(ctx, "json/testSession_0.json", \ - "testFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLongtestFileNameTooLong"); + ACVP_TEST_STRING_TOO_LONG); cr_assert(rv == ACVP_INVALID_ARG); rv = acvp_get_expected_results(ctx, "json/getResults.json", NULL); diff --git a/test/test_acvp_capabilities.c b/test/test_acvp_capabilities.c index 354a80cb..774452ab 100644 --- a/test/test_acvp_capabilities.c +++ b/test/test_acvp_capabilities.c @@ -826,7 +826,7 @@ Test(EnableCapAES, invalid_keylens, .fini = teardown) { rv = acvp_cap_sym_cipher_set_parm(ctx, ACVP_AES_CFB1, ACVP_SYM_CIPH_KEYLEN, 333); cr_assert(rv == ACVP_INVALID_ARG); - rv = acvp_cap_sym_cipher_set_parm(ctx, ACVP_AES_CFB1, ACVP_SYM_CIPH_KEYLEN, 333333); + rv = acvp_cap_sym_cipher_set_parm(ctx, ACVP_AES_CFB1, ACVP_SYM_CIPH_KEYLEN, 999999); cr_assert(rv == ACVP_INVALID_ARG); rv = acvp_cap_sym_cipher_set_parm(ctx, ACVP_AES_CFB1, ACVP_SYM_CIPH_KEYLEN, 0); cr_assert(rv == ACVP_INVALID_ARG); @@ -840,7 +840,7 @@ Test(EnableCapAES, invalid_param_lens, .fini = teardown) { setup_empty_ctx(&ctx); rv = acvp_cap_sym_cipher_enable(ctx, ACVP_AES_CFB1, &dummy_handler_success); cr_assert(rv == ACVP_SUCCESS); - rv = acvp_cap_sym_cipher_set_parm(ctx, ACVP_AES_CFB1, ACVP_SYM_CIPH_PTLEN, 333333); + rv = acvp_cap_sym_cipher_set_parm(ctx, ACVP_AES_CFB1, ACVP_SYM_CIPH_PTLEN, 999999); cr_assert(rv == ACVP_INVALID_ARG); rv = acvp_cap_sym_cipher_enable(ctx, ACVP_AES_CCM, &dummy_handler_success); @@ -851,11 +851,11 @@ Test(EnableCapAES, invalid_param_lens, .fini = teardown) { cr_assert(rv == ACVP_INVALID_ARG); rv = acvp_cap_sym_cipher_set_parm(ctx, ACVP_AES_CCM, ACVP_SYM_CIPH_IVLEN, 0); cr_assert(rv == ACVP_INVALID_ARG); - rv = acvp_cap_sym_cipher_set_parm(ctx, ACVP_AES_CCM, ACVP_SYM_CIPH_IVLEN, 333333); + rv = acvp_cap_sym_cipher_set_parm(ctx, ACVP_AES_CCM, ACVP_SYM_CIPH_IVLEN, 999999); cr_assert(rv == ACVP_INVALID_ARG); rv = acvp_cap_sym_cipher_set_parm(ctx, ACVP_AES_CCM, ACVP_SYM_CIPH_IVLEN, 0); cr_assert(rv == ACVP_INVALID_ARG); - rv = acvp_cap_sym_cipher_set_parm(ctx, ACVP_AES_CCM, ACVP_SYM_CIPH_AADLEN, 333333); + rv = acvp_cap_sym_cipher_set_parm(ctx, ACVP_AES_CCM, ACVP_SYM_CIPH_AADLEN, 999999); cr_assert(rv == ACVP_INVALID_ARG); rv = acvp_cap_sym_cipher_set_parm(ctx, ACVP_AES_CCM, ACVP_SYM_CIPH_AADLEN, -333); cr_assert(rv == ACVP_INVALID_ARG); diff --git a/test/ut_common.h b/test/ut_common.h index 7836cb3a..822c5815 100644 --- a/test/ut_common.h +++ b/test/ut_common.h @@ -28,3 +28,21 @@ int dummy_handler_failure(ACVP_TEST_CASE *test_case); JSON_Object *ut_get_obj_from_rsp (JSON_Value *arry_val); unsigned int base64_decode(const char *in, unsigned int inlen, unsigned char *out); unsigned int dummy_totp(char **token, int token_max); + +#define ACVP_TEST_STRING_TOO_LONG "TestStringTooLongTestStringTooLongTestStringTooLongTestStringTooLong"\ + "TestStringTooLongTestStringTooLongTestStringTooLongTestStringTooLong"\ + "TestStringTooLongTestStringTooLongTestStringTooLongTestStringTooLong"\ + "TestStringTooLongTestStringTooLongTestStringTooLongTestStringTooLong"\ + "TestStringTooLongTestStringTooLongTestStringTooLongTestStringTooLong"\ + "TestStringTooLongTestStringTooLongTestStringTooLongTestStringTooLong"\ + "TestStringTooLongTestStringTooLongTestStringTooLongTestStringTooLong"\ + "TestStringTooLongTestStringTooLongTestStringTooLongTestStringTooLong"\ + "TestStringTooLongTestStringTooLongTestStringTooLongTestStringTooLong"\ + "TestStringTooLongTestStringTooLongTestStringTooLongTestStringTooLong"\ + "TestStringTooLongTestStringTooLongTestStringTooLongTestStringTooLong"\ + "TestStringTooLongTestStringTooLongTestStringTooLongTestStringTooLong"\ + "TestStringTooLongTestStringTooLongTestStringTooLongTestStringTooLong"\ + "TestStringTooLongTestStringTooLongTestStringTooLongTestStringTooLong"\ + "TestStringTooLongTestStringTooLongTestStringTooLongTestStringTooLong"\ + "TestStringTooLongTestStringTooLongTestStringTooLongTestStringTooLong"\ + "TestStringTooLongTestStringTooLongTestStringTooLongTestStringTooLong"