From patchwork Fri Jan 29 13:33:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catalin Vasile X-Patchwork-Id: 8163251 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: X-Original-To: patchwork-linux-crypto@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1C804BEEE5 for ; Fri, 29 Jan 2016 13:47:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 97FF92038A for ; Fri, 29 Jan 2016 13:47:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E821D20386 for ; Fri, 29 Jan 2016 13:47:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756154AbcA2Nrw (ORCPT ); Fri, 29 Jan 2016 08:47:52 -0500 Received: from mail-bl2on0057.outbound.protection.outlook.com ([65.55.169.57]:12989 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752959AbcA2Nru (ORCPT ); Fri, 29 Jan 2016 08:47:50 -0500 Received: from BLUPR0301CA0017.namprd03.prod.outlook.com (10.162.113.155) by CY1PR0301MB0698.namprd03.prod.outlook.com (10.160.159.140) with Microsoft SMTP Server (TLS) id 15.1.396.15; Fri, 29 Jan 2016 13:33:42 +0000 Received: from BN1AFFO11FD037.protection.gbl (2a01:111:f400:7c10::182) by BLUPR0301CA0017.outlook.office365.com (2a01:111:e400:5259::27) with Microsoft SMTP Server (TLS) id 15.1.396.15 via Frontend Transport; Fri, 29 Jan 2016 13:33:42 +0000 Authentication-Results: spf=fail (sender IP is 192.88.158.2) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=none action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.158.2 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.158.2; helo=az84smr01.freescale.net; Received: from az84smr01.freescale.net (192.88.158.2) by BN1AFFO11FD037.mail.protection.outlook.com (10.58.52.241) with Microsoft SMTP Server (TLS) id 15.1.355.15 via Frontend Transport; Fri, 29 Jan 2016 13:33:41 +0000 Received: from enigma.ea.freescale.net (enigma.ea.freescale.net [10.171.77.120]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id u0TDXCYP009579; Fri, 29 Jan 2016 06:33:39 -0700 From: Catalin Vasile To: CC: , , , , Catalin Vasile Subject: [RFC 1/2] crypto: tcrypt - Add acipher bandwidth tests support Date: Fri, 29 Jan 2016 15:33:06 +0200 Message-ID: <1454074387-8321-2-git-send-email-cata.vasile@nxp.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1454074387-8321-1-git-send-email-cata.vasile@nxp.com> References: <1454074387-8321-1-git-send-email-cata.vasile@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 130985480217530150; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD037; 1:UghTIf0D9Jy3TjsJpbOmm26R5xPyKwmPPu0QZNvNsbEkRBJLAurljdPhFdXLXxulBbd/w3wBw817+Bb+zvIxsdnmwZuoX/RIa1B9H9WObru8kjZoTrWS21KUlJeTuaAd5t1oTIbaUD6XqhsWmfXKhIKFO1mhfjUrMWuXT9YNqhcdXUyf++aRt/LJP4OT2shtK6Xj30QQ5C3LyWeimy429lJsftKzhGhPe7Dwby+1TY5MbIrzye/0WqDx12ED3HRkvnX/gbOhjtODK6uOpsW4I2wE5acsNbDtll3KvP8u72RGsQbQFSegmYrrQGhzfhK39FbeBMGkf2D39POH/7qYPDhc3uIvMqu7s6ONcqdH46mqDQvIQ/sbSFgZJNhm/6qHiRLYWRGlkqt+ARpFcaVm2ayKOAPeIirFGpIc+SsNLQi84mrdUm46Uc1rxdOkXpGKm4TAEi4/9LY/AhK+gmpaHtn6WWD581VNlTHBGnfdGBaNDp+9f3+pyLQmvrEIz3FEO5YJJLZX0YPRoTh2HIuczt88cRTK3m2IOye4Lo0lQ0/L5KptZ+6noF1W/wX9bjMJmSu6p0mRTdw68xlFzzAwrg== X-Forefront-Antispam-Report: CIP:192.88.158.2; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(47776003)(2950100001)(106466001)(2906002)(85426001)(4326007)(86362001)(105606002)(33646002)(6806005)(229853001)(1220700001)(76176999)(2351001)(1096002)(586003)(50986999)(104016004)(5008740100001)(50226001)(11100500001)(77096005)(36756003)(87936001)(50466002)(48376002)(92566002)(19580405001)(19580395003)(189998001)(5003940100001)(5001960100002)(110136002)(3470700001)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB0698; H:az84smr01.freescale.net; FPR:; SPF:Fail; MLV:sfv; A:1; MX:1; LANG:en; MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 348e40e7-9bba-460c-8f26-08d328b0cd90 X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0698; 2:x4L91HatuxA6KHZC2YLamCI1lySrfYR7JJDaK0sAIVehoQ+x+wgLv68BgKFoZeyLK70wyNM4KiN8+h22XPlR0V4t4ULgF1FwDmtLNUurp9mrsg6iBTtihkaaQ0oiLpMT+YINRVmJzddJxRrTBGNt9tuvfHkcmldd5UwZdnaAYbexZ/wAwyv6ap3qWABTf+vx; 3:C1jtFr+ug5alu1dHZm+03gE9+ErrhH6IESUGvUVoT1mEQbmmGF0cyCMx5HGQI0Pm6mqOAOza5HtdOdoIC4k2PnnM+1CtEFS6a2n3R89kF9e1RVyHowKYbirTadhp1DsqBSjjmrTw0O3f7pbAosM737Y0xzl7vMng7Vxas3g0a5Bg6W6ipoEWNgnLluwFt30q272SuL6n8+KTKwJbiUqbWnDmGg4X+zJGWFaA6Yh+kbQ=; 25:Vq0a0XX3jkrc+OJ1tIUyDJ2Khqtwlw7wcnwUu7Q4PR4uP9d9J49A+CvZRKQqDb3v6mI/oMrbiXmKKUl7n8PA04LSpwfa6RWttrCCFn8EfLWG6JgWah/r3Saz7pG6HDq3wRogQ/KeUwV73aYGso7XIth60RMp5BFvUkEJyMj3CcGy2ODUno5VMsHL37QZgT65U8AhM4XjCb3WWycj3drhWU8dJ4qRs3Qlzszjqh8PXANmJZXy7iVcHhzlHyphv4Hh X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR0301MB0698; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(13017025)(13015025)(13018025)(5005006)(13023025)(13024025)(3002001)(10201501046); SRVR:CY1PR0301MB0698; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR0301MB0698; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0698; 4:ZObHV7rPg5c+6zHoCWzIIMbGP3x7xXEHPpKFOyhMF11X5Fai+SrEYkWdogApku/sCu8jjsE3wZDL0Ilpj7fwefKDxWZhvAebhA0vn0/KvQT6Mnd8bWesbEHw1OQlDp8WjntrMCPxYbZLPE9sr99pPFirS+xvWe0upF3KuwFRUpiNQZ8hmB2FbVlCKV+TBy4gHhhJmyZKhSp9GQWi4faTIapuobzL/w8P99dAltev8kyon8bgcEBOmGvDIcEm4EeB1rw/IpbF6BzcAoOBzagosSTQdfYC98TbVhsIgdTTZ97JkFOsQSK4pve8NgwyGHqifVEMVjI5pr10Y7Vxda/E6qebsCR0vPlVehPEJmeNxTtaV1I58ArFZ+26STrIQMPYdQSoSvGBZFAqX8WuyitV7iBT2HuihlrBU+J+Lh8Fe8+KLEbonWSq5sGlbHrxslhz/eFKIzqzL/l/fwYr7k03+pIDDEVK8wBVLQTZODwyNm9GupDyreyVgIwtrfatmCF6 X-Forefront-PRVS: 083691450C X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB0698; 23:Jph6ECO4bOkxBC8pDBAEP4R6L33X2lf+YDL7SXM?= =?us-ascii?Q?UG3Qae/JXuacBq6Ymki2yzZiRxMW4Hec5Q4ejHdCxG+DBzkMM/BrofW091Rd?= =?us-ascii?Q?v09zuvxQIVQYhF2gLIINt7ozFlJO3j6CNIVSmr/w3w3nAUvsEZQ73EyXUvNW?= =?us-ascii?Q?kO1GPFJ7GQeo4Beb126dsJ46lKbfmcH6grgCbsn0qygaCGEzWMW8ECJ6rXJx?= =?us-ascii?Q?WvM2Yjzw2NoM1ypQ8Z36DI3mR8xekcwwDqV5ya3Nm+jrwCk1oWPiW6aptwjv?= =?us-ascii?Q?lWwQMtGTUXE01RVofGfVprXNHEHlnhpjjHS+O/HGolfwfp50yFz5cwTA+4by?= =?us-ascii?Q?J6W62+nFnGXRiyy6bXAP6YJlLfH8RDG5gYz4p3WanJtUe/T8YfEeRM6c7nyB?= =?us-ascii?Q?fzdcO+LuuCl1KIzJpQkkUdslnlS1mtpDFMTm+pWcQkqTOy1SjWoETMDsTEdU?= =?us-ascii?Q?aZbclV4WOHaHYNUwgG1Rz8jJRQt89e/7c/2PMforDdiIrTOea61cuXJFXBiw?= =?us-ascii?Q?FEG7z7U3cp5i1xOFyLWU8De9OIxt6lIFo2eqZzrvm0wWFuB97h9fG/J+0Llm?= =?us-ascii?Q?LKRvGWOWtHTnIl/p07Bw9tkC7mYDTnVw1VsSYL7JsWF4Px5TL4MzkM57hu41?= =?us-ascii?Q?7bWIG6qjeTRInjE5RbgN0ZIfJTbMEslQqIdiIABZwli2dGd9awdz4zolAKgF?= =?us-ascii?Q?qPtPkJqNBvVo85Wx5fow+Ikmz6901a1g729h6sO7iXTY34OijGRCSAmkZCCR?= =?us-ascii?Q?9gfghnC0I072/8BLld4MGOXbRxZmgqvuCNHSY1m22t1TFwRnto9KC8biK/HO?= =?us-ascii?Q?0FG88cPjaU2C3KMgwaTk2E1i60E5s/fZ56r6eqRZ/tx01ons3z56wfKn/G67?= =?us-ascii?Q?meiVhRUt5f0eH9XNADfGaSh+W+EnkhPXRyEWX4wdrfK7TtyuOOriuov67Neg?= =?us-ascii?Q?Ep9b6gB7V7Rf3y1TR3a01ZfZN5wPcpu26A5xy0Vz/vMjlQxTK++qb2tcwHtE?= =?us-ascii?Q?b1Wc628+dDNm8/k+gGddlYaZvKGbF92dAZe7axJrUZJeFy0oKMAZq5G4sUss?= =?us-ascii?Q?kd936lngjMzNA0fA7EOYnTSyrhrjwDUaCuvo1klRE2joiLRvuoQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB0698; 5:bN7c6Tyz3XdF3b3HDfsFOG63+Yib/fAaJqlth2Wp6vdvInZPRCf9TACOdNlJRK8KJ3KgxNV9uUiFmM1eUczVzuK4h8ELkBcgikqTZIzJiLJrCjHSRF3/djHeu2MYEmo47Rk0MeWkHzAkp84hW8vGsMZNgg3KYKW3+b6HJEE8ckQ=; 24:QSk7iI9vvjXClcawC/NskqwGV6TNl5vYyLeiMvwYRHSd7RhejmA2QnOER852+DFPZJVB+smZMb6WKRhyPVjFEDX37iE+algcPFh/BXdxWlY= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jan 2016 13:33:41.5346 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.158.2]; Helo=[az84smr01.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR0301MB0698 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Catalin Vasile --- crypto/tcrypt.c | 501 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 501 insertions(+) diff --git a/crypto/tcrypt.c b/crypto/tcrypt.c index 270bc4b..f56419d 100644 --- a/crypto/tcrypt.c +++ b/crypto/tcrypt.c @@ -35,6 +35,7 @@ #include #include #include +#include #include "tcrypt.h" /* @@ -1021,6 +1022,300 @@ out: crypto_free_ahash(tfm); } + +struct band_session_ctx { + mempool_t *req_mpool; + int job_size; + void *tfm; +}; + +struct band_req_ctx { + struct completion completion; + int err; + struct scatterlist sg[TVMEMSIZE]; + struct band_session_ctx *session; + char iv[128]; +}; +atomic_t band_async_done; + +static inline void band_free_request(struct crypto_async_request *req) +{ + struct band_req_ctx *res = req->data; + struct band_session_ctx *ses_ctx = res->session; + + kfree(sg_virt(res->sg)); + mempool_free(req, ses_ctx->req_mpool); +} + +static void band_complete(struct crypto_async_request *req, int err) +{ + struct band_req_ctx *res = req->data; + + res->err = err; + + /* if it previously was -EBUSY */ + if (err == -EINPROGRESS) { + complete(&res->completion); + } else { + if (unlikely(err < 0)) + pr_err("failed bandwidth acipher job with error: %d\n", + err); + band_free_request(req); + atomic_inc(&band_async_done); + } +} + +static inline int band_alloc_req(struct band_session_ctx *ses_ctx, + void **req, + void **buf_sg) +{ + *req = mempool_alloc(ses_ctx->req_mpool, GFP_KERNEL); + if (unlikely(!*req)) + goto out; + + *buf_sg = kmalloc(ses_ctx->job_size, GFP_KERNEL); + if (unlikely(!*buf_sg)) + goto out_free_req; + + return 0; + +out_free_req: + mempool_free(req, ses_ctx->req_mpool); +out: + pr_err("out of memory for bandwidth benchmark request\n"); + return -ENOMEM; +} + +static inline struct ablkcipher_request +*band_acipher_alloc_req(struct band_session_ctx *ses_ctx) +{ + struct ablkcipher_request *req; + struct band_req_ctx *br; + void *buf_sg; + size_t req_size = sizeof(struct ablkcipher_request) + + crypto_ablkcipher_reqsize(ses_ctx->tfm); + size_t no_sg_entries = DIV_ROUND_UP(ses_ctx->job_size, PAGE_SIZE); + int rv; + int i; + + rv = band_alloc_req(ses_ctx, (void **)&req, (void **)&buf_sg); + if (unlikely(rv)) + return NULL; + + br = ((void *)req) + req_size; + sg_init_table(br->sg, no_sg_entries); + if (ses_ctx->job_size < PAGE_SIZE) + sg_set_buf(br->sg, buf_sg, ses_ctx->job_size); + else + for (i = 0; i < no_sg_entries; i++) { + sg_set_buf(br->sg + i, buf_sg, PAGE_SIZE); + buf_sg += PAGE_SIZE; + } + ablkcipher_request_set_tfm(req, ses_ctx->tfm); + ablkcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG, + band_complete, br); + ablkcipher_request_set_crypt(req, br->sg, br->sg, + ses_ctx->job_size, br->iv); + + init_completion(&br->completion); + br->session = ses_ctx; + + return req; +} + +static inline int do_one_band_op(struct crypto_async_request *req, int ret) +{ + struct band_req_ctx *br = req->data; + + if (ret == -EBUSY) { + wait_for_completion(&br->completion); + reinit_completion(&br->completion); + ret = br->err; + } else { + if (ret != -EINPROGRESS) { + band_free_request(req); + atomic_inc(&band_async_done); + } + } + + return ret; +} + +static int band_acipher_jiffies(struct band_session_ctx *ses_ctx, + int enc, int secs) +{ + struct ablkcipher_request *req; + unsigned long start, end; + unsigned long stop; + int elapsed_secs; + int bcount; + int no_jobs_done; + int ret = 0; + unsigned long long band; + + for (start = jiffies, end = start + secs * HZ, bcount = 0; + time_before(jiffies, end); bcount++) { + req = band_acipher_alloc_req(ses_ctx); + if (unlikely(req == NULL)) + break; + if (enc) + ret = do_one_band_op(&req->base, + crypto_ablkcipher_encrypt(req)); + else + ret = do_one_band_op(&req->base, + crypto_ablkcipher_decrypt(req)); + + if (unlikely(ret != -EINPROGRESS && ret)) + break; + } + + stop = jiffies; + no_jobs_done = atomic_read(&band_async_done); + elapsed_secs = (stop - start) / HZ; + + while (atomic_read(&band_async_done) < bcount) + cpu_relax(); + + band = ses_ctx->job_size; + band = no_jobs_done * band; + pr_cont("%d operations in %d seconds (%llu bytes)\n", + no_jobs_done, elapsed_secs, band); + + if (likely(ret == -EINPROGRESS || ret)) + ret = 0; + + return ret; +} + +static inline int +band_acipher_init_session_ctx(const char *algo, + struct band_session_ctx *ses_ctx) +{ + struct crypto_ablkcipher *tfm; + struct kmem_cache *req_cache; + mempool_t *req_mpool; + size_t req_size; + int err; + + tfm = crypto_alloc_ablkcipher(algo, 0, 0); + if (IS_ERR(tfm)) { + pr_err("failed to load transform for %s: %ld\n", algo, + PTR_ERR(tfm)); + return PTR_ERR(tfm); + } + + req_size = sizeof(struct ablkcipher_request) + + crypto_ablkcipher_reqsize(tfm) + + sizeof(struct band_req_ctx); + req_cache = kmem_cache_create("tcrypt-band-acipher-req", + req_size, 0, 0, NULL); + if (unlikely(!req_cache)) { + pr_err("failed to allocate request cache memory\n"); + err = -ENOMEM; + goto out; + } + + req_mpool = mempool_create(1024, mempool_alloc_slab, mempool_free_slab, + req_cache); + if (unlikely(!req_mpool)) { + pr_err("failed to allocate request memory pool\n"); + err = -ENOMEM; + goto out_free_cache; + } + + ses_ctx->req_mpool = req_mpool; + ses_ctx->tfm = tfm; + + return 0; + +out_free_cache: + kmem_cache_destroy(req_cache); +out: + crypto_free_ablkcipher(tfm); + return err; +} + +static inline void +band_acipher_destroy_session_ctx(struct band_session_ctx *ses_ctx) +{ + struct kmem_cache *req_cache = ses_ctx->req_mpool->pool_data; + + mempool_destroy(ses_ctx->req_mpool); + kmem_cache_destroy(req_cache); + crypto_free_ablkcipher(ses_ctx->tfm); +} + +static void band_acipher(const char *algo, int enc, unsigned int secs, + struct cipher_speed_template *template, + unsigned int tcount, u8 *keysize) +{ + struct band_session_ctx ses_ctx; + int ret, i, j; + const char *key; + const char *e; + u32 *b_size; + + if (!secs) + return; + + if (enc == ENCRYPT) + e = "encryption"; + else + e = "decryption"; + + ret = band_acipher_init_session_ctx(algo, &ses_ctx); + if (unlikely(ret)) + return; + + pr_info("\ntesting band of async %s (%s) %s\n", algo, + get_driver_name(crypto_ablkcipher, ses_ctx.tfm), e); + + i = 0; + do { + b_size = aead_sizes; + + do { + pr_info("test %u (%d bit key, %d byte blocks): ", i, + *keysize * 8, *b_size); + + memset(tvmem[0], 0xff, PAGE_SIZE); + + /* set key, plain text and IV */ + key = tvmem[0]; + for (j = 0; j < tcount; j++) { + if (template[j].klen == *keysize) { + key = template[j].key; + break; + } + } + + crypto_ablkcipher_clear_flags(ses_ctx.tfm, ~0); + + ret = crypto_ablkcipher_setkey(ses_ctx.tfm, + key, *keysize); + if (ret) { + pr_err("setkey() failed flags=%x\n", + crypto_ablkcipher_get_flags(ses_ctx.tfm)); + break; + } + + ses_ctx.job_size = *b_size; + atomic_set(&band_async_done, 0); + ret = band_acipher_jiffies(&ses_ctx, enc, secs); + if (ret) { + pr_err("%s() failed flags=%x\n", e, + crypto_ablkcipher_get_flags(ses_ctx.tfm)); + break; + } + b_size++; + i++; + } while (*b_size); + keysize++; + } while (*keysize); + + band_acipher_destroy_session_ctx(&ses_ctx); +} + static inline int do_one_acipher_op(struct ablkcipher_request *req, int ret) { if (ret == -EINPROGRESS || ret == -EBUSY) { @@ -2189,7 +2484,213 @@ static int do_test(const char *alg, u32 type, u32 mask, int m) test_acipher_speed("ctr(blowfish)", DECRYPT, sec, NULL, 0, speed_template_8_32); break; + case 600: + band_acipher("ecb(aes)", ENCRYPT, sec, NULL, 0, + speed_template_16_24_32); + band_acipher("ecb(aes)", DECRYPT, sec, NULL, 0, + speed_template_16_24_32); + band_acipher("cbc(aes)", ENCRYPT, sec, NULL, 0, + speed_template_16_24_32); + band_acipher("cbc(aes)", DECRYPT, sec, NULL, 0, + speed_template_16_24_32); + band_acipher("lrw(aes)", ENCRYPT, sec, NULL, 0, + speed_template_32_40_48); + band_acipher("lrw(aes)", DECRYPT, sec, NULL, 0, + speed_template_32_40_48); + band_acipher("xts(aes)", ENCRYPT, sec, NULL, 0, + speed_template_32_64); + band_acipher("xts(aes)", DECRYPT, sec, NULL, 0, + speed_template_32_64); + band_acipher("ctr(aes)", ENCRYPT, sec, NULL, 0, + speed_template_16_24_32); + band_acipher("ctr(aes)", DECRYPT, sec, NULL, 0, + speed_template_16_24_32); + band_acipher("cfb(aes)", ENCRYPT, sec, NULL, 0, + speed_template_16_24_32); + band_acipher("cfb(aes)", DECRYPT, sec, NULL, 0, + speed_template_16_24_32); + band_acipher("ofb(aes)", ENCRYPT, sec, NULL, 0, + speed_template_16_24_32); + band_acipher("ofb(aes)", DECRYPT, sec, NULL, 0, + speed_template_16_24_32); + band_acipher("rfc3686(ctr(aes))", ENCRYPT, sec, NULL, 0, + speed_template_20_28_36); + band_acipher("rfc3686(ctr(aes))", DECRYPT, sec, NULL, 0, + speed_template_20_28_36); + break; + + case 601: + band_acipher("ecb(des3_ede)", ENCRYPT, sec, + des3_speed_template, DES3_SPEED_VECTORS, + speed_template_24); + band_acipher("ecb(des3_ede)", DECRYPT, sec, + des3_speed_template, DES3_SPEED_VECTORS, + speed_template_24); + band_acipher("cbc(des3_ede)", ENCRYPT, sec, + des3_speed_template, DES3_SPEED_VECTORS, + speed_template_24); + band_acipher("cbc(des3_ede)", DECRYPT, sec, + des3_speed_template, DES3_SPEED_VECTORS, + speed_template_24); + band_acipher("cfb(des3_ede)", ENCRYPT, sec, + des3_speed_template, DES3_SPEED_VECTORS, + speed_template_24); + band_acipher("cfb(des3_ede)", DECRYPT, sec, + des3_speed_template, DES3_SPEED_VECTORS, + speed_template_24); + band_acipher("ofb(des3_ede)", ENCRYPT, sec, + des3_speed_template, DES3_SPEED_VECTORS, + speed_template_24); + band_acipher("ofb(des3_ede)", DECRYPT, sec, + des3_speed_template, DES3_SPEED_VECTORS, + speed_template_24); + break; + + case 602: + band_acipher("ecb(des)", ENCRYPT, sec, NULL, 0, + speed_template_8); + band_acipher("ecb(des)", DECRYPT, sec, NULL, 0, + speed_template_8); + band_acipher("cbc(des)", ENCRYPT, sec, NULL, 0, + speed_template_8); + band_acipher("cbc(des)", DECRYPT, sec, NULL, 0, + speed_template_8); + band_acipher("cfb(des)", ENCRYPT, sec, NULL, 0, + speed_template_8); + band_acipher("cfb(des)", DECRYPT, sec, NULL, 0, + speed_template_8); + band_acipher("ofb(des)", ENCRYPT, sec, NULL, 0, + speed_template_8); + band_acipher("ofb(des)", DECRYPT, sec, NULL, 0, + speed_template_8); + break; + + case 603: + band_acipher("ecb(serpent)", ENCRYPT, sec, NULL, 0, + speed_template_16_32); + band_acipher("ecb(serpent)", DECRYPT, sec, NULL, 0, + speed_template_16_32); + band_acipher("cbc(serpent)", ENCRYPT, sec, NULL, 0, + speed_template_16_32); + band_acipher("cbc(serpent)", DECRYPT, sec, NULL, 0, + speed_template_16_32); + band_acipher("ctr(serpent)", ENCRYPT, sec, NULL, 0, + speed_template_16_32); + band_acipher("ctr(serpent)", DECRYPT, sec, NULL, 0, + speed_template_16_32); + band_acipher("lrw(serpent)", ENCRYPT, sec, NULL, 0, + speed_template_32_48); + band_acipher("lrw(serpent)", DECRYPT, sec, NULL, 0, + speed_template_32_48); + band_acipher("xts(serpent)", ENCRYPT, sec, NULL, 0, + speed_template_32_64); + band_acipher("xts(serpent)", DECRYPT, sec, NULL, 0, + speed_template_32_64); + break; + + case 604: + band_acipher("ecb(twofish)", ENCRYPT, sec, NULL, 0, + speed_template_16_24_32); + band_acipher("ecb(twofish)", DECRYPT, sec, NULL, 0, + speed_template_16_24_32); + band_acipher("cbc(twofish)", ENCRYPT, sec, NULL, 0, + speed_template_16_24_32); + band_acipher("cbc(twofish)", DECRYPT, sec, NULL, 0, + speed_template_16_24_32); + band_acipher("ctr(twofish)", ENCRYPT, sec, NULL, 0, + speed_template_16_24_32); + band_acipher("ctr(twofish)", DECRYPT, sec, NULL, 0, + speed_template_16_24_32); + band_acipher("lrw(twofish)", ENCRYPT, sec, NULL, 0, + speed_template_32_40_48); + band_acipher("lrw(twofish)", DECRYPT, sec, NULL, 0, + speed_template_32_40_48); + band_acipher("xts(twofish)", ENCRYPT, sec, NULL, 0, + speed_template_32_48_64); + band_acipher("xts(twofish)", DECRYPT, sec, NULL, 0, + speed_template_32_48_64); + break; + case 605: + band_acipher("ecb(arc4)", ENCRYPT, sec, NULL, 0, + speed_template_8); + break; + + case 606: + band_acipher("ecb(cast5)", ENCRYPT, sec, NULL, 0, + speed_template_8_16); + band_acipher("ecb(cast5)", DECRYPT, sec, NULL, 0, + speed_template_8_16); + band_acipher("cbc(cast5)", ENCRYPT, sec, NULL, 0, + speed_template_8_16); + band_acipher("cbc(cast5)", DECRYPT, sec, NULL, 0, + speed_template_8_16); + band_acipher("ctr(cast5)", ENCRYPT, sec, NULL, 0, + speed_template_8_16); + band_acipher("ctr(cast5)", DECRYPT, sec, NULL, 0, + speed_template_8_16); + break; + + case 607: + band_acipher("ecb(cast6)", ENCRYPT, sec, NULL, 0, + speed_template_16_32); + band_acipher("ecb(cast6)", DECRYPT, sec, NULL, 0, + speed_template_16_32); + band_acipher("cbc(cast6)", ENCRYPT, sec, NULL, 0, + speed_template_16_32); + band_acipher("cbc(cast6)", DECRYPT, sec, NULL, 0, + speed_template_16_32); + band_acipher("ctr(cast6)", ENCRYPT, sec, NULL, 0, + speed_template_16_32); + band_acipher("ctr(cast6)", DECRYPT, sec, NULL, 0, + speed_template_16_32); + band_acipher("lrw(cast6)", ENCRYPT, sec, NULL, 0, + speed_template_32_48); + band_acipher("lrw(cast6)", DECRYPT, sec, NULL, 0, + speed_template_32_48); + band_acipher("xts(cast6)", ENCRYPT, sec, NULL, 0, + speed_template_32_64); + band_acipher("xts(cast6)", DECRYPT, sec, NULL, 0, + speed_template_32_64); + break; + + case 608: + band_acipher("ecb(camellia)", ENCRYPT, sec, NULL, 0, + speed_template_16_32); + band_acipher("ecb(camellia)", DECRYPT, sec, NULL, 0, + speed_template_16_32); + band_acipher("cbc(camellia)", ENCRYPT, sec, NULL, 0, + speed_template_16_32); + band_acipher("cbc(camellia)", DECRYPT, sec, NULL, 0, + speed_template_16_32); + band_acipher("ctr(camellia)", ENCRYPT, sec, NULL, 0, + speed_template_16_32); + band_acipher("ctr(camellia)", DECRYPT, sec, NULL, 0, + speed_template_16_32); + band_acipher("lrw(camellia)", ENCRYPT, sec, NULL, 0, + speed_template_32_48); + band_acipher("lrw(camellia)", DECRYPT, sec, NULL, 0, + speed_template_32_48); + band_acipher("xts(camellia)", ENCRYPT, sec, NULL, 0, + speed_template_32_64); + band_acipher("xts(camellia)", DECRYPT, sec, NULL, 0, + speed_template_32_64); + break; + + case 609: + band_acipher("ecb(blowfish)", ENCRYPT, sec, NULL, 0, + speed_template_8_32); + band_acipher("ecb(blowfish)", DECRYPT, sec, NULL, 0, + speed_template_8_32); + band_acipher("cbc(blowfish)", ENCRYPT, sec, NULL, 0, + speed_template_8_32); + band_acipher("cbc(blowfish)", DECRYPT, sec, NULL, 0, + speed_template_8_32); + band_acipher("ctr(blowfish)", ENCRYPT, sec, NULL, 0, + speed_template_8_32); + band_acipher("ctr(blowfish)", DECRYPT, sec, NULL, 0, + speed_template_8_32); + break; case 1000: test_available(); break;