get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 47725,
    "url": "http://patches.dpdk.org/api/patches/47725/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20181102095535.7906-5-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-5-marko.kovacevic@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20181102095535.7906-5-marko.kovacevic@intel.com",
    "date": "2018-11-02T09:55:31",
    "name": "[v7,4/8] examples/fips_validation: support TDES parsing",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "950220d26ef8d959dfa618673a1f7f4212c6f876",
    "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-5-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/47725/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/47725/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 4E5911B3A5;\n\tFri,  2 Nov 2018 10:55:53 +0100 (CET)",
            "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n\tby dpdk.org (Postfix) with ESMTP id 267291B20C\n\tfor <dev@dpdk.org>; Fri,  2 Nov 2018 10:55:49 +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:48 -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:47 -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=\"104701203\"",
        "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:31 +0000",
        "Message-Id": "<20181102095535.7906-5-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 4/8] examples/fips_validation: support TDES\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 TDES parser, to allow the\napplication to parser the TDES request files 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      |   5 +\n examples/fips_validation/fips_validation.h      |  21 ++\n examples/fips_validation/fips_validation_aes.c  |   2 +\n examples/fips_validation/fips_validation_tdes.c | 264 ++++++++++++++++++++++++\n examples/fips_validation/main.c                 | 175 ++++++++++++++++\n examples/fips_validation/meson.build            |   1 +\n 7 files changed, 469 insertions(+)\n create mode 100644 examples/fips_validation/fips_validation_tdes.c",
    "diff": "diff --git a/examples/fips_validation/Makefile b/examples/fips_validation/Makefile\nindex 0d76101..57cc778 100644\n--- a/examples/fips_validation/Makefile\n+++ b/examples/fips_validation/Makefile\n@@ -8,6 +8,7 @@ APP = fips_validation\n SRCS-y := fips_validation.c\n SRCS-y += fips_validation_aes.c\n SRCS-y += fips_validation_hmac.c\n+SRCS-y += fips_validation_tdes.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 24307b6..86f443d 100644\n--- a/examples/fips_validation/fips_validation.c\n+++ b/examples/fips_validation/fips_validation.c\n@@ -116,6 +116,11 @@ fips_test_parse_header(void)\n \t\t\tret = parse_test_hmac_init();\n \t\t\tif (ret < 0)\n \t\t\t\treturn ret;\n+\t\t} else if (strstr(info.vec[i], \"TDES\")) {\n+\t\t\tinfo.algo = FIPS_TEST_ALGO_TDES;\n+\t\t\tret = parse_test_tdes_init();\n+\t\t\tif (ret < 0)\n+\t\t\t\treturn 0;\n \t\t}\n \n \t\ttmp = strstr(info.vec[i], \"# Config info for \");\ndiff --git a/examples/fips_validation/fips_validation.h b/examples/fips_validation/fips_validation.h\nindex f9e3a3b..69a2116 100644\n--- a/examples/fips_validation/fips_validation.h\n+++ b/examples/fips_validation/fips_validation.h\n@@ -25,6 +25,7 @@\n enum fips_test_algorithms {\n \t\tFIPS_TEST_ALGO_AES = 0,\n \t\tFIPS_TEST_ALGO_HMAC,\n+\t\tFIPS_TEST_ALGO_TDES,\n \t\tFIPS_TEST_ALGO_MAX\n };\n \n@@ -88,6 +89,17 @@ enum fips_aesavs_test_types {\n \tAESAVS_TYPE_MCT,\n };\n \n+enum fips_tdes_test_types {\n+\tTDES_INVERSE_PERMUTATION = 0,\n+\tTDES_PERMUTATION,\n+\tTDES_SUBSTITUTION_TABLE,\n+\tTDES_VARIABLE_KEY,\n+\tTDES_VARIABLE_TEXT,\n+\tTDES_KAT,\n+\tTDES_MCT, /* Monte Carlo (Modes) Test */\n+\tTDES_MMT /* Multi block Message Test */\n+};\n+\n struct aesavs_interim_data {\n \tenum fips_aesavs_test_types test_type;\n \tuint32_t cipher_algo;\n@@ -98,6 +110,11 @@ struct hmac_interim_data {\n \tenum rte_crypto_auth_algorithm algo;\n };\n \n+struct tdes_interim_data {\n+\tenum fips_tdes_test_types test_type;\n+\tuint32_t nb_keys;\n+};\n+\n struct fips_test_interim_info {\n \tFILE *fp_rd;\n \tFILE *fp_wr;\n@@ -111,6 +128,7 @@ struct fips_test_interim_info {\n \tunion {\n \t\tstruct aesavs_interim_data aes_data;\n \t\tstruct hmac_interim_data hmac_data;\n+\t\tstruct tdes_interim_data tdes_data;\n \n \t} interim_info;\n \n@@ -147,6 +165,9 @@ int\n parse_test_aes_init(void);\n \n int\n+parse_test_tdes_init(void);\n+\n+int\n parse_test_hmac_init(void);\n \n int\ndiff --git a/examples/fips_validation/fips_validation_aes.c b/examples/fips_validation/fips_validation_aes.c\nindex f60b864..8cbc158 100644\n--- a/examples/fips_validation/fips_validation_aes.c\n+++ b/examples/fips_validation/fips_validation_aes.c\n@@ -33,6 +33,8 @@ struct {\n \t\t{AESAVS_TYPE_KEYSBOX, \"KeySbox\"},\n \t\t{AESAVS_TYPE_VARKEY, \"VarKey\"},\n \t\t{AESAVS_TYPE_VARTXT, \"VarTxt\"},\n+\t\t{TDES_VARIABLE_TEXT, \"VARIABLE PLAINTEXT/CIPHERTEXT\"},\n+\t\t{TDES_VARIABLE_TEXT, \"KAT\"},\n \t\t{AESAVS_TYPE_MMT, \"MMT\"},\n \t\t{AESAVS_TYPE_MCT, \"MCT\"},\n };\ndiff --git a/examples/fips_validation/fips_validation_tdes.c b/examples/fips_validation/fips_validation_tdes.c\nnew file mode 100644\nindex 0000000..5064ff3\n--- /dev/null\n+++ b/examples/fips_validation/fips_validation_tdes.c\n@@ -0,0 +1,264 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2018 Intel Corporation\n+ */\n+\n+#include <string.h>\n+#include <stdio.h>\n+\n+#include <rte_malloc.h>\n+#include <rte_cryptodev.h>\n+\n+#include \"fips_validation.h\"\n+\n+#define NEW_LINE_STR\t\"#\"\n+#define TEST_TYPE_KEY\t\" for CBC\"\n+#define TEST_CBCI_KEY\t\" for CBCI\"\n+\n+#define ENC_STR\t\t\"[ENCRYPT]\"\n+#define DEC_STR\t\t\"[DECRYPT]\"\n+\n+#define COUNT_STR\t\"COUNT = \"\n+#define KEY1_STR\t\"KEY1 = \"\n+#define KEY2_STR\t\"KEY2 = \"\n+#define KEY3_STR\t\"KEY3 = \"\n+\n+#define KEYS_STR\t\"KEYs = \"\n+#define IV_STR\t\t\"IV = \"\n+#define PT_STR\t\t\"PLAINTEXT = \"\n+#define CT_STR\t\t\"CIPHERTEXT = \"\n+#define NK_STR\t\t\"NumKeys = \"\n+\n+#define SET_STR\t\t\" = \"\n+\n+#define PLAIN_TEXT\t0\n+#define CIPHER_TEXT\t1\n+#define KEY_TEXT\t2\n+#define IV_TEXT\t\t3\n+\n+#define DEVICE_STR\t\"# Config Info for : \"\n+\n+struct {\n+\tuint32_t type;\n+\tconst char *desc;\n+} test_types[] = {\n+\t\t{TDES_INVERSE_PERMUTATION, \"INVERSE PERMUTATION\"},\n+\t\t{TDES_PERMUTATION, \"PERMUTATION OPERATION\"},\n+\t\t{TDES_SUBSTITUTION_TABLE, \"SUBSTITUTION TABLE\"},\n+\t\t{TDES_VARIABLE_KEY, \"VARIABLE KEY\"},\n+\t\t{TDES_VARIABLE_TEXT, \"VARIABLE PLAINTEXT/CIPHERTEXT\"},\n+\t\t{TDES_VARIABLE_TEXT, \"KAT\"},\n+\t\t{TDES_MCT, \"Monte Carlo (Modes) Test\"},\n+\t\t{TDES_MMT, \"Multi block Message Test\"},\n+};\n+\n+static int\n+writeback_tdes_hex_str(const char *key, char *dst, struct fips_val *val);\n+\n+static int\n+parse_tdes_uint8_hex_str(const char *key, char *src, struct fips_val *val);\n+\n+static int\n+parse_tdes_interim(const char *key,\n+\t\t__attribute__((__unused__)) char *text,\n+\t\tstruct fips_val *val);\n+\n+struct fips_test_callback tdes_tests_vectors[] = {\n+\t\t{KEYS_STR, parse_tdes_uint8_hex_str, &vec.cipher_auth.key},\n+\t\t{KEY1_STR, parse_tdes_uint8_hex_str, &vec.cipher_auth.key},\n+\t\t{KEY2_STR, parse_tdes_uint8_hex_str, &vec.cipher_auth.key},\n+\t\t{KEY3_STR, parse_tdes_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 tdes_tests_interim_vectors[] = {\n+\t\t{ENC_STR, parse_tdes_interim, NULL},\n+\t\t{DEC_STR, parse_tdes_interim, NULL},\n+\t\t{NULL, NULL, NULL} /**< end pointer */\n+};\n+\n+struct fips_test_callback tdes_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{KEY1_STR, writeback_tdes_hex_str, &vec.cipher_auth.key},\n+\t\t{KEY2_STR, writeback_tdes_hex_str, &vec.cipher_auth.key},\n+\t\t{KEY3_STR, writeback_tdes_hex_str, &vec.cipher_auth.key},\n+\t\t{KEYS_STR, writeback_tdes_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_tdes_interim(const char *key,\n+\t\t__attribute__((__unused__)) char *text,\n+\t\t__attribute__((__unused__)) struct fips_val *val)\n+{\n+\tif (strstr(key, ENC_STR))\n+\t\tinfo.op = FIPS_TEST_ENC_AUTH_GEN;\n+\telse if (strstr(key, DEC_STR))\n+\t\tinfo.op = FIPS_TEST_DEC_AUTH_VERIF;\n+\telse if (strstr(NK_STR, \"NumKeys = 1\"))\n+\t\tinfo.interim_info.tdes_data.nb_keys = 1;\n+\telse if (strstr(NK_STR, \"NumKeys = 2\"))\n+\t\tinfo.interim_info.tdes_data.nb_keys = 2;\n+\telse if (strstr(NK_STR, \"NumKeys = 3\"))\n+\t\tinfo.interim_info.tdes_data.nb_keys = 3;\n+\telse\n+\t\treturn -EINVAL;\n+\n+\treturn 0;\n+}\n+\n+static int\n+parse_tdes_uint8_hex_str(const char *key, char *src, struct fips_val *val)\n+{\n+\tuint8_t tmp_key[24] = {0};\n+\tuint32_t len, i;\n+\n+\tsrc += strlen(key);\n+\n+\tlen = strlen(src) / 2;\n+\n+\tif (val->val) {\n+\t\tmemcpy(tmp_key, val->val, val->len);\n+\t\trte_free(val->val);\n+\t}\n+\n+\tval->val = rte_zmalloc(NULL, 24, 0);\n+\tif (!val->val)\n+\t\treturn -1;\n+\n+\tmemcpy(val->val, tmp_key, 24);\n+\n+\tif (strstr(key, KEYS_STR)) {\n+\t\tfor (i = 0; i < len; i++) {\n+\t\t\tchar byte[3] = {src[i * 2], src[i * 2 + 1], '\\0'};\n+\n+\t\t\tif (parser_read_uint8_hex(&val->val[i], byte) < 0)\n+\t\t\t\tgoto error_exit;\n+\t\t}\n+\n+\t\tmemcpy(val->val + 8, val->val, 8);\n+\t\tmemcpy(val->val + 16, val->val, 8);\n+\n+\t} else if (strstr(key, KEY1_STR)) {\n+\t\tfor (i = 0; i < len; i++) {\n+\t\t\tchar byte[3] = {src[i * 2], src[i * 2 + 1], '\\0'};\n+\n+\t\t\tif (parser_read_uint8_hex(&val->val[i], byte) < 0)\n+\t\t\t\tgoto error_exit;\n+\t\t}\n+\n+\t\tif (info.interim_info.tdes_data.nb_keys == 2)\n+\t\t\tmemcpy(val->val + 16, val->val, 8);\n+\n+\t} else if (strstr(key, KEY2_STR)) {\n+\t\tfor (i = 0; i < len; i++) {\n+\t\t\tchar byte[3] = {src[i * 2], src[i * 2 + 1], '\\0'};\n+\n+\t\t\tif (parser_read_uint8_hex(&val->val[i + 8], byte) < 0)\n+\t\t\t\tgoto error_exit;\n+\t\t}\n+\n+\t} else if (strstr(key, KEY3_STR)) {\n+\t\tfor (i = 0; i < len; i++) {\n+\t\t\tchar byte[3] = {src[i * 2], src[i * 2 + 1], '\\0'};\n+\n+\t\t\tif (parser_read_uint8_hex(&val->val[i + 16], byte) < 0)\n+\t\t\t\tgoto error_exit;\n+\t\t}\n+\t} else\n+\t\treturn -EINVAL;\n+\n+\tval->len = 24;\n+\n+\treturn 0;\n+\n+error_exit:\n+\trte_free(val->val);\n+\tmemset(val, 0, sizeof(*val));\n+\treturn -EINVAL;\n+}\n+\n+static int\n+parse_test_tdes_writeback(struct fips_val *val)\n+{\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+\n+static int\n+writeback_tdes_hex_str(const char *key, char *dst, struct fips_val *val)\n+{\n+\tstruct fips_val tmp_val;\n+\n+\ttmp_val.len = 8;\n+\n+\tif (strstr(key, KEY1_STR))\n+\t\ttmp_val.val = val->val;\n+\telse if (strstr(key, KEY2_STR))\n+\t\ttmp_val.val = val->val + 8;\n+\telse if (strstr(key, KEY3_STR))\n+\t\ttmp_val.val = val->val + 16;\n+\n+\treturn writeback_hex_str(key, dst, &tmp_val);\n+}\n+\n+static int\n+rsp_test_tdes_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_tdes_init(void)\n+{\n+\tuint32_t i;\n+\n+\tfor (i = 0; i < info.nb_vec_lines; i++) {\n+\t\tchar *line = info.vec[i];\n+\t\tuint32_t j;\n+\n+\t\tif (strstr(line, TEST_CBCI_KEY))\n+\t\t\treturn -EPERM;\n+\n+\t\tfor (j = 0; j < RTE_DIM(test_types); j++)\n+\t\t\tif (strstr(line, test_types[j].desc)) {\n+\t\t\t\tinfo.interim_info.tdes_data.test_type =\n+\t\t\t\t\t\ttest_types[j].type;\n+\t\t\t\tbreak;\n+\t\t\t}\n+\t}\n+\n+\tinfo.parse_writeback = parse_test_tdes_writeback;\n+\tinfo.callbacks = tdes_tests_vectors;\n+\tinfo.interim_callbacks = tdes_tests_interim_vectors;\n+\tinfo.writeback_callbacks = tdes_writeback_callbacks;\n+\tinfo.kat_check = rsp_test_tdes_check;\n+\n+\treturn 0;\n+}\ndiff --git a/examples/fips_validation/main.c b/examples/fips_validation/main.c\nindex da31d6a..3880681 100644\n--- a/examples/fips_validation/main.c\n+++ b/examples/fips_validation/main.c\n@@ -502,6 +502,46 @@ prepare_aes_xform(struct rte_crypto_sym_xform *xform)\n }\n \n static int\n+prepare_tdes_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_3DES_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_3DES_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 int\n prepare_hmac_xform(struct rte_crypto_sym_xform *xform)\n {\n \tconst struct rte_cryptodev_symmetric_capability *cap;\n@@ -640,6 +680,133 @@ fips_generic_test(void)\n }\n \n static int\n+fips_mct_tdes_test(void)\n+{\n+#define TDES_BLOCK_SIZE\t\t8\n+#define TDES_EXTERN_ITER\t400\n+#define TDES_INTERN_ITER\t10000\n+\tstruct fips_val val, val_key;\n+\tuint8_t prev_out[TDES_BLOCK_SIZE];\n+\tuint8_t prev_prev_out[TDES_BLOCK_SIZE];\n+\tuint8_t prev_in[TDES_BLOCK_SIZE];\n+\tuint32_t i, j, k;\n+\tint ret;\n+\n+\tfor (i = 0; i < TDES_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 < TDES_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, TDES_BLOCK_SIZE);\n+\n+\t\t\tif (j == 0) {\n+\t\t\t\tmemcpy(prev_out, val.val, TDES_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\tTDES_BLOCK_SIZE);\n+\t\t\t\t\tmemcpy(vec.iv.val, val.val,\n+\t\t\t\t\t\t\tTDES_BLOCK_SIZE);\n+\t\t\t\t} else {\n+\t\t\t\t\tmemcpy(vec.iv.val, vec.ct.val,\n+\t\t\t\t\t\t\tTDES_BLOCK_SIZE);\n+\t\t\t\t\tmemcpy(vec.ct.val, val.val,\n+\t\t\t\t\t\t\tTDES_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, TDES_BLOCK_SIZE);\n+\t\t\t\tmemcpy(vec.pt.val, prev_out, TDES_BLOCK_SIZE);\n+\t\t\t} else {\n+\t\t\t\tmemcpy(vec.iv.val, vec.ct.val, TDES_BLOCK_SIZE);\n+\t\t\t\tmemcpy(vec.ct.val, val.val, TDES_BLOCK_SIZE);\n+\t\t\t}\n+\n+\t\t\tif (j == TDES_INTERN_ITER - 1)\n+\t\t\t\tcontinue;\n+\n+\t\t\tmemcpy(prev_out, val.val, TDES_BLOCK_SIZE);\n+\n+\t\t\tif (j == TDES_INTERN_ITER - 3)\n+\t\t\t\tmemcpy(prev_prev_out, val.val, TDES_BLOCK_SIZE);\n+\t\t}\n+\n+\t\tinfo.parse_writeback(&val);\n+\t\tfprintf(info.fp_wr, \"\\n\");\n+\n+\t\tif (i == TDES_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+\n+\t\tif (info.interim_info.tdes_data.nb_keys == 0) {\n+\t\t\tif (memcmp(val_key.val, val_key.val + 8, 8) == 0)\n+\t\t\t\tinfo.interim_info.tdes_data.nb_keys = 1;\n+\t\t\telse if (memcmp(val_key.val, val_key.val + 16, 8) == 0)\n+\t\t\t\tinfo.interim_info.tdes_data.nb_keys = 2;\n+\t\t\telse\n+\t\t\t\tinfo.interim_info.tdes_data.nb_keys = 3;\n+\n+\t\t}\n+\n+\t\tfor (k = 0; k < TDES_BLOCK_SIZE; k++) {\n+\n+\t\t\tswitch (info.interim_info.tdes_data.nb_keys) {\n+\t\t\tcase 3:\n+\t\t\t\tval_key.val[k] ^= val.val[k];\n+\t\t\t\tval_key.val[k + 8] ^= prev_out[k];\n+\t\t\t\tval_key.val[k + 16] ^= prev_prev_out[k];\n+\t\t\t\tbreak;\n+\t\t\tcase 2:\n+\t\t\t\tval_key.val[k] ^= val.val[k];\n+\t\t\t\tval_key.val[k + 8] ^= prev_out[k];\n+\t\t\t\tval_key.val[k + 16] ^= val.val[k];\n+\t\t\t\tbreak;\n+\t\t\tdefault: /* case 1 */\n+\t\t\t\tval_key.val[k] ^= val.val[k];\n+\t\t\t\tval_key.val[k + 8] ^= val.val[k];\n+\t\t\t\tval_key.val[k + 16] ^= val.val[k];\n+\t\t\t\tbreak;\n+\t\t\t}\n+\n+\t\t}\n+\n+\t\tfor (k = 0; k < 24; k++)\n+\t\t\tval_key.val[k] = (__builtin_popcount(val_key.val[k]) &\n+\t\t\t\t\t0x1) ?\n+\t\t\t\t\tval_key.val[k] : (val_key.val[k] ^ 0x1);\n+\n+\t\tif (info.op == FIPS_TEST_ENC_AUTH_GEN) {\n+\t\t\tmemcpy(vec.iv.val, val.val, TDES_BLOCK_SIZE);\n+\t\t\tmemcpy(vec.pt.val, prev_out, TDES_BLOCK_SIZE);\n+\t\t} else {\n+\t\t\tmemcpy(vec.iv.val, prev_out, TDES_BLOCK_SIZE);\n+\t\t\tmemcpy(vec.ct.val, val.val, TDES_BLOCK_SIZE);\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n fips_mct_aes_test(void)\n {\n #define AES_BLOCK_SIZE\t16\n@@ -758,6 +925,14 @@ init_test_ops(void)\n \t\ttest_ops.prepare_xform = prepare_hmac_xform;\n \t\ttest_ops.test = fips_generic_test;\n \t\tbreak;\n+\tcase FIPS_TEST_ALGO_TDES:\n+\t\ttest_ops.prepare_op = prepare_cipher_op;\n+\t\ttest_ops.prepare_xform  = prepare_tdes_xform;\n+\t\tif (info.interim_info.tdes_data.test_type == TDES_MCT)\n+\t\t\ttest_ops.test = fips_mct_tdes_test;\n+\t\telse\n+\t\t\ttest_ops.test = fips_generic_test;\n+\t\tbreak;\n \n \tdefault:\n \t\treturn -1;\ndiff --git a/examples/fips_validation/meson.build b/examples/fips_validation/meson.build\nindex 57bcf81..781ad5f 100644\n--- a/examples/fips_validation/meson.build\n+++ b/examples/fips_validation/meson.build\n@@ -12,5 +12,6 @@ sources = files(\n \t'fips_validation_aes.c',\n \t'fips_validation.c',\n \t'fips_validation_hmac.c',\n+\t'fips_validation_tdes.c',\n \t'main.c'\n )\n",
    "prefixes": [
        "v7",
        "4/8"
    ]
}