From patchwork Tue Jul 10 16:01:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shally Verma X-Patchwork-Id: 42727 X-Patchwork-Delegate: pablo.de.lara.guarch@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B4CB31B42D; Tue, 10 Jul 2018 18:02:04 +0200 (CEST) Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0076.outbound.protection.outlook.com [104.47.34.76]) by dpdk.org (Postfix) with ESMTP id A14155F3B for ; Tue, 10 Jul 2018 18:02:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qtsoSmzTL2obASuQ33rf0I4Ot8jL7aehOWKYvHWK0W0=; b=ixBMTCyU+G3SIydlGGfer1RQ3fQkgCTt3gZ4fybUArbtdQ8FTG4rFN+rVmuV8bECU/qs+ckHaPoiDWRrjkqWvZjzmLajAx4zZ++F0F0ncdYU1BE3K1nr5U5Pmjngapne2wBrmjtsCOQcj9nlawq0e6NuiVqzTcPlMOfl5oMq5W0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Shally.Verma@cavium.com; Received: from hyd1sverma-dt.caveonetworks.com (115.113.156.2) by MWHPR0701MB3641.namprd07.prod.outlook.com (2603:10b6:301:7d::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.930.19; Tue, 10 Jul 2018 16:01:58 +0000 From: Shally Verma To: pablo.de.lara.guarch@intel.com Cc: dev@dpdk.org, pathreya@caviumnetworks.com, nmurthy@caviumnetworks.com, Sunila Sahu , Ashish Gupta , Umesh Kartha Date: Tue, 10 Jul 2018 21:31:31 +0530 Message-Id: <1531238491-10542-3-git-send-email-shally.verma@caviumnetworks.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1531238491-10542-1-git-send-email-shally.verma@caviumnetworks.com> References: <1531238491-10542-1-git-send-email-shally.verma@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [115.113.156.2] X-ClientProxiedBy: BM1PR01CA0098.INDPRD01.PROD.OUTLOOK.COM (2603:1096:b00::14) To MWHPR0701MB3641.namprd07.prod.outlook.com (2603:10b6:301:7d::34) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a3ea528a-3018-4ad3-4f70-08d5e67e78a1 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989117)(5600053)(711020)(4534165)(7168020)(4627221)(201703031133081)(201702281549075)(8990107)(2017052603328)(7153060)(7193020); SRVR:MWHPR0701MB3641; X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3641; 3:9ZNvbrGwqmfbhGQ4fxezKOC6VW+qMhMQGkTZVUuoY7t3Nw3baCXOhskVgurw2CPekv9v+ifHigYTtQZgCGMqZVrq/iZk6P7xT0TAPWXYcBsF5OrB7Rwvpp5VRIKHEGp4Ba5ZgKk18THk/Pdu727SlxxSIzh2iib3+IzeKtLvOS8C8hkZdz4s79SMW46Uz/2xrLF4y7BUS3VCmVnlZJWfml5t3NarNlz7+YT7GhzENZi+y5Ao22NVSStZ8It9yQDp; 25:OD0qS4XzDUJME9vzX5AP1bxG+XbXcnpPynyUfd8eVCSeK6oLjYRpqK+2x1eEI9SJp6FcfGTbOqPZTvU58LxShOwN0iGLBxlMRE+CVbvEgFpJxu17pgVGSSSF3Ofl8QPyyxNAhK2DFDEvmRP1Pvgt3g5xV2Z1N0E6/77h4VmK6v7n/e8J7rrQeF0NVVRG5cHaoaBEvn3JDaYvOaoumLkW4rH8yYL9B/yYqtDy0dyoY9SaqQjI2uV6QeCgD92FknMJ8XGCxsreBcCXTBRs61KPHb60J1dLbhMW3bfDIHDXMpptPjfJ7Wxac7gxEBbOqlvhUF0quv+8lGdaJavBMVd+oQ==; 31:CMKVmKQb2Hqy9W+/MwE/G7i6qIaXUZpqkS2Hlw7yG7yzcYnMdfW7K2b/8Va9tEKy61vaRJKvjxC9THrHT3gZksq6C3yttPeuH2ZNBlKjZfh/6ZZPMSpuQlHeThbVxS1mx0UCHZOd30SSAlO8Xn4cYVO5Lt6LOxppF7LDrkQTieklBiuKHzbswRg/4cag0TJZBlsInIw4n3l2wLLVDyFbm80faOpCTuslxLnxaD2qATs= X-MS-TrafficTypeDiagnostic: MWHPR0701MB3641: X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3641; 20:rbkgL4rE+c4BcT/NLXMjV4+LPBz/zBDGmEb6K6fkb4qy4ilI6fUce+cvgQXsFdeHJWfLhCcOOB67MIjPGJy4mBcqSRAxBqId2dMAolBd9KXoqiLmEe5qTv/R+CRlvocaTxmVG+O8A5pl9nkTICTsDUnJHfEsgsxgreWV+mAYMFqAAhFqbNjp9le/y00CGHNopAWb0FpcXOA52U03VrW1dHo0b6uDUHg2EbWFfXByb7zuHcW19L/9rEazH6ZeAPf35oJfrr95a1Cq5y2KcYDATmboFBZkT+5gUvZsZfRACfAZaTbQci0zZo9j3sMmdqfZpe4PMIbd9D79pkQqVVECtefxQ7ZKvw6/dF1yh1AgzMejy9A3fLY/MdL40NenyM8sqDK0qraMDMDqa8b6HdjEGGEQ5C5l+Fwk7aYhjJfON1vMAbYqHv0AzR4LgmaL+U+jrCRGkxn7NZUCli0uaTORzVF9Gzd5stPAL1a9+FibKZzUmcWG4XGZXecxTgIk650FU+hm3o5akR8lsu0FTZcsicuc8znC85F/2eWh4VqNiNB7HbtFX3TAfpiok20hPUr07ZTBREdUfe3CtYG86QoijEx3NusGK6mKDRL9e+08TBk=; 4:yKftpGfTi27LUc0j8n0LvdYTWD3wHsJSGaAOf5lo7r3pQRKGee4T3GJsQUcXtaj58GzFPT53Giu9jsTW8ZOd7SxtD6u2zIPzo6BcR/BTtbrQuw4EK3iu0Vv6MRiVSvr/zDRQZRt6zNvDZUhCJ5F81Qb4QGroAWZjuzp+NXAjM5W7pkt/XRiL1gsjODbrvaqlvTYZr1rPrIudW6/oSMXgJOV9vH9HCLeKaSQYQs7d+JW3uDk/ReePhfE/G+DuOWFio6NNWqsnbtz05KVztYNUVg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(10201501046)(3231311)(944501410)(52105095)(93006095)(3002001)(149027)(150027)(6041310)(20161123562045)(20161123564045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011)(7699016); SRVR:MWHPR0701MB3641; BCL:0; PCL:0; RULEID:; SRVR:MWHPR0701MB3641; X-Forefront-PRVS: 0729050452 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(979002)(366004)(396003)(39860400002)(136003)(376002)(346002)(189003)(199004)(16586007)(42882007)(2616005)(956004)(11346002)(36756003)(50466002)(48376002)(476003)(186003)(486006)(25786009)(47776003)(44832011)(446003)(2361001)(76176011)(16526019)(66066001)(14444005)(8936002)(81166006)(81156014)(6506007)(55236004)(3846002)(8676002)(6116002)(386003)(26005)(52116002)(5024004)(7736002)(51416003)(305945005)(2906002)(53936002)(68736007)(5660300001)(50226002)(72206003)(4326008)(478600001)(6666003)(2351001)(6916009)(575784001)(54906003)(107886003)(53416004)(6512007)(316002)(69596002)(6486002)(106356001)(105586002)(97736004)(969003)(989001)(999001)(1009001)(1019001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR0701MB3641; H:hyd1sverma-dt.caveonetworks.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: cavium.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR0701MB3641; 23:Dc5d7gUzbGWe/adEGSsOPWEDyQE5uP39JWxFSL0?= gXI/Ft8dzOFRx5vDp8TUZSBG2GQIjOn9mI6GdFf+abdozbw7T8tNWMDn5fR6Mc8gWC2fNLAIjiGTza/OEprh/pwsPPJp7Y4PARvErBQXoAXM4WZsNTvZCctBL7R9erTch1rEVweew4f/snR1N5vBCxWaKXJifJnJCA2WVf5w9OSDfhx0/y1WsGrBarhZgsKrVjq1DVAQ9mrPqTt2CsxAx55hja4asELX9pzO63b6vdLQGxyD/GSZxrlUdPms+qmK/bOzEz5FgC/IQK1+qrlawqVrIn3Noxw51zQ9Gp2WzuHOFh3Poii+7bEywHTRJkTNIAK8UOFg+vEe/l0ioia0YtAPcJLPRIdy7Tq/LAT0Ztua3SgfCkIynvM2urPTu2V5uZje80w+8taHABcT4lCMC9irT3/JHl2+uJcNLrI8JF3XvyTBQpHIIhrfZYDSF7Boy48xwt1n1YwsJIs18LTiqQvXNgW6nJD5IZU3MvXFEPiK1+vmAF3fJDHDj+1h9f+C8lKFqDo7pF2O/tT+uf4xcM3k4ke20A0YaTpAWyCs7WTattTJuThO+Y+9icA9/5UvHfSi0eRsLTli0pufY6SeueLH6wZyzLsaxjhdLKvjp1LuSNSdiJryddF2Skb/NDDVrhMhHgNb21Fu/ElfcWb1vY2m4h8W/RoX+8qjZi6gxRLl6YKV52AbbY3/o9DX4UheJhOKLEgWG9eBsF8mu5yusk8N2NRlCgv+HXG5qwryj6Yi0jXU04ZNJI1hI0Y/PAvKNecF3kaSBhkiGkoiP5rYftQLfjZ9Cgo3PciQwrNchwxkhVGWApqbfo3UYthKfWuXot5bEqCS3QZt804djUvloKca25Y9QFxD4vQ4a5B7wLy+L1Kcp3ev1aw/XyqRwgUPzgTIsZcGWIrR0IUZMxRSgBJ+cmcACKfn3fKtb+Qd8OGRFUltpftKlCjhu5CbkFcogh9ol+o9nlRww/adHooc8a9uQR7ohklG3MrnKfK/8dkPNB2vWCj03F5zr/4hwmIaFJc9cxfCwZxaZnxNkLQTZqsf/aK9UHsUeWVYix1YvJT5deyD/yEyNGWj4WSdHywvrHZzZ0Pffknf+73KoNSN+b4fZi8m5w+IkrVZ6/Eocl2mgjKliATRCMhLJfJx90l1fQ5kBDDnsjBTBbHJ+1Iv4zgm++y51JFWkcPKRhCpjz2oqKMQk0mfoMneVH04snB9jQIamq7ATpRUcKwENwhGau8sk9OtHC2aK31fXTSzBp3Qa0IV0A22ahXfRK34bId4JwSratpiLrNh6rABDn039AoJnUMScNztg6Y3fiD/JAU+rNcK8jkLa04p/s9zu4iKUu9XlZVAUrVYZIYV1ecRA4dGMFFPLIdWtuEUqHlzoJkoLKvJqw5LhILtiqdAp5rlNaewqqyT2sHMl8M1Vjo3UalLzPQ2q5rw9SkY1ISLy1twXziVlSn+lWhXKgZxD9jhb56E= X-Microsoft-Antispam-Message-Info: q3uFWSppNpR0ASCh6vZmcxY0hclycg68jIL6u58SgJPvaFYN5tXgJwt6s8gsjAJx2AC03GPLLZHy0P0WNR7Gr6qg9wYfwj/iUt+1Edgz6ROb2ddqj9XKaLMi30QI5m4Kfsc9n71tWXVKVNpKoPBZ6wHwWMW2/L89tFqlMyC5TWZvBkMsFLlV2N5P5TZadQiL5Lo64Ua1FcuvhMAUwwmChn2XrpDuXkiLfy7PDgj74CM1WW/RQ0VegQLU+DhWMWPZZ1re9ANSW839gimMSasbjHr3PvbIIRJMuKrEaFyS7nP9Yn3Zd38ciBH0AwFyaqbVCSzCO++xuN0oa2fBeKIKDi20EFxdBqnAzuPiNw3K+uM= X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3641; 6:TwaS7wuQjXvkN7/Lt14ReXwuu7OSqdolhMxS2BeS29KKu9IScSJGITArFp7+/JE8bDthWUoxf0IZ2D9KeG+sa+9uBGeGim0+dscGfWwJgtN7gbIRmTBVLZHCNoI4uFsQmQfm+iehNmyFMjHGtxH6ZIeeTXonKjq7b8D906/UzXFH0aVjxtxzH4zE/RNiso8hDp36mgbGXvDxPxtPJ+6UZl0GZPo6+WmEP5gNMnxlTN85aOmtrxzSQyLcJEECqIb5+XEqjbjXsAj8CR25DFl/wT3/4YtaiKbleqg7lGFlS/QOqDqieVZAVfESdnnEEkoOfgh7pOzo1MoPdytmCbKGCXbrxbwNXLpfV7Pta3oO7mSsi2JLDlS5c3bQrzYQaOvo5H6/fNQy4GUMJq2iwSBsMzA9fxlFwFCab2jNdquIOJDTqHmiugvvs2erBnIG1BzkeAt35h+AjRZU0C/ZJxbiQw==; 5:kJv9gk6FlrfPB6ihP1UWwQX3eiYtLQfzqzkpO6GQfDDaX1Pdze4wu1AziLSSta9c5G4ogqN3chv4bZ+8hP0j92RzWme7CE+rPSKm4pi/WY3wGFnwbbWrPO30HYm9GnfAQrImNly4fhs98B+AmzoHH+JwNpGj86KyOAY0utD/IFo=; 24:aq0YiXTFI++Vj+u70JSLKwsO6jZ3A84bNuRR46ktJF9nkSUBrvLgbNR2+s8fCNCD4HETf/AHFFKkmkFKMWAB8jlJiWyLbPAOg1Vnqad9ASg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR0701MB3641; 7:V5p868h7rjvsOvKRhqHJSc+eyJf0s83V1lWINKKUWwrkVfhDPrl6UiFsSQcYK21jmegeZbqhpAabor3s113brxj/hMH5xeeh8Ht2zUPR6go1Tif9lA/lWnDtnOXnSLI5C4uaZ9AHaRXJ+6EIwewaDCpgkJHdIRzjQe3LxiMjuQl3Stj/H4hy2Hea4R8LquGf8rX0x3Ge4prL5KVmpx39VQEFyWEVMv5u7mn/6h9Cg3M6IM94hDPt18F0JsRKNPQw X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jul 2018 16:01:58.3812 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a3ea528a-3018-4ad3-4f70-08d5e67e78a1 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR0701MB3641 Subject: [dpdk-dev] [PATCH v5 2/2] test/crypto: add dh and dsa tests X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Sunila Sahu Test application include test case for : - Diffie-Hellman key pair generation and shared secret compute - DSA sign and verify Test cases uses predefined test vectors. Signed-off-by: Sunila Sahu Signed-off-by: Shally Verma Signed-off-by: Ashish Gupta Signed-off-by: Umesh Kartha --- test/test/test_cryptodev_asym.c | 566 ++++++++++++++++++++++++++++ test/test/test_cryptodev_dh_test_vectors.h | 80 ++++ test/test/test_cryptodev_dsa_test_vectors.h | 117 ++++++ 3 files changed, 763 insertions(+) diff --git a/test/test/test_cryptodev_asym.c b/test/test/test_cryptodev_asym.c index 68ec6b0..2fdfc1d 100644 --- a/test/test/test_cryptodev_asym.c +++ b/test/test/test_cryptodev_asym.c @@ -15,6 +15,8 @@ #include #include "test_cryptodev.h" +#include "test_cryptodev_dh_test_vectors.h" +#include "test_cryptodev_dsa_test_vectors.h" #include "test_cryptodev_mod_test_vectors.h" #include "test_cryptodev_rsa_test_vectors.h" #include "test_cryptodev_asym_util.h" @@ -541,6 +543,386 @@ test_capability(void) } static int +test_dh_gen_shared_sec(struct rte_crypto_asym_xform *xfrm) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + struct rte_mempool *op_mpool = ts_params->op_mpool; + struct rte_mempool *sess_mpool = ts_params->session_mpool; + uint8_t dev_id = ts_params->valid_devs[0]; + struct rte_crypto_asym_op *asym_op = NULL; + struct rte_crypto_op *op = NULL, *result_op = NULL; + struct rte_cryptodev_asym_session *sess = NULL; + int status = TEST_SUCCESS; + uint8_t output[TEST_DH_MOD_LEN]; + struct rte_crypto_asym_xform xform = *xfrm; + uint8_t peer[] = "01234567890123456789012345678901234567890123456789"; + + sess = rte_cryptodev_asym_session_create(sess_mpool); + if (sess == NULL) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", __LINE__, + "Session creation failed"); + status = TEST_FAILED; + goto error_exit; + } + /* set up crypto op data structure */ + op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_ASYMMETRIC); + if (!op) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", + __LINE__, "Failed to allocate asymmetric crypto " + "operation struct"); + status = TEST_FAILED; + goto error_exit; + } + asym_op = op->asym; + + /* Setup a xform and op to generate private key only */ + xform.dh.type = RTE_CRYPTO_ASYM_OP_SHARED_SECRET_COMPUTE; + xform.next = NULL; + asym_op->dh.priv_key.data = dh_test_params.priv_key.data; + asym_op->dh.priv_key.length = dh_test_params.priv_key.length; + asym_op->dh.pub_key.data = (uint8_t *)peer; + asym_op->dh.pub_key.length = sizeof(peer); + asym_op->dh.shared_secret.data = output; + asym_op->dh.shared_secret.length = sizeof(output); + + if (rte_cryptodev_asym_session_init(dev_id, sess, &xform, + sess_mpool) < 0) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", + __LINE__, "unabled to config sym session"); + status = TEST_FAILED; + goto error_exit; + } + + /* attach asymmetric crypto session to crypto operations */ + rte_crypto_op_attach_asym_session(op, sess); + + RTE_LOG(DEBUG, USER1, "Process ASYM operation"); + + /* Process crypto operation */ + if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", + __LINE__, "Error sending packet for operation"); + status = TEST_FAILED; + goto error_exit; + } + + while (rte_cryptodev_dequeue_burst(dev_id, 0, &result_op, 1) == 0) + rte_pause(); + + if (result_op == NULL) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", + __LINE__, "Failed to process asym crypto op"); + status = TEST_FAILED; + goto error_exit; + } + + debug_hexdump(stdout, "shared secret:", + asym_op->dh.shared_secret.data, + asym_op->dh.shared_secret.length); + +error_exit: + if (sess != NULL) { + rte_cryptodev_asym_session_clear(dev_id, sess); + rte_cryptodev_asym_session_free(sess); + } + if (op != NULL) + rte_crypto_op_free(op); + return status; +} + +static int +test_dh_gen_priv_key(struct rte_crypto_asym_xform *xfrm) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + struct rte_mempool *op_mpool = ts_params->op_mpool; + struct rte_mempool *sess_mpool = ts_params->session_mpool; + uint8_t dev_id = ts_params->valid_devs[0]; + struct rte_crypto_asym_op *asym_op = NULL; + struct rte_crypto_op *op = NULL, *result_op = NULL; + struct rte_cryptodev_asym_session *sess = NULL; + int status = TEST_SUCCESS; + uint8_t output[TEST_DH_MOD_LEN]; + struct rte_crypto_asym_xform xform = *xfrm; + + sess = rte_cryptodev_asym_session_create(sess_mpool); + if (sess == NULL) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", __LINE__, + "Session creation failed"); + status = TEST_FAILED; + goto error_exit; + } + /* set up crypto op data structure */ + op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_ASYMMETRIC); + if (!op) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", + __LINE__, "Failed to allocate asymmetric crypto " + "operation struct"); + status = TEST_FAILED; + goto error_exit; + } + asym_op = op->asym; + + /* Setup a xform and op to generate private key only */ + xform.dh.type = RTE_CRYPTO_ASYM_OP_PRIVATE_KEY_GENERATE; + xform.next = NULL; + asym_op->dh.priv_key.data = output; + asym_op->dh.priv_key.length = sizeof(output); + + if (rte_cryptodev_asym_session_init(dev_id, sess, &xform, + sess_mpool) < 0) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", + __LINE__, "unabled to config sym session"); + status = TEST_FAILED; + goto error_exit; + } + + /* attach asymmetric crypto session to crypto operations */ + rte_crypto_op_attach_asym_session(op, sess); + + RTE_LOG(DEBUG, USER1, "Process ASYM operation"); + + /* Process crypto operation */ + if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", + __LINE__, "Error sending packet for operation"); + status = TEST_FAILED; + goto error_exit; + } + + while (rte_cryptodev_dequeue_burst(dev_id, 0, &result_op, 1) == 0) + rte_pause(); + + if (result_op == NULL) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", + __LINE__, "Failed to process asym crypto op"); + status = TEST_FAILED; + goto error_exit; + } + + debug_hexdump(stdout, "private key:", + asym_op->dh.priv_key.data, + asym_op->dh.priv_key.length); + + +error_exit: + if (sess != NULL) { + rte_cryptodev_asym_session_clear(dev_id, sess); + rte_cryptodev_asym_session_free(sess); + } + if (op != NULL) + rte_crypto_op_free(op); + + return status; +} + + +static int +test_dh_gen_pub_key(struct rte_crypto_asym_xform *xfrm) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + struct rte_mempool *op_mpool = ts_params->op_mpool; + struct rte_mempool *sess_mpool = ts_params->session_mpool; + uint8_t dev_id = ts_params->valid_devs[0]; + struct rte_crypto_asym_op *asym_op = NULL; + struct rte_crypto_op *op = NULL, *result_op = NULL; + struct rte_cryptodev_asym_session *sess = NULL; + int status = TEST_SUCCESS; + uint8_t output[TEST_DH_MOD_LEN]; + struct rte_crypto_asym_xform xform = *xfrm; + + sess = rte_cryptodev_asym_session_create(sess_mpool); + if (sess == NULL) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", __LINE__, + "Session creation failed"); + status = TEST_FAILED; + goto error_exit; + } + /* set up crypto op data structure */ + op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_ASYMMETRIC); + if (!op) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", + __LINE__, "Failed to allocate asymmetric crypto " + "operation struct"); + status = TEST_FAILED; + goto error_exit; + } + asym_op = op->asym; + /* Setup a xform chain to generate public key + * using test private key + * + */ + xform.dh.type = RTE_CRYPTO_ASYM_OP_PUBLIC_KEY_GENERATE; + xform.next = NULL; + + asym_op->dh.pub_key.data = output; + asym_op->dh.pub_key.length = sizeof(output); + /* load pre-defined private key */ + asym_op->dh.priv_key.data = rte_malloc(NULL, + dh_test_params.priv_key.length, + 0); + asym_op->dh.priv_key = dh_test_params.priv_key; + + if (rte_cryptodev_asym_session_init(dev_id, sess, &xform, + sess_mpool) < 0) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", + __LINE__, "unabled to config sym session"); + status = TEST_FAILED; + goto error_exit; + } + + /* attach asymmetric crypto session to crypto operations */ + rte_crypto_op_attach_asym_session(op, sess); + + RTE_LOG(DEBUG, USER1, "Process ASYM operation"); + + /* Process crypto operation */ + if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", + __LINE__, "Error sending packet for operation"); + status = TEST_FAILED; + goto error_exit; + } + + while (rte_cryptodev_dequeue_burst(dev_id, 0, &result_op, 1) == 0) + rte_pause(); + + if (result_op == NULL) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", + __LINE__, "Failed to process asym crypto op"); + status = TEST_FAILED; + goto error_exit; + } + + debug_hexdump(stdout, "pub key:", + asym_op->dh.pub_key.data, asym_op->dh.pub_key.length); + + debug_hexdump(stdout, "priv key:", + asym_op->dh.priv_key.data, asym_op->dh.priv_key.length); + +error_exit: + if (sess != NULL) { + rte_cryptodev_asym_session_clear(dev_id, sess); + rte_cryptodev_asym_session_free(sess); + } + if (op != NULL) + rte_crypto_op_free(op); + + return status; +} + +static int +test_dh_gen_kp(struct rte_crypto_asym_xform *xfrm) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + struct rte_mempool *op_mpool = ts_params->op_mpool; + struct rte_mempool *sess_mpool = ts_params->session_mpool; + uint8_t dev_id = ts_params->valid_devs[0]; + struct rte_crypto_asym_op *asym_op = NULL; + struct rte_crypto_op *op = NULL, *result_op = NULL; + struct rte_cryptodev_asym_session *sess = NULL; + int status = TEST_SUCCESS; + uint8_t out_pub_key[TEST_DH_MOD_LEN]; + uint8_t out_prv_key[TEST_DH_MOD_LEN]; + struct rte_crypto_asym_xform pub_key_xform; + struct rte_crypto_asym_xform xform = *xfrm; + + sess = rte_cryptodev_asym_session_create(sess_mpool); + if (sess == NULL) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", __LINE__, + "Session creation failed"); + status = TEST_FAILED; + goto error_exit; + } + + /* set up crypto op data structure */ + op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_ASYMMETRIC); + if (!op) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", + __LINE__, "Failed to allocate asymmetric crypto " + "operation struct"); + status = TEST_FAILED; + goto error_exit; + } + asym_op = op->asym; + /* Setup a xform chain to generate + * private key first followed by + * public key + */xform.dh.type = RTE_CRYPTO_ASYM_OP_PRIVATE_KEY_GENERATE; + pub_key_xform.xform_type = RTE_CRYPTO_ASYM_XFORM_DH; + pub_key_xform.dh.type = RTE_CRYPTO_ASYM_OP_PUBLIC_KEY_GENERATE; + xform.next = &pub_key_xform; + + asym_op->dh.pub_key.data = out_pub_key; + asym_op->dh.pub_key.length = sizeof(out_pub_key); + asym_op->dh.priv_key.data = out_prv_key; + asym_op->dh.priv_key.length = sizeof(out_prv_key); + if (rte_cryptodev_asym_session_init(dev_id, sess, &xform, + sess_mpool) < 0) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", + __LINE__, "unabled to config sym session"); + status = TEST_FAILED; + goto error_exit; + } + + /* attach asymmetric crypto session to crypto operations */ + rte_crypto_op_attach_asym_session(op, sess); + + RTE_LOG(DEBUG, USER1, "Process ASYM operation"); + + /* Process crypto operation */ + if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", + __LINE__, "Error sending packet for operation"); + status = TEST_FAILED; + goto error_exit; + } + + while (rte_cryptodev_dequeue_burst(dev_id, 0, &result_op, 1) == 0) + rte_pause(); + + if (result_op == NULL) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", + __LINE__, "Failed to process asym crypto op"); + status = TEST_FAILED; + goto error_exit; + } + debug_hexdump(stdout, "priv key:", + out_prv_key, asym_op->dh.priv_key.length); + debug_hexdump(stdout, "pub key:", + out_pub_key, asym_op->dh.pub_key.length); + +error_exit: + if (sess != NULL) { + rte_cryptodev_asym_session_clear(dev_id, sess); + rte_cryptodev_asym_session_free(sess); + } + if (op != NULL) + rte_crypto_op_free(op); + + return status; +} + +static int test_mod_inv(void) { struct crypto_testsuite_params *ts_params = &testsuite_params; @@ -769,12 +1151,196 @@ test_mod_exp(void) return status; } +static int +test_dh_keygenration(void) +{ + int status; + + debug_hexdump(stdout, "p:", dh_xform.dh.p.data, dh_xform.dh.p.length); + debug_hexdump(stdout, "g:", dh_xform.dh.g.data, dh_xform.dh.g.length); + debug_hexdump(stdout, "priv_key:", dh_test_params.priv_key.data, + dh_test_params.priv_key.length); + + RTE_LOG(INFO, USER1, + "Test Public and Private key pair generation\n"); + + status = test_dh_gen_kp(&dh_xform); + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + RTE_LOG(INFO, USER1, + "Test Public Key Generation using pre-defined priv key\n"); + + status = test_dh_gen_pub_key(&dh_xform); + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + RTE_LOG(INFO, USER1, + "Test Private Key Generation only\n"); + + status = test_dh_gen_priv_key(&dh_xform); + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + RTE_LOG(INFO, USER1, + "Test shared secret compute\n"); + + status = test_dh_gen_shared_sec(&dh_xform); + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + + return status; +} + +static int +test_dsa_sign(void) +{ + struct crypto_testsuite_params *ts_params = &testsuite_params; + struct rte_mempool *op_mpool = ts_params->op_mpool; + struct rte_mempool *sess_mpool = ts_params->session_mpool; + uint8_t dev_id = ts_params->valid_devs[0]; + struct rte_crypto_asym_op *asym_op = NULL; + struct rte_crypto_op *op = NULL, *result_op = NULL; + struct rte_cryptodev_asym_session *sess = NULL; + int status = TEST_SUCCESS; + uint8_t r[TEST_DH_MOD_LEN]; + uint8_t s[TEST_DH_MOD_LEN]; + uint8_t dgst[] = "35d81554afaad2cf18f3a1770d5fedc4ea5be344"; + + sess = rte_cryptodev_asym_session_create(sess_mpool); + if (sess == NULL) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", __LINE__, + "Session creation failed"); + status = TEST_FAILED; + goto error_exit; + } + /* set up crypto op data structure */ + op = rte_crypto_op_alloc(op_mpool, RTE_CRYPTO_OP_TYPE_ASYMMETRIC); + if (!op) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", + __LINE__, "Failed to allocate asymmetric crypto " + "operation struct"); + status = TEST_FAILED; + goto error_exit; + } + asym_op = op->asym; + + debug_hexdump(stdout, "p: ", dsa_xform.dsa.p.data, + dsa_xform.dsa.p.length); + debug_hexdump(stdout, "q: ", dsa_xform.dsa.q.data, + dsa_xform.dsa.q.length); + debug_hexdump(stdout, "g: ", dsa_xform.dsa.g.data, + dsa_xform.dsa.g.length); + debug_hexdump(stdout, "priv_key: ", dsa_xform.dsa.x.data, + dsa_xform.dsa.x.length); + + if (rte_cryptodev_asym_session_init(dev_id, sess, &dsa_xform, + sess_mpool) < 0) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", + __LINE__, "unabled to config sym session"); + status = TEST_FAILED; + goto error_exit; + } + + /* attach asymmetric crypto session to crypto operations */ + rte_crypto_op_attach_asym_session(op, sess); + asym_op->dsa.op_type = RTE_CRYPTO_ASYM_OP_SIGN; + asym_op->dsa.message.data = dgst; + asym_op->dsa.message.length = sizeof(dgst); + asym_op->dsa.r.length = sizeof(r); + asym_op->dsa.r.data = r; + asym_op->dsa.s.length = sizeof(s); + asym_op->dsa.s.data = s; + + RTE_LOG(DEBUG, USER1, "Process ASYM operation"); + + /* Process crypto operation */ + if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", + __LINE__, "Error sending packet for operation"); + status = TEST_FAILED; + goto error_exit; + } + + while (rte_cryptodev_dequeue_burst(dev_id, 0, &result_op, 1) == 0) + rte_pause(); + + if (result_op == NULL) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", + __LINE__, "Failed to process asym crypto op"); + status = TEST_FAILED; + goto error_exit; + } + + asym_op = result_op->asym; + + debug_hexdump(stdout, "r:", + asym_op->dsa.r.data, asym_op->dsa.r.length); + debug_hexdump(stdout, "s:", + asym_op->dsa.s.data, asym_op->dsa.s.length); + + /* Test PMD DSA sign verification using signer public key */ + asym_op->dsa.op_type = RTE_CRYPTO_ASYM_OP_VERIFY; + + /* copy signer public key */ + asym_op->dsa.y.data = dsa_test_params.y.data; + asym_op->dsa.y.length = dsa_test_params.y.length; + + /* Process crypto operation */ + if (rte_cryptodev_enqueue_burst(dev_id, 0, &op, 1) != 1) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", + __LINE__, "Error sending packet for operation"); + status = TEST_FAILED; + goto error_exit; + } + + while (rte_cryptodev_dequeue_burst(dev_id, 0, &result_op, 1) == 0) + rte_pause(); + + if (result_op == NULL) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", + __LINE__, "Failed to process asym crypto op"); + status = TEST_FAILED; + goto error_exit; + } + + if (result_op->status != RTE_CRYPTO_OP_STATUS_SUCCESS) { + RTE_LOG(ERR, USER1, + "line %u FAILED: %s", + __LINE__, "Failed to process asym crypto op"); + status = TEST_FAILED; + } +error_exit: + if (sess != NULL) { + rte_cryptodev_asym_session_clear(dev_id, sess); + rte_cryptodev_asym_session_free(sess); + } + if (op != NULL) + rte_crypto_op_free(op); + return status; +} + +static int +test_dsa(void) +{ + int status; + status = test_dsa_sign(); + TEST_ASSERT_EQUAL(status, 0, "Test failed"); + return status; +} + + static struct unit_test_suite cryptodev_openssl_asym_testsuite = { .suite_name = "Crypto Device OPENSSL ASYM Unit Test Suite", .setup = testsuite_setup, .teardown = testsuite_teardown, .unit_test_cases = { TEST_CASE_ST(ut_setup, ut_teardown, test_capability), + TEST_CASE_ST(ut_setup, ut_teardown, test_dsa), + TEST_CASE_ST(ut_setup, ut_teardown, test_dh_keygenration), TEST_CASE_ST(ut_setup, ut_teardown, test_rsa_enc_dec), TEST_CASE_ST(ut_setup, ut_teardown, test_rsa_sign_verify), TEST_CASE_ST(ut_setup, ut_teardown, test_mod_inv), diff --git a/test/test/test_cryptodev_dh_test_vectors.h b/test/test/test_cryptodev_dh_test_vectors.h new file mode 100644 index 0000000..fe7510d --- /dev/null +++ b/test/test/test_cryptodev_dh_test_vectors.h @@ -0,0 +1,80 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2018 Cavium Networks + */ + +#ifndef TEST_CRYPTODEV_DH_TEST_VECTORS_H_ +#define TEST_CRYPTODEV_DH_TEST_VECTORS_H_ + +#include "rte_crypto_asym.h" + +#define TEST_DATA_SIZE 4096 +#define TEST_DH_MOD_LEN 1024 + + +struct dh_test_param { + rte_crypto_param priv_key; +}; + +uint8_t dh_priv[] = { + 0x46, 0x3c, 0x7b, 0x43, 0xd1, 0xb8, 0xd4, 0x7a, + 0x56, 0x28, 0x85, 0x79, 0xcc, 0xd8, 0x90, 0x03, + 0x0c, 0x4b, 0xc6, 0xd3, 0x7f, 0xb3, 0x19, 0x84, + 0x8a, 0xc6, 0x0d, 0x24, 0x5e, 0xaa, 0x7e, 0x7a, + 0x73, 0x88, 0xa6, 0x47, 0x7c, 0x42, 0x78, 0x63, + 0x11, 0x12, 0xd3, 0xa0, 0xc5, 0xfe, 0xfd, 0xf2, + 0x9e, 0x17, 0x90, 0xe5, 0x6d, 0xcc, 0x20, 0x6f, + 0xe8, 0x82, 0x28, 0xbf, 0x5c, 0xe6, 0xd4, 0x86, + 0x5c, 0x35, 0x32, 0x97, 0xc2, 0x86, 0x1b, 0xc5, + 0x59, 0x1c, 0x0b, 0x1b, 0xec, 0x60, 0x3c, 0x1d, + 0x8d, 0x7f, 0xf0, 0xc7, 0x48, 0x3a, 0x51, 0x09, + 0xf2, 0x3e, 0x9e, 0x35, 0x74, 0x98, 0x4d, 0xad, + 0x39, 0xa7, 0xf2, 0xd2, 0xb4, 0x32, 0xd3, 0xc8, + 0xe9, 0x45, 0xbe, 0x56, 0xe7, 0x87, 0xe0, 0xa0, + 0x97, 0x6b, 0x5f, 0x99, 0x5e, 0x41, 0x59, 0x33, + 0x95, 0x64, 0x0d, 0xe9, 0x58, 0x5b, 0xa6, 0x38 +}; + +uint8_t dh_p[] = { + 0xef, 0xee, 0x8c, 0x8b, 0x3f, 0x85, 0x95, 0xcd, + 0x4d, 0x68, 0x5d, 0x4a, 0x5d, 0x1f, 0x2a, 0x2e, + 0xdd, 0xcf, 0xef, 0x1b, 0x3b, 0xe9, 0x7b, 0x0c, + 0x13, 0xee, 0x76, 0xd5, 0x93, 0xca, 0x8b, 0xc8, + 0x0b, 0x97, 0x00, 0xec, 0x1f, 0x34, 0xa2, 0xce, + 0x83, 0x8d, 0x80, 0xea, 0xfe, 0x11, 0xed, 0x28, + 0xdd, 0x32, 0x22, 0x77, 0x96, 0x4e, 0xc5, 0xed, + 0xc8, 0x7a, 0x52, 0x10, 0x22, 0xcc, 0xb2, 0x4d, + 0xd3, 0xda, 0x03, 0xf5, 0x1e, 0xa8, 0x79, 0x23, + 0x8b, 0xe1, 0x78, 0x47, 0x07, 0x5b, 0x26, 0xbb, + 0x53, 0x46, 0x0b, 0x18, 0x5c, 0x07, 0x4e, 0xb6, + 0x76, 0xc9, 0xa8, 0xd5, 0x30, 0xa3, 0xbe, 0x8d, + 0xae, 0xcd, 0x34, 0x68, 0x62, 0x5f, 0xb9, 0x5c, + 0x34, 0x90, 0xf0, 0xda, 0x47, 0x86, 0x36, 0x04, + 0x28, 0xbc, 0x7d, 0xae, 0x9d, 0x4e, 0x61, 0x28, + 0x70, 0xdb, 0xa6, 0x55, 0x04, 0x46, 0x27, 0xe3 +}; + +uint8_t dh_g[] = {0x02}; + +struct dh_test_param dh_test_params = { + .priv_key = { + .data = dh_priv, + .length = sizeof(dh_priv) + } +}; + +struct rte_crypto_asym_xform dh_xform = { + .next = NULL, + .xform_type = RTE_CRYPTO_ASYM_XFORM_DH, + .dh = { + .p = { + .data = dh_p, + .length = sizeof(dh_p) + }, + .g = { + .data = dh_g, + .length = sizeof(dh_g) + }, + } +}; + +#endif /* TEST_CRYPTODEV_DH_TEST_VECTORS_H__ */ diff --git a/test/test/test_cryptodev_dsa_test_vectors.h b/test/test/test_cryptodev_dsa_test_vectors.h new file mode 100644 index 0000000..bbcb0d7 --- /dev/null +++ b/test/test/test_cryptodev_dsa_test_vectors.h @@ -0,0 +1,117 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2018 Cavium Networks + */ + +#ifndef TEST_CRYPTODEV_DSA_TEST_VECTORS_H_ +#define TEST_CRYPTODEV_DSA_TEST_VECTORS_H_ + +#include "rte_crypto_asym.h" + +#define TEST_DATA_SIZE 4096 + + +struct dsa_test_param { + rte_crypto_param y; +}; + +static unsigned char dsa_x[] = { + 0xc5, 0x3e, 0xae, 0x6d, 0x45, 0x32, 0x31, 0x64, + 0xc7, 0xd0, 0x7a, 0xf5, 0x71, 0x57, 0x03, 0x74, + 0x4a, 0x63, 0xfc, 0x3a +}; + +uint8_t dsa_y[] = { + 0x31, 0x3f, 0xd9, 0xeb, 0xca, 0x91, 0x57, 0x4e, + 0x1c, 0x2e, 0xeb, 0xe1, 0x51, 0x7c, 0x57, 0xe0, + 0xc2, 0x1b, 0x02, 0x09, 0x87, 0x21, 0x40, 0xc5, + 0x32, 0x87, 0x61, 0xbb, 0xb2, 0x45, 0x0b, 0x33, + 0xf1, 0xb1, 0x8b, 0x40, 0x9c, 0xe9, 0xab, 0x7c, + 0x4c, 0xd8, 0xfd, 0xa3, 0x39, 0x1e, 0x8e, 0x34, + 0x86, 0x83, 0x57, 0xc1, 0x99, 0xe1, 0x6a, 0x6b, + 0x2e, 0xba, 0x06, 0xd6, 0x74, 0x9d, 0xef, 0x79, + 0x1d, 0x79, 0xe9, 0x5d, 0x3a, 0x4d, 0x09, 0xb2, + 0x4c, 0x39, 0x2a, 0xd8, 0x9d, 0xbf, 0x10, 0x09, + 0x95, 0xae, 0x19, 0xc0, 0x10, 0x62, 0x05, 0x6b, + 0xb1, 0x4b, 0xce, 0x00, 0x5e, 0x87, 0x31, 0xef, + 0xde, 0x17, 0x5f, 0x95, 0xb9, 0x75, 0x08, 0x9b, + 0xdc, 0xda, 0xea, 0x56, 0x2b, 0x32, 0x78, 0x6d, + 0x96, 0xf5, 0xa3, 0x1a, 0xed, 0xf7, 0x53, 0x64, + 0x00, 0x8a, 0xd4, 0xff, 0xfe, 0xbb, 0x97, 0x0b +}; + +static unsigned char dsa_p[] = { + 0xa8, 0xf9, 0xcd, 0x20, 0x1e, 0x5e, 0x35, 0xd8, + 0x92, 0xf8, 0x5f, 0x80, 0xe4, 0xdb, 0x25, 0x99, + 0xa5, 0x67, 0x6a, 0x3b, 0x1d, 0x4f, 0x19, 0x03, + 0x30, 0xed, 0x32, 0x56, 0xb2, 0x6d, 0x0e, 0x80, + 0xa0, 0xe4, 0x9a, 0x8f, 0xff, 0xaa, 0xad, 0x2a, + 0x24, 0xf4, 0x72, 0xd2, 0x57, 0x32, 0x41, 0xd4, + 0xd6, 0xd6, 0xc7, 0x48, 0x0c, 0x80, 0xb4, 0xc6, + 0x7b, 0xb4, 0x47, 0x9c, 0x15, 0xad, 0xa7, 0xea, + 0x84, 0x24, 0xd2, 0x50, 0x2f, 0xa0, 0x14, 0x72, + 0xe7, 0x60, 0x24, 0x17, 0x13, 0xda, 0xb0, 0x25, + 0xae, 0x1b, 0x02, 0xe1, 0x70, 0x3a, 0x14, 0x35, + 0xf6, 0x2d, 0xdf, 0x4e, 0xe4, 0xc1, 0xb6, 0x64, + 0x06, 0x6e, 0xb2, 0x2f, 0x2e, 0x3b, 0xf2, 0x8b, + 0xb7, 0x0a, 0x2a, 0x76, 0xe4, 0xfd, 0x5e, 0xbe, + 0x2d, 0x12, 0x29, 0x68, 0x1b, 0x5b, 0x06, 0x43, + 0x9a, 0xc9, 0xc7, 0xe9, 0xd8, 0xbd, 0xe2, 0x83 +}; + +static unsigned char dsa_q[] = { + 0xf8, 0x5f, 0x0f, 0x83, 0xac, 0x4d, 0xf7, 0xea, + 0x0c, 0xdf, 0x8f, 0x46, 0x9b, 0xfe, 0xea, 0xea, + 0x14, 0x15, 0x64, 0x95 +}; + +static unsigned char dsa_g[] = { + 0x2b, 0x31, 0x52, 0xff, 0x6c, 0x62, 0xf1, 0x46, + 0x22, 0xb8, 0xf4, 0x8e, 0x59, 0xf8, 0xaf, 0x46, + 0x88, 0x3b, 0x38, 0xe7, 0x9b, 0x8c, 0x74, 0xde, + 0xea, 0xe9, 0xdf, 0x13, 0x1f, 0x8b, 0x85, 0x6e, + 0x3a, 0xd6, 0xc8, 0x45, 0x5d, 0xab, 0x87, 0xcc, + 0x0d, 0xa8, 0xac, 0x97, 0x34, 0x17, 0xce, 0x4f, + 0x78, 0x78, 0x55, 0x7d, 0x6c, 0xdf, 0x40, 0xb3, + 0x5b, 0x4a, 0x0c, 0xa3, 0xeb, 0x31, 0x0c, 0x6a, + 0x95, 0xd6, 0x8c, 0xe2, 0x84, 0xad, 0x4e, 0x25, + 0xea, 0x28, 0x59, 0x16, 0x11, 0xee, 0x08, 0xb8, + 0x44, 0x4b, 0xd6, 0x4b, 0x25, 0xf3, 0xf7, 0xc5, + 0x72, 0x41, 0x0d, 0xdf, 0xb3, 0x9c, 0xc7, 0x28, + 0xb9, 0xc9, 0x36, 0xf8, 0x5f, 0x41, 0x91, 0x29, + 0x86, 0x99, 0x29, 0xcd, 0xb9, 0x09, 0xa6, 0xa3, + 0xa9, 0x9b, 0xbe, 0x08, 0x92, 0x16, 0x36, 0x81, + 0x71, 0xbd, 0x0b, 0xa8, 0x1d, 0xe4, 0xfe, 0x33 +}; + +struct dsa_test_param dsa_test_params = { + .y = { + .data = dsa_y, + .length = sizeof(dsa_y) + } +}; + +struct rte_crypto_asym_xform dsa_xform = { + .next = NULL, + .xform_type = RTE_CRYPTO_ASYM_XFORM_DSA, + .dsa = { + .p = { + .data = dsa_p, + .length = sizeof(dsa_p) + }, + .q = { + .data = dsa_q, + .length = sizeof(dsa_q) + }, + .g = { + .data = dsa_g, + .length = sizeof(dsa_g) + }, + .x = { + .data = dsa_x, + .length = sizeof(dsa_x) + } + + } +}; + +#endif /* TEST_CRYPTODEV_DSA_TEST_VECTORS_H__ */