From patchwork Mon Jan 7 02:47:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Biggers X-Patchwork-Id: 10749815 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 BFB7914E5 for ; Mon, 7 Jan 2019 02:49:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AFC8B286E7 for ; Mon, 7 Jan 2019 02:49:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A3B5D28849; Mon, 7 Jan 2019 02:49:41 +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 5637E286E7 for ; Mon, 7 Jan 2019 02:49:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726426AbfAGCtk (ORCPT ); Sun, 6 Jan 2019 21:49:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:46456 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726176AbfAGCtj (ORCPT ); Sun, 6 Jan 2019 21:49:39 -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 2E37A20838; Mon, 7 Jan 2019 02:49:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1546829379; bh=hy51PkJvunrr/Vn8LPVg1fw1Pa7J7HJdiVZWgETcNwE=; h=From:To:Subject:Date:From; b=BoQJnOmMszOuiv07SCT2VAS7bPAtEPIqx14NPum+6o6EKrhMNHt+Mf4E2UNlYl9PE 01tOdpiMuzkwGbMBIOl5BP2H+wl8ATkpWFc6Ag77lMLCVFl/bb9EO/jAttyseHel0d CGgE3qKaL54os5w10L5YeC+Fe530OOrzuL671KGg= From: Eric Biggers To: linux-crypto@vger.kernel.org, Herbert Xu Subject: [PATCH 0/3] crypto: set CRYPTO_TFM_NEED_KEY if ->setkey() fails Date: Sun, 6 Jan 2019 18:47:41 -0800 Message-Id: <20190107024744.4952-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 This series makes the crypto API mark shash, ahash, skcipher, and aead tfms as needing a key again if setting a key fails, since on failure many algorithms can leave the tfm in an intermediate state that is neither the old key nor the new key -- and use of such tfms for hashing, encryption, or decryption will produce bogus results or crashes. Eric Biggers (3): crypto: hash - set CRYPTO_TFM_NEED_KEY if ->setkey() fails crypto: skcipher - set CRYPTO_TFM_NEED_KEY if ->setkey() fails crypto: aead - set CRYPTO_TFM_NEED_KEY if ->setkey() fails crypto/aead.c | 4 +++- crypto/ahash.c | 28 +++++++++++++++++++--------- crypto/shash.c | 18 +++++++++++++----- crypto/skcipher.c | 27 ++++++++++++++++++--------- 4 files changed, 53 insertions(+), 24 deletions(-)