| 891 | } |
| 892 | |
| 893 | static int |
| 894 | crosscheck_with_profile_run(const struct crosscheck_test_profile *profile) |
| 895 | { |
| 896 | struct crosscheck_testsuite_params *ts_params = &testsuite_params; |
| 897 | uint8_t input_text[profile->input_buf_len]; |
| 898 | uint16_t output_len, encrypted_len; |
| 899 | uint8_t encrypted_text[MBUF_SIZE]; |
| 900 | uint8_t output_text[MBUF_SIZE]; |
| 901 | int status; |
| 902 | |
| 903 | memset(ts_params->digest.mem, 0, ts_params->digest.len); |
| 904 | memset(ts_params->aad.mem, 0, ts_params->aad.len); |
| 905 | |
| 906 | /* Encrypt Stage */ |
| 907 | RTE_LOG(DEBUG, USER1, "Executing encrypt stage\n"); |
| 908 | /* Fill input with incrementing pattern */ |
| 909 | incrementing_generate(input_text, 'a', profile->input_buf_len); |
| 910 | status = crosscheck_all_devices(profile, OP_ENCRYPT, input_text, profile->input_buf_len, |
| 911 | output_text, &output_len); |
| 912 | TEST_ASSERT_SUCCESS(status, "Error occurred during encryption"); |
| 913 | |
| 914 | /* Decrypt Stage */ |
| 915 | RTE_LOG(DEBUG, USER1, "Executing decrypt stage\n"); |
| 916 | /* Set up encrypted data as input */ |
| 917 | encrypted_len = output_len; |
| 918 | memcpy(encrypted_text, output_text, output_len); |
| 919 | status = crosscheck_all_devices(profile, OP_DECRYPT, encrypted_text, encrypted_len, |
| 920 | output_text, &output_len); |
| 921 | TEST_ASSERT_SUCCESS(status, "Error occurred during decryption"); |
| 922 | |
| 923 | /* Negative Stage */ |
| 924 | RTE_LOG(DEBUG, USER1, "Executing negative stage\n"); |
| 925 | if (profile->digest_size) { |
| 926 | /* Corrupting one byte of digest */ |
| 927 | ts_params->digest.mem[profile->digest_size - 1] += 1; |
| 928 | status = check_negative_all_devices(profile, OP_DECRYPT, encrypted_text, |
| 929 | encrypted_len); |
| 930 | TEST_ASSERT_SUCCESS(status, "Error occurred during decryption"); |
| 931 | } |
| 932 | |
| 933 | |
| 934 | return TEST_SUCCESS; |
| 935 | } |
| 936 | |
| 937 | static int |
| 938 | test_crosscheck_unit(const void *ptr) |
no test coverage detected