get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/47723/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 47723,
    "url": "http://patches.dpdk.org/api/patches/47723/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20181102095535.7906-3-marko.kovacevic@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20181102095535.7906-3-marko.kovacevic@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20181102095535.7906-3-marko.kovacevic@intel.com",
    "date": "2018-11-02T09:55:29",
    "name": "[v7,2/8] examples/fips_validation: support AES parsing",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "1814fafb1119e145ba56ce6e91843738b9ac270e",
    "submitter": {
        "id": 853,
        "url": "http://patches.dpdk.org/api/people/853/?format=api",
        "name": "Kovacevic, Marko",
        "email": "marko.kovacevic@intel.com"
    },
    "delegate": {
        "id": 6690,
        "url": "http://patches.dpdk.org/api/users/6690/?format=api",
        "username": "akhil",
        "first_name": "akhil",
        "last_name": "goyal",
        "email": "gakhil@marvell.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20181102095535.7906-3-marko.kovacevic@intel.com/mbox/",
    "series": [
        {
            "id": 2223,
            "url": "http://patches.dpdk.org/api/series/2223/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=2223",
            "date": "2018-11-02T09:55:27",
            "name": "FIPS validation capability",
            "version": 7,
            "mbox": "http://patches.dpdk.org/series/2223/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/47723/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/47723/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 469581B28B;\n\tFri,  2 Nov 2018 10:55:50 +0100 (CET)",
            "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n\tby dpdk.org (Postfix) with ESMTP id A22071B1F6\n\tfor <dev@dpdk.org>; Fri,  2 Nov 2018 10:55:46 +0100 (CET)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t02 Nov 2018 02:55:46 -0700",
            "from silpixa00399502.ir.intel.com (HELO\n\tsilpixa00399502.ger.corp.intel.com) ([10.237.223.218])\n\tby fmsmga001.fm.intel.com with ESMTP; 02 Nov 2018 02:55:45 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.54,455,1534834800\"; d=\"scan'208\";a=\"104701192\"",
        "From": "\"Kovacevic, Marko\" <marko.kovacevic@intel.com>",
        "To": "akhil.goyal@nxp.com",
        "Cc": "dev@dpdk.org, roy.fan.zhang@intel.com, arkadiuszx.kusztal@intel.com,\n\t\"Kovacevic, Marko\" <marko.kovacevic@intel.com>",
        "Date": "Fri,  2 Nov 2018 09:55:29 +0000",
        "Message-Id": "<20181102095535.7906-3-marko.kovacevic@intel.com>",
        "X-Mailer": "git-send-email 2.9.5",
        "In-Reply-To": "<20181102095535.7906-1-marko.kovacevic@intel.com>",
        "References": "<20181026110716.42093-1-marko.kovacevic@intel.com>\n\t<20181102095535.7906-1-marko.kovacevic@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v7 2/8] examples/fips_validation: support AES\n\tparsing",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Added enablement for AES-CBC parser, to allow the\napplication to parser the aes request file and to validate all\ntest types supported.\n\nSigned-off-by: Marko Kovacevic <marko.kovacevic@intel.com>\nSigned-off-by: Fan Zhang <roy.fan.zhang@intel.com>\nAcked-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>\n---\n examples/fips_validation/Makefile              |   1 +\n examples/fips_validation/fips_validation.c     |   6 +\n examples/fips_validation/fips_validation.h     |  24 ++\n examples/fips_validation/fips_validation_aes.c | 186 +++++++++++++\n examples/fips_validation/main.c                | 346 ++++++++++++++++++++++++-\n examples/fips_validation/meson.build           |   1 +\n 6 files changed, 563 insertions(+), 1 deletion(-)\n create mode 100644 examples/fips_validation/fips_validation_aes.c",
    "diff": "diff --git a/examples/fips_validation/Makefile b/examples/fips_validation/Makefile\nindex 59d56c7..1eb1bc5 100644\n--- a/examples/fips_validation/Makefile\n+++ b/examples/fips_validation/Makefile\n@@ -6,6 +6,7 @@ APP = fips_validation\n \n # all source are stored in SRCS-y\n SRCS-y := fips_validation.c\n+SRCS-y += fips_validation_aes.c\n SRCS-y += main.c\n \n # Build using pkg-config variables if possible\ndiff --git a/examples/fips_validation/fips_validation.c b/examples/fips_validation/fips_validation.c\nindex 58a3c1b..dba26d8 100644\n--- a/examples/fips_validation/fips_validation.c\n+++ b/examples/fips_validation/fips_validation.c\n@@ -106,6 +106,12 @@ fips_test_parse_header(void)\n \t\treturn ret;\n \n \tfor (i = 0; i < info.nb_vec_lines; i++) {\n+\t\tif (strstr(info.vec[i], \"AESVS\")) {\n+\t\t\tinfo.algo = FIPS_TEST_ALGO_AES;\n+\t\t\tret = parse_test_aes_init();\n+\t\t\tif (ret < 0)\n+\t\t\t\treturn ret;\n+\t\t}\n \n \t\ttmp = strstr(info.vec[i], \"# Config info for \");\n \t\tif (tmp != NULL) {\ndiff --git a/examples/fips_validation/fips_validation.h b/examples/fips_validation/fips_validation.h\nindex dd3bc09..e947de1 100644\n--- a/examples/fips_validation/fips_validation.h\n+++ b/examples/fips_validation/fips_validation.h\n@@ -23,6 +23,7 @@\n #define FAX_FILE_PERFIX\t\t\"fax\"\n \n enum fips_test_algorithms {\n+\t\tFIPS_TEST_ALGO_AES = 0,\n \t\tFIPS_TEST_ALGO_MAX\n };\n \n@@ -77,6 +78,21 @@ struct fips_test_callback {\n \tstruct fips_val *val;\n };\n \n+enum fips_aesavs_test_types {\n+\tAESAVS_TYPE_GFXBOX = 1,\n+\tAESAVS_TYPE_KEYSBOX,\n+\tAESAVS_TYPE_VARKEY,\n+\tAESAVS_TYPE_VARTXT,\n+\tAESAVS_TYPE_MMT,\n+\tAESAVS_TYPE_MCT,\n+};\n+\n+struct aesavs_interim_data {\n+\tenum fips_aesavs_test_types test_type;\n+\tuint32_t cipher_algo;\n+\tuint32_t key_len;\n+};\n+\n struct fips_test_interim_info {\n \tFILE *fp_rd;\n \tFILE *fp_wr;\n@@ -87,6 +103,11 @@ struct fips_test_interim_info {\n \tuint32_t nb_vec_lines;\n \tchar device_name[MAX_STRING_SIZE];\n \n+\tunion {\n+\t\tstruct aesavs_interim_data aes_data;\n+\n+\t} interim_info;\n+\n \tenum fips_test_op op;\n \n \tconst struct fips_test_callback *callbacks;\n@@ -117,6 +138,9 @@ void\n fips_test_write_one_case(void);\n \n int\n+parse_test_aes_init(void);\n+\n+int\n parser_read_uint8_hex(uint8_t *value, const char *p);\n \n int\ndiff --git a/examples/fips_validation/fips_validation_aes.c b/examples/fips_validation/fips_validation_aes.c\nnew file mode 100644\nindex 0000000..f60b864\n--- /dev/null\n+++ b/examples/fips_validation/fips_validation_aes.c\n@@ -0,0 +1,186 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2018 Intel Corporation\n+ */\n+\n+#include <string.h>\n+#include <time.h>\n+#include <stdio.h>\n+\n+#include <rte_cryptodev.h>\n+\n+#include \"fips_validation.h\"\n+\n+#define MODE_STR\t\"AESVS\"\n+#define ALGO_STR\t\"test data for \"\n+#define OP_STR\t\t\"State\"\n+#define KEY_SIZE_STR\t\"Key Length : \"\n+\n+\n+#define COUNT_STR\t\"COUNT = \"\n+#define KEY_STR\t\t\"KEY = \"\n+#define IV_STR\t\t\"IV = \"\n+#define PT_STR\t\t\"PLAINTEXT = \"\n+#define CT_STR\t\t\"CIPHERTEXT = \"\n+\n+#define OP_ENC_STR\t\"ENCRYPT\"\n+#define OP_DEC_STR\t\"DECRYPT\"\n+\n+struct {\n+\tuint32_t type;\n+\tconst char *desc;\n+} aes_test_types[] = {\n+\t\t{AESAVS_TYPE_GFXBOX, \"GFSbox\"},\n+\t\t{AESAVS_TYPE_KEYSBOX, \"KeySbox\"},\n+\t\t{AESAVS_TYPE_VARKEY, \"VarKey\"},\n+\t\t{AESAVS_TYPE_VARTXT, \"VarTxt\"},\n+\t\t{AESAVS_TYPE_MMT, \"MMT\"},\n+\t\t{AESAVS_TYPE_MCT, \"MCT\"},\n+};\n+\n+struct aes_test_algo {\n+\tconst char *name;\n+\tenum rte_crypto_cipher_algorithm algo;\n+} const algo_con[] = {\n+\t\t{\"CBC\", RTE_CRYPTO_CIPHER_AES_CBC},\n+};\n+\n+static int\n+parse_interim_enc_dec(const char *key,\n+\t\t__attribute__((__unused__)) char *text,\n+\t\t__attribute__((__unused__)) struct fips_val *val)\n+{\n+\tif (strcmp(key, OP_ENC_STR) == 0)\n+\t\tinfo.op = FIPS_TEST_ENC_AUTH_GEN;\n+\telse if (strcmp(key, OP_DEC_STR) == 0)\n+\t\tinfo.op = FIPS_TEST_DEC_AUTH_VERIF;\n+\telse\n+\t\treturn -1;\n+\n+\treturn 0;\n+}\n+\n+struct fips_test_callback aes_tests_interim[] = {\n+\t\t{OP_ENC_STR, parse_interim_enc_dec, NULL},\n+\t\t{OP_DEC_STR, parse_interim_enc_dec, NULL},\n+\t\t{NULL, NULL, NULL} /**< end pointer */\n+};\n+\n+struct fips_test_callback aes_tests_vectors[] = {\n+\t\t{KEY_STR, parse_uint8_hex_str, &vec.cipher_auth.key},\n+\t\t{IV_STR, parse_uint8_hex_str, &vec.iv},\n+\t\t{PT_STR, parse_uint8_hex_str, &vec.pt},\n+\t\t{CT_STR, parse_uint8_hex_str, &vec.ct},\n+\t\t{NULL, NULL, NULL} /**< end pointer */\n+};\n+\n+struct fips_test_callback aes_tests_interim_vectors[] = {\n+\t\t{OP_ENC_STR, parse_interim_enc_dec, NULL},\n+\t\t{OP_DEC_STR, parse_interim_enc_dec, NULL},\n+\t\t{NULL, NULL, NULL} /**< end pointer */\n+};\n+\n+struct fips_test_callback aes_writeback_callbacks[] = {\n+\t\t/** First element is used to pass COUNT string */\n+\t\t{COUNT_STR, NULL, NULL},\n+\t\t{IV_STR, writeback_hex_str, &vec.iv},\n+\t\t{KEY_STR, writeback_hex_str, &vec.cipher_auth.key},\n+\t\t{PT_STR, writeback_hex_str, &vec.pt},\n+\t\t{CT_STR, writeback_hex_str, &vec.ct},\n+\t\t{NULL, NULL, NULL} /**< end pointer */\n+};\n+\n+static int\n+parse_test_aes_writeback(struct fips_val *val)\n+{\n+\tif (info.op == FIPS_TEST_ENC_AUTH_GEN)\n+\t\tfprintf(info.fp_wr, \"%s\", CT_STR);\n+\telse\n+\t\tfprintf(info.fp_wr, \"%s\", PT_STR);\n+\n+\tparse_write_hex_str(val);\n+\n+\treturn 0;\n+}\n+\n+static int\n+rsp_test_aes_check(struct fips_val *val)\n+{\n+\tstruct fips_val *data;\n+\n+\tif (info.op == FIPS_TEST_ENC_AUTH_GEN)\n+\t\tdata = &vec.ct;\n+\telse\n+\t\tdata = &vec.pt;\n+\n+\tif (memcmp(val->val, data->val, val->len) == 0)\n+\t\tfprintf(info.fp_wr, \"Success\\n\");\n+\telse\n+\t\tfprintf(info.fp_wr, \"Failed\\n\");\n+\n+\treturn 0;\n+}\n+\n+int\n+parse_test_aes_init(void)\n+{\n+\tchar *tmp;\n+\tuint32_t i, j;\n+\n+\tfor (i = 0; i < info.nb_vec_lines; i++) {\n+\t\tchar *line = info.vec[i];\n+\n+\t\ttmp = strstr(line, MODE_STR);\n+\t\tif (tmp) {\n+\t\t\tfor (j = 0; j < RTE_DIM(aes_test_types); j++)\n+\t\t\t\tif (strstr(line, aes_test_types[j].desc)) {\n+\t\t\t\t\tinfo.interim_info.aes_data.test_type =\n+\t\t\t\t\t\t\taes_test_types[j].type;\n+\t\t\t\t\tbreak;\n+\t\t\t\t}\n+\n+\t\t\tif (j >= RTE_DIM(aes_test_types))\n+\t\t\t\treturn -EINVAL;\n+\n+\t\t\ttmp = strstr(line, ALGO_STR);\n+\t\t\tif (!tmp)\n+\t\t\t\treturn -EINVAL;\n+\n+\t\t\ttmp += strlen(ALGO_STR);\n+\t\t\tfor (j = 0; j < RTE_DIM(algo_con); j++)\n+\t\t\t\tif (strcmp(algo_con[j].name, tmp) == 0) {\n+\t\t\t\t\tinfo.interim_info.aes_data.cipher_algo =\n+\t\t\t\t\t\t(uint32_t)algo_con[j].algo;\n+\t\t\t\t\tbreak;\n+\t\t\t\t}\n+\t\t\tif (j >= RTE_DIM(algo_con))\n+\t\t\t\treturn -EINVAL;\n+\n+\t\t\tcontinue;\n+\t\t}\n+\n+\t\ttmp = strstr(line, OP_STR);\n+\t\tif (tmp)\n+\t\t\tcontinue;\n+\n+\t\ttmp = strstr(line, KEY_SIZE_STR);\n+\t\tif (tmp) {\n+\t\t\ttmp += strlen(KEY_SIZE_STR);\n+\t\t\tif (parser_read_uint32\n+\t\t\t\t\t(&info.interim_info.aes_data.key_len,\n+\t\t\t\t\t\t\ttmp) < 0)\n+\t\t\t\treturn -EINVAL;\n+\n+\t\t\tinfo.interim_info.aes_data.key_len /= 8;\n+\n+\t\t\tcontinue;\n+\t\t}\n+\t}\n+\n+\tinfo.parse_writeback = parse_test_aes_writeback;\n+\tinfo.callbacks = aes_tests_vectors;\n+\tinfo.interim_callbacks = aes_tests_interim_vectors;\n+\tinfo.writeback_callbacks = aes_writeback_callbacks;\n+\tinfo.kat_check = rsp_test_aes_check;\n+\n+\treturn 0;\n+}\ndiff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c\nindex 7083462..1f1ba99 100644\n--- a/examples/fips_validation/main.c\n+++ b/examples/fips_validation/main.c\n@@ -329,6 +329,340 @@ main(int argc, char *argv[])\n \n }\n \n+#define IV_OFF (sizeof(struct rte_crypto_op) + sizeof(struct rte_crypto_sym_op))\n+#define CRYPTODEV_FIPS_MAX_RETRIES\t16\n+\n+typedef int (*fips_test_one_case_t)(void);\n+typedef int (*fips_prepare_op_t)(void);\n+typedef int (*fips_prepare_xform_t)(struct rte_crypto_sym_xform *);\n+\n+struct fips_test_ops {\n+\tfips_prepare_xform_t prepare_xform;\n+\tfips_prepare_op_t prepare_op;\n+\tfips_test_one_case_t test;\n+} test_ops;\n+\n+static int\n+prepare_cipher_op(void)\n+{\n+\tstruct rte_crypto_sym_op *sym = env.op->sym;\n+\tuint8_t *iv = rte_crypto_op_ctod_offset(env.op, uint8_t *, IV_OFF);\n+\n+\t__rte_crypto_op_reset(env.op, RTE_CRYPTO_OP_TYPE_SYMMETRIC);\n+\trte_pktmbuf_reset(env.mbuf);\n+\n+\tsym->m_src = env.mbuf;\n+\tsym->cipher.data.offset = 0;\n+\n+\tmemcpy(iv, vec.iv.val, vec.iv.len);\n+\n+\tif (info.op == FIPS_TEST_ENC_AUTH_GEN) {\n+\t\tuint8_t *pt;\n+\n+\t\tif (vec.pt.len > RTE_MBUF_MAX_NB_SEGS) {\n+\t\t\tRTE_LOG(ERR, USER1, \"PT len %u\\n\", vec.pt.len);\n+\t\t\treturn -EPERM;\n+\t\t}\n+\n+\t\tpt = (uint8_t *)rte_pktmbuf_append(env.mbuf, vec.pt.len);\n+\n+\t\tif (!pt) {\n+\t\t\tRTE_LOG(ERR, USER1, \"Error %i: MBUF too small\\n\",\n+\t\t\t\t\t-ENOMEM);\n+\t\t\treturn -ENOMEM;\n+\t\t}\n+\n+\t\tmemcpy(pt, vec.pt.val, vec.pt.len);\n+\t\tsym->cipher.data.length = vec.pt.len;\n+\n+\t} else {\n+\t\tuint8_t *ct;\n+\n+\t\tif (vec.ct.len > RTE_MBUF_MAX_NB_SEGS) {\n+\t\t\tRTE_LOG(ERR, USER1, \"CT len %u\\n\", vec.ct.len);\n+\t\t\treturn -EPERM;\n+\t\t}\n+\n+\t\tct = (uint8_t *)rte_pktmbuf_append(env.mbuf, vec.ct.len);\n+\n+\t\tif (!ct) {\n+\t\t\tRTE_LOG(ERR, USER1, \"Error %i: MBUF too small\\n\",\n+\t\t\t\t\t-ENOMEM);\n+\t\t\treturn -ENOMEM;\n+\t\t}\n+\n+\t\tmemcpy(ct, vec.ct.val, vec.ct.len);\n+\t\tsym->cipher.data.length = vec.ct.len;\n+\t}\n+\n+\trte_crypto_op_attach_sym_session(env.op, env.sess);\n+\n+\treturn 0;\n+}\n+\n+static int\n+prepare_aes_xform(struct rte_crypto_sym_xform *xform)\n+{\n+\tconst struct rte_cryptodev_symmetric_capability *cap;\n+\tstruct rte_cryptodev_sym_capability_idx cap_idx;\n+\tstruct rte_crypto_cipher_xform *cipher_xform = &xform->cipher;\n+\n+\txform->type = RTE_CRYPTO_SYM_XFORM_CIPHER;\n+\n+\tcipher_xform->algo = RTE_CRYPTO_CIPHER_AES_CBC;\n+\tcipher_xform->op = (info.op == FIPS_TEST_ENC_AUTH_GEN) ?\n+\t\t\tRTE_CRYPTO_CIPHER_OP_ENCRYPT :\n+\t\t\tRTE_CRYPTO_CIPHER_OP_DECRYPT;\n+\tcipher_xform->key.data = vec.cipher_auth.key.val;\n+\tcipher_xform->key.length = vec.cipher_auth.key.len;\n+\tcipher_xform->iv.length = vec.iv.len;\n+\tcipher_xform->iv.offset = IV_OFF;\n+\n+\tcap_idx.algo.cipher = RTE_CRYPTO_CIPHER_AES_CBC;\n+\tcap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER;\n+\n+\tcap = rte_cryptodev_sym_capability_get(env.dev_id, &cap_idx);\n+\tif (!cap) {\n+\t\tRTE_LOG(ERR, USER1, \"Failed to get capability for cdev %u\\n\",\n+\t\t\t\tenv.dev_id);\n+\t\treturn -EINVAL;\n+\t}\n+\n+\tif (rte_cryptodev_sym_capability_check_cipher(cap,\n+\t\t\tcipher_xform->key.length,\n+\t\t\tcipher_xform->iv.length) != 0) {\n+\t\tRTE_LOG(ERR, USER1, \"PMD %s key length %u IV length %u\\n\",\n+\t\t\t\tinfo.device_name, cipher_xform->key.length,\n+\t\t\t\tcipher_xform->iv.length);\n+\t\treturn -EPERM;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static void\n+get_writeback_data(struct fips_val *val)\n+{\n+\tval->val = rte_pktmbuf_mtod(env.mbuf, uint8_t *);\n+\tval->len = rte_pktmbuf_pkt_len(env.mbuf);\n+}\n+\n+static int\n+fips_run_test(void)\n+{\n+\tstruct rte_crypto_sym_xform xform = {0};\n+\tuint16_t n_deqd;\n+\tint ret;\n+\n+\tret = test_ops.prepare_xform(&xform);\n+\tif (ret < 0)\n+\t\treturn ret;\n+\n+\tenv.sess = rte_cryptodev_sym_session_create(env.mpool);\n+\tif (!env.sess)\n+\t\treturn -ENOMEM;\n+\n+\tret = rte_cryptodev_sym_session_init(env.dev_id,\n+\t\t\tenv.sess, &xform, env.mpool);\n+\tif (ret < 0) {\n+\t\tRTE_LOG(ERR, USER1, \"Error %i: Init session\\n\",\n+\t\t\t\tret);\n+\t\treturn ret;\n+\t}\n+\n+\tret = test_ops.prepare_op();\n+\tif (ret < 0) {\n+\t\tRTE_LOG(ERR, USER1, \"Error %i: Prepare op\\n\",\n+\t\t\t\tret);\n+\t\treturn ret;\n+\t}\n+\n+\tif (rte_cryptodev_enqueue_burst(env.dev_id, 0, &env.op, 1) < 1) {\n+\t\tRTE_LOG(ERR, USER1, \"Error: Failed enqueue\\n\");\n+\t\treturn ret;\n+\t}\n+\n+\tdo {\n+\t\tstruct rte_crypto_op *deqd_op;\n+\n+\t\tn_deqd = rte_cryptodev_dequeue_burst(env.dev_id, 0, &deqd_op,\n+\t\t\t\t1);\n+\t} while (n_deqd == 0);\n+\n+\tvec.status = env.op->status;\n+\n+\trte_cryptodev_sym_session_clear(env.dev_id, env.sess);\n+\trte_cryptodev_sym_session_free(env.sess);\n+\tenv.sess = NULL;\n+\n+\treturn ret;\n+}\n+\n+static int\n+fips_generic_test(void)\n+{\n+\tstruct fips_val val;\n+\tint ret;\n+\n+\tfips_test_write_one_case();\n+\n+\tret = fips_run_test();\n+\tif (ret < 0) {\n+\t\tif (ret == -EPERM) {\n+\t\t\tfprintf(info.fp_wr, \"Bypass\\n\\n\");\n+\t\t\treturn 0;\n+\t\t}\n+\n+\t\treturn ret;\n+\t}\n+\n+\tget_writeback_data(&val);\n+\n+\tswitch (info.file_type) {\n+\tcase FIPS_TYPE_REQ:\n+\tcase FIPS_TYPE_RSP:\n+\t\tif (info.parse_writeback == NULL)\n+\t\t\treturn -EPERM;\n+\t\tret = info.parse_writeback(&val);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tbreak;\n+\tcase FIPS_TYPE_FAX:\n+\t\tif (info.kat_check == NULL)\n+\t\t\treturn -EPERM;\n+\t\tret = info.kat_check(&val);\n+\t\tif (ret < 0)\n+\t\t\treturn ret;\n+\t\tbreak;\n+\t}\n+\n+\tfprintf(info.fp_wr, \"\\n\");\n+\n+\treturn 0;\n+}\n+\n+static int\n+fips_mct_aes_test(void)\n+{\n+#define AES_BLOCK_SIZE\t16\n+#define AES_EXTERN_ITER\t100\n+#define AES_INTERN_ITER\t1000\n+\tstruct fips_val val, val_key;\n+\tuint8_t prev_out[AES_BLOCK_SIZE] = {0};\n+\tuint8_t prev_in[AES_BLOCK_SIZE] = {0};\n+\tuint32_t i, j, k;\n+\tint ret;\n+\n+\tfor (i = 0; i < AES_EXTERN_ITER; i++) {\n+\t\tif (i != 0)\n+\t\t\tupdate_info_vec(i);\n+\n+\t\tfips_test_write_one_case();\n+\n+\t\tfor (j = 0; j < AES_INTERN_ITER; j++) {\n+\t\t\tret = fips_run_test();\n+\t\t\tif (ret < 0) {\n+\t\t\t\tif (ret == -EPERM) {\n+\t\t\t\t\tfprintf(info.fp_wr, \"Bypass\\n\");\n+\t\t\t\t\treturn 0;\n+\t\t\t\t}\n+\n+\t\t\t\treturn ret;\n+\t\t\t}\n+\n+\t\t\tget_writeback_data(&val);\n+\n+\t\t\tif (info.op == FIPS_TEST_DEC_AUTH_VERIF)\n+\t\t\t\tmemcpy(prev_in, vec.ct.val, AES_BLOCK_SIZE);\n+\n+\t\t\tif (j == 0) {\n+\t\t\t\tmemcpy(prev_out, val.val, AES_BLOCK_SIZE);\n+\n+\t\t\t\tif (info.op == FIPS_TEST_ENC_AUTH_GEN) {\n+\t\t\t\t\tmemcpy(vec.pt.val, vec.iv.val,\n+\t\t\t\t\t\t\tAES_BLOCK_SIZE);\n+\t\t\t\t\tmemcpy(vec.iv.val, val.val,\n+\t\t\t\t\t\t\tAES_BLOCK_SIZE);\n+\t\t\t\t} else {\n+\t\t\t\t\tmemcpy(vec.ct.val, vec.iv.val,\n+\t\t\t\t\t\t\tAES_BLOCK_SIZE);\n+\t\t\t\t\tmemcpy(vec.iv.val, prev_in,\n+\t\t\t\t\t\t\tAES_BLOCK_SIZE);\n+\t\t\t\t}\n+\t\t\t\tcontinue;\n+\t\t\t}\n+\n+\t\t\tif (info.op == FIPS_TEST_ENC_AUTH_GEN) {\n+\t\t\t\tmemcpy(vec.iv.val, val.val, AES_BLOCK_SIZE);\n+\t\t\t\tmemcpy(vec.pt.val, prev_out, AES_BLOCK_SIZE);\n+\t\t\t} else {\n+\t\t\t\tmemcpy(vec.iv.val, prev_in, AES_BLOCK_SIZE);\n+\t\t\t\tmemcpy(vec.ct.val, prev_out, AES_BLOCK_SIZE);\n+\t\t\t}\n+\n+\t\t\tif (j == AES_INTERN_ITER - 1)\n+\t\t\t\tcontinue;\n+\n+\t\t\tmemcpy(prev_out, val.val, AES_BLOCK_SIZE);\n+\t\t}\n+\n+\t\tinfo.parse_writeback(&val);\n+\t\tfprintf(info.fp_wr, \"\\n\");\n+\n+\t\tif (i == AES_EXTERN_ITER - 1)\n+\t\t\tcontinue;\n+\n+\t\t/** update key */\n+\t\tmemcpy(&val_key, &vec.cipher_auth.key, sizeof(val_key));\n+\t\tfor (k = 0; k < vec.cipher_auth.key.len; k++) {\n+\t\t\tswitch (vec.cipher_auth.key.len) {\n+\t\t\tcase 16:\n+\t\t\t\tval_key.val[k] ^= val.val[k];\n+\t\t\t\tbreak;\n+\t\t\tcase 24:\n+\t\t\t\tif (k < 8)\n+\t\t\t\t\tval_key.val[k] ^= prev_out[k + 8];\n+\t\t\t\telse\n+\t\t\t\t\tval_key.val[k] ^= val.val[k - 8];\n+\t\t\t\tbreak;\n+\t\t\tcase 32:\n+\t\t\t\tif (k < 16)\n+\t\t\t\t\tval_key.val[k] ^= prev_out[k];\n+\t\t\t\telse\n+\t\t\t\t\tval_key.val[k] ^= val.val[k - 16];\n+\t\t\t\tbreak;\n+\t\t\tdefault:\n+\t\t\t\treturn -1;\n+\t\t\t}\n+\t\t}\n+\n+\t\tif (info.op == FIPS_TEST_DEC_AUTH_VERIF)\n+\t\t\tmemcpy(vec.iv.val, val.val, AES_BLOCK_SIZE);\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n+init_test_ops(void)\n+{\n+\tswitch (info.algo) {\n+\tcase FIPS_TEST_ALGO_AES:\n+\t\ttest_ops.prepare_op = prepare_cipher_op;\n+\t\ttest_ops.prepare_xform  = prepare_aes_xform;\n+\t\tif (info.interim_info.aes_data.test_type == AESAVS_TYPE_MCT)\n+\t\t\ttest_ops.test = fips_mct_aes_test;\n+\t\telse\n+\t\t\ttest_ops.test = fips_generic_test;\n+\t\tbreak;\n+\n+\tdefault:\n+\t\treturn -1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n static void\n print_test_block(void)\n {\n@@ -345,7 +679,14 @@ fips_test_one_file(void)\n {\n \tint fetch_ret = 0, ret;\n \n-\twhile (fetch_ret == 0) {\n+\n+\tret = init_test_ops();\n+\tif (ret < 0) {\n+\t\tRTE_LOG(ERR, USER1, \"Error %i: Init test op\\n\", ret);\n+\t\treturn ret;\n+\t}\n+\n+\twhile (ret >= 0 && fetch_ret == 0) {\n \t\tfetch_ret = fips_test_fetch_one_block();\n \t\tif (fetch_ret < 0) {\n \t\t\tRTE_LOG(ERR, USER1, \"Error %i: Fetch block\\n\",\n@@ -365,6 +706,7 @@ fips_test_one_file(void)\n \t\tret = fips_test_parse_one_case();\n \t\tswitch (ret) {\n \t\tcase 0:\n+\t\t\tret = test_ops.test();\n \t\t\tif (ret == 0)\n \t\t\t\tbreak;\n \t\t\tRTE_LOG(ERR, USER1, \"Error %i: test block\\n\",\n@@ -385,4 +727,6 @@ fips_test_one_file(void)\n \n \tfips_test_clear();\n \n+\treturn ret;\n+\n }\ndiff --git a/examples/fips_validation/meson.build b/examples/fips_validation/meson.build\nindex cceed4f..fb20541 100644\n--- a/examples/fips_validation/meson.build\n+++ b/examples/fips_validation/meson.build\n@@ -9,6 +9,7 @@\n deps += ['cryptodev']\n allow_experimental_apis = true\n sources = files(\n+\t'fips_validation_aes.c',\n \t'fips_validation.c',\n \t'main.c'\n )\n",
    "prefixes": [
        "v7",
        "2/8"
    ]
}