examples/l2fwd-crypto: support AES-CCM
[dpdk.git] / app / test-crypto-perf / cperf_test_vector_parsing.c
index 68e55bb..3952632 100644 (file)
@@ -116,6 +116,20 @@ show_test_vector(struct cperf_test_vector *test_vector)
                printf("\n");
        }
 
+       if (test_vector->aead_key.data) {
+               printf("\naead_key =\n");
+               for (i = 0; i < test_vector->aead_key.length; ++i) {
+                       if ((i % wrap == 0) && (i != 0))
+                               printf("\n");
+                       if (i == (uint32_t)(test_vector->aead_key.length - 1))
+                               printf("0x%02x", test_vector->aead_key.data[i]);
+                       else
+                               printf("0x%02x, ",
+                                       test_vector->aead_key.data[i]);
+               }
+               printf("\n");
+       }
+
        if (test_vector->cipher_iv.data) {
                printf("\ncipher_iv =\n");
                for (i = 0; i < test_vector->cipher_iv.length; ++i) {
@@ -142,6 +156,19 @@ show_test_vector(struct cperf_test_vector *test_vector)
                printf("\n");
        }
 
+       if (test_vector->aead_iv.data) {
+               printf("\naead_iv =\n");
+               for (i = 0; i < test_vector->aead_iv.length; ++i) {
+                       if ((i % wrap == 0) && (i != 0))
+                               printf("\n");
+                       if (i == (uint32_t)(test_vector->aead_iv.length - 1))
+                               printf("0x%02x", test_vector->aead_iv.data[i]);
+                       else
+                               printf("0x%02x, ", test_vector->aead_iv.data[i]);
+               }
+               printf("\n");
+       }
+
        if (test_vector->ciphertext.data) {
                printf("\nciphertext =\n");
                for (i = 0; i < test_vector->ciphertext.length; ++i) {
@@ -345,6 +372,20 @@ parse_entry(char *entry, struct cperf_test_vector *vector,
                        vector->auth_key.length = opts->auth_key_sz;
                }
 
+       } else if (strstr(key_token, "aead_key")) {
+               rte_free(vector->aead_key.data);
+               vector->aead_key.data = data;
+               if (tc_found)
+                       vector->aead_key.length = data_length;
+               else {
+                       if (opts->aead_key_sz > data_length) {
+                               printf("Global aead_key shorter than "
+                                       "aead_key_sz\n");
+                               return -1;
+                       }
+                       vector->aead_key.length = opts->aead_key_sz;
+               }
+
        } else if (strstr(key_token, "cipher_iv")) {
                rte_free(vector->cipher_iv.data);
                vector->cipher_iv.data = data;
@@ -373,6 +414,20 @@ parse_entry(char *entry, struct cperf_test_vector *vector,
                        vector->auth_iv.length = opts->auth_iv_sz;
                }
 
+       } else if (strstr(key_token, "aead_iv")) {
+               rte_free(vector->aead_iv.data);
+               vector->aead_iv.data = data;
+               if (tc_found)
+                       vector->aead_iv.length = data_length;
+               else {
+                       if (opts->aead_iv_sz > data_length) {
+                               printf("Global aead iv shorter than "
+                                       "aead_iv_sz\n");
+                               return -1;
+                       }
+                       vector->aead_iv.length = opts->aead_iv_sz;
+               }
+
        } else if (strstr(key_token, "ciphertext")) {
                rte_free(vector->ciphertext.data);
                vector->ciphertext.data = data;
@@ -394,12 +449,12 @@ parse_entry(char *entry, struct cperf_test_vector *vector,
                if (tc_found)
                        vector->aad.length = data_length;
                else {
-                       if (opts->auth_aad_sz > data_length) {
+                       if (opts->aead_aad_sz > data_length) {
                                printf("Global aad shorter than "
-                                       "auth_aad_sz\n");
+                                       "aead_aad_sz\n");
                                return -1;
                        }
-                       vector->aad.length = opts->auth_aad_sz;
+                       vector->aad.length = opts->aead_aad_sz;
                }
 
        } else if (strstr(key_token, "digest")) {
@@ -410,12 +465,12 @@ parse_entry(char *entry, struct cperf_test_vector *vector,
                if (tc_found)
                        vector->digest.length = data_length;
                else {
-                       if (opts->auth_digest_sz > data_length) {
+                       if (opts->digest_sz > data_length) {
                                printf("Global digest shorter than "
-                                       "auth_digest_sz\n");
+                                       "digest_sz\n");
                                return -1;
                        }
-                       vector->digest.length = opts->auth_digest_sz;
+                       vector->digest.length = opts->digest_sz;
                }
        } else {
                printf("Not valid key: '%s'\n", trim_space(key_token));