From patchwork Sat Jun 22 00:30:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 167433 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1376601ilk; Fri, 21 Jun 2019 17:31:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqwSZFfvirvQhK8riMlwX7kqr6+Y7VV8AJBJX46ZHtbVpCI+W2bHJaYyBO65jDDuFU9P54zy X-Received: by 2002:a17:90a:376f:: with SMTP id u102mr10134185pjb.5.1561163516156; Fri, 21 Jun 2019 17:31:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561163516; cv=none; d=google.com; s=arc-20160816; b=JIDzmBYE9aqE9444gnBV/uenth8uwmhQlq0DcW9xP2/7IirDaAUh4aWe8fLnaZAfTY RmAurmz01ze/nVJOiOpMM8QnNYTvCjZmnRPHY4R6R6S94IXpOWdlaZSy5TZONvGvxEQ5 y8AdVWbJWIoI1NR0gTLdRA7QOhMRkD4IKa5inro2GHtB/kk/EE2RDENqH+vJr5Gj2FnP tna9brNS1Ge3ktsimORGzRMXvRTlinB+aZ0pTQ9hUgQhwl2u3I7p2ATu0iHu1Yzxaf/D Qk37AWZCnkI77RJKie7QfyAbQyvP98iQVI8zl4wyMEPlanD1yaLINBO6RADqxGIcDTcZ nxuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=92I3Q15kMAvGJYoPL2kO9fMeWG/QF51hQZh+CfnwyBs=; b=XoN+f+hopOX9Y5Su5BUtq0ulx8tFrIhyb2MmfESg9htnQhLSFIbnMcRGLd+sVwQOLo nfzngmDJKOhPgzGXiuEdpejv9+gJq0VcC4nCIsc+9i4+92eoyE/bf2E99f7a9wu9nsYG 3Knn+m7vuXYK8Y0zaVXK6B84N1G7/stOfZ57I/ESuj2QIn8mBwfdI8juBOqqePcv3/dy Elualfr5ZWWR4j0m4kIeBNKTEco7+SPMiqsZ2xCO0RyzqOlwGwmU4XMXe1K+zI0Y5P5w RGZe4Y0ri6AMSVMmgstNLpUxjCNs2QNGRm4KOR7lHvIot67tn51ZbaOHampz2oJKGrzQ EPbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LBDjv8Xx; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v10si4096271plg.320.2019.06.21.17.31.55; Fri, 21 Jun 2019 17:31:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LBDjv8Xx; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726168AbfFVAbz (ORCPT + 3 others); Fri, 21 Jun 2019 20:31:55 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:39197 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726049AbfFVAbz (ORCPT ); Fri, 21 Jun 2019 20:31:55 -0400 Received: by mail-wm1-f67.google.com with SMTP id z23so8094331wma.4 for ; Fri, 21 Jun 2019 17:31:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=92I3Q15kMAvGJYoPL2kO9fMeWG/QF51hQZh+CfnwyBs=; b=LBDjv8XxLfee39Wm3xMYXaiNilyhIaY/2GH0kCwHHUtMfBamaXv55VDVqjvu1IJQSX 4/ozgWQ2h1Je/aD4DRWRolwtDvPaWTjZ+BFLo/0Pg/dMfduGnPxgi4BWKtjBLQ4lOOGv 7xjaWjX+n0NJlqpceducq2VjZRkOvn1zAznnSJKMZOz6X3DBrI2b8vYoVugdvgxZW0JZ dW4zYi0GwvP7BkEhpF4sj7XsuCWdJZ3O47Z40dAE89+LgT8E8FSPC0Sl9iGVb3qtpbPZ jR32DcTA/7WC6aiNk1BFOJGkHOUHXnORtN3qLA5AsUrAza2qZKo8d2sjRsuGZVq57xhn zKwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=92I3Q15kMAvGJYoPL2kO9fMeWG/QF51hQZh+CfnwyBs=; b=E01UX49vZ4/4FZ/JD3rBsSHp2ApXMV7jHvhW5wm9fpSIw5ZHxyL+MNLH/VWFqdij/C 697j/vSiDFuwTQz8uIAuJ2rxuiN+1GcI9Y5BD8jvZ6ENC+5blfVH17zW0Rt0nIr28eGx xb5/VCP9kJH0BLgTTTxi1qR+PyOYUlevLI3PcuJPjhhxR7GgcUe0HigzmDUBJ15ph/Ad PGWwnuSIh5CyAluoAF4PK27wz7prCLhFWeF7K/JuIVmR6YL/awd1GMwRsf23eGidh/JC xbt1FD7CNz7ShT+z+I3/JSI6mdOyteFGcXZwMFNFSHNSWzySMquGQm7W6denuFl+gobO 0Vog== X-Gm-Message-State: APjAAAUSEAzgpkmY0NUGhNWrvJaxAXVJ0FcZQx/L9gTeXw35qvhWyHJ3 0+JdL0qJWHMuIw2kGDNS33SuMqBuYpI3W4YN X-Received: by 2002:a7b:c301:: with SMTP id k1mr5436642wmj.43.1561163512819; Fri, 21 Jun 2019 17:31:52 -0700 (PDT) Received: from sudo.home ([2a01:cb1d:112:6f00:99d4:1ff0:ed6:dfbb]) by smtp.gmail.com with ESMTPSA id v18sm4792019wrd.51.2019.06.21.17.31.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Jun 2019 17:31:52 -0700 (PDT) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, ebiggers@google.com, Ard Biesheuvel Subject: [RFC PATCH 08/30] crypto: nitrox/des - switch to new verification routines Date: Sat, 22 Jun 2019 02:30:50 +0200 Message-Id: <20190622003112.31033-9-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190622003112.31033-1-ard.biesheuvel@linaro.org> References: <20190622003112.31033-1-ard.biesheuvel@linaro.org> MIME-Version: 1.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Signed-off-by: Ard Biesheuvel --- drivers/crypto/cavium/nitrox/nitrox_skcipher.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) -- 2.20.1 diff --git a/drivers/crypto/cavium/nitrox/nitrox_skcipher.c b/drivers/crypto/cavium/nitrox/nitrox_skcipher.c index 7e4a5e69085e..927915b285de 100644 --- a/drivers/crypto/cavium/nitrox/nitrox_skcipher.c +++ b/drivers/crypto/cavium/nitrox/nitrox_skcipher.c @@ -7,7 +7,7 @@ #include #include #include -#include +#include #include #include "nitrox_dev.h" @@ -257,8 +257,14 @@ static int nitrox_aes_decrypt(struct skcipher_request *skreq) static int nitrox_3des_setkey(struct crypto_skcipher *cipher, const u8 *key, unsigned int keylen) { - return unlikely(des3_verify_key(cipher, key)) ?: - nitrox_skcipher_setkey(cipher, 0, key, keylen); + int err; + + err = crypto_des3_ede_verify_key(crypto_skcipher_tfm(cipher), key, + keylen); + if (unlikely(err)) + return err; + + return nitrox_skcipher_setkey(cipher, 0, key, keylen); } static int nitrox_3des_encrypt(struct skcipher_request *skreq)