MCPcopy Create free account
hub / github.com/F-Stack/f-stack / crosscheck_with_profile_run

Function crosscheck_with_profile_run

dpdk/app/test/test_cryptodev_crosscheck.c:893–935  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

891}
892
893static int
894crosscheck_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
937static int
938test_crosscheck_unit(const void *ptr)

Callers 1

test_crosscheck_unitFunction · 0.85

Calls 5

memsetFunction · 0.85
incrementing_generateFunction · 0.85
crosscheck_all_devicesFunction · 0.85
memcpyFunction · 0.50

Tested by

no test coverage detected