From patchwork Fri Jan 4 04:16:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10748019 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BC1CF746 for ; Fri, 4 Jan 2019 04:20:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA86327CF3 for ; Fri, 4 Jan 2019 04:20:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9EF6627D0E; Fri, 4 Jan 2019 04:20:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4526B27CF3 for ; Fri, 4 Jan 2019 04:20:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726009AbfADEUy (ORCPT ); Thu, 3 Jan 2019 23:20:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:56344 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbfADEUy (ORCPT ); Thu, 3 Jan 2019 23:20:54 -0500 Received: from sol.localdomain (c-24-23-143-129.hsd1.ca.comcast.net [24.23.143.129]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5CF8F2184B; Fri, 4 Jan 2019 04:20:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546575653; bh=cQNCnX0rmWf1mRcvJwsUI5P+0ob9N/FSU4x1ogww2ms=; h=From:To:Subject:Date:From; b=zFO3xCvSDrXuMEwxoVAfROqSdTal8T0PxEOY2e6L0TNDAhj/geV+0sY1HOR+TbRHd mBy2uQwjGlUG6kfGW7CosXt2gGDzPBKwBin6h5q9Y4f8A6xOK829XQC6U1Ho//Lbm9 blWgWa6aw1E7M3ghJOCsOPPxIOccHiXSI9fGAxL4= From: Eric Biggers To: linux-crypto@vger.kernel.org, Herbert Xu Subject: [PATCH 00/16] crypto: skcipher template simplifications and conversions Date: Thu, 3 Jan 2019 20:16:09 -0800 Message-Id: <20190104041625.3259-1-ebiggers@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hello, This series adds a function skcipher_alloc_instance_simple() that greatly simplifies creating an skcipher_instance that uses a single underlying block cipher. It then converts the cbc, cfb, ctr, ecb, kw, ofb, and pcbc templates to use it. In doing so, ctr, ecb, and kw are also converted from the deprecated "blkcipher" API to the skcipher API. While doing this, I also found some rather silly bugs in the cfb, ofb, and pcbc templates... So I've included the fixes for these first, in patches 1-4. Please consider taking these first 4 patches through 'crypto' rather than 'cryptodev'. (But 5-16 are cleanups only, so no rush on those.) Finally, I also converted ecb(arc4) and ecb(cipher_null) to the skcipher API, since following the template conversions these were the last generic algorithms that were still using the "blkcipher" API. The overall delta is almost 500 lines removed, due to removing a lot of boilerplate that created algorithm instances. Eric Biggers (16): crypto: cfb - add missing 'chunksize' property crypto: cfb - remove bogus memcpy() with src == dest crypto: ofb - fix handling partial blocks and make thread-safe crypto: pcbc - remove bogus memcpy()s with src == dest crypto: skcipher - add helper for simple block cipher modes crypto: cbc - convert to skcipher_alloc_instance_simple() crypto: cfb - convert to skcipher_alloc_instance_simple() crypto: ctr - convert to skcipher API crypto: ecb - convert to skcipher API crypto: keywrap - convert to skcipher API crypto: ofb - convert to skcipher_alloc_instance_simple() crypto: pcbc - remove ability to wrap internal ciphers crypto: pcbc - convert to skcipher_alloc_instance_simple() crypto: arc4 - convert to skcipher API crypto: null - convert ecb-cipher_null to skcipher API crypto: algapi - remove crypto_alloc_instance() crypto/algapi.c | 33 +---- crypto/arc4.c | 82 ++++++------ crypto/cbc.c | 131 ++----------------- crypto/cfb.c | 139 +++----------------- crypto/crypto_null.c | 57 ++++---- crypto/ctr.c | 160 ++++++----------------- crypto/ecb.c | 151 +++++---------------- crypto/keywrap.c | 198 ++++++++++------------------ crypto/ofb.c | 202 ++++++----------------------- crypto/pcbc.c | 143 +++----------------- crypto/skcipher.c | 131 +++++++++++++++++++ crypto/testmgr.h | 53 +++++++- include/crypto/algapi.h | 6 +- include/crypto/internal/hash.h | 6 +- include/crypto/internal/skcipher.h | 15 +++ 15 files changed, 508 insertions(+), 999 deletions(-)