From patchwork Sat Jun 22 00:30:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 167432 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1376585ilk; Fri, 21 Jun 2019 17:31:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqy7fPzOlMtTOYL0FZsDAhvsh0CBdPcp5oPzrPm7sRyz63e/76yyQuKRftIzENzTCWrkGSHd X-Received: by 2002:a63:e14:: with SMTP id d20mr21258767pgl.264.1561163515194; Fri, 21 Jun 2019 17:31:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561163515; cv=none; d=google.com; s=arc-20160816; b=INW0Z6YCaJ1segyaJ97dCF7K6x0OIexu3o2+OMWcMaE4oI5Q8HBHVO3KDzlp/u0LOa WFWv32KNAR27cCu0GOGYZhrQn33BoFIJkAZTDaEsW21yJM/3GoyZgzngvX8172OmMTNO 9Uv/xi9j4aiN7iMxOY0Dy5J3pAnzkc3KFM4BijiBJxnYlQW+Ug2TtsF022pVaOFRHvW5 V5qksnUQr3R3jXhSGFW/eXS1zQEjZhCNdKn7GfKoxH/u0oGBNo+/jd3sxHFivSwAx1/I CEWlKJlClZcZNv2I/+UBGTmA/WujTgx8x1JSvt77P4BBXhSGcLs1OH7cRSkMMpQ4m7WL d/xA== 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=f5axQ0mO4kpO+K+YY2LlgHyD0t680/v3sDL49EUqAMg=; b=yXQdmVVpvTXnB47GkwHKhuVBdKQW0qRJ2ECflf4I7QWUHESGjUE0O50Vx2GumQcqH8 4A7hYPyULwk4nrZmJexrDzhAtDAcxYJ6oe4laXxwmac0hGZ36FgYNaVaGQb4BhwBH+El 0ragpfExe6flt1U38DpIsVR9PfqAOnFHjbq8pbEfWj2fOhG8+TVgjeQ/JdyI6uhEY+oE 6SmesRLu6IfctvbaCLIBe3pr2pH8BbHQAVhnleWygZKsfNp2eWPmoLJwPPK1u6EKAaRf Hx4BOBJeZW4k2TfyVK5Fqj4/1mUVI55UncBbC/meEolEtZskn01U22U2eQes/IEFquW5 Udbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WdHjXjOg; 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.54; Fri, 21 Jun 2019 17:31:55 -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=WdHjXjOg; 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 S1726101AbfFVAby (ORCPT + 3 others); Fri, 21 Jun 2019 20:31:54 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:33087 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726141AbfFVAbx (ORCPT ); Fri, 21 Jun 2019 20:31:53 -0400 Received: by mail-wr1-f66.google.com with SMTP id n9so8162046wru.0 for ; Fri, 21 Jun 2019 17:31:52 -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=f5axQ0mO4kpO+K+YY2LlgHyD0t680/v3sDL49EUqAMg=; b=WdHjXjOgfpJ7ZYXtp7oYGvbA0VnORA1GJtFfXu1w36zP5JSHA75nPTLSXFCedaRPdz fzWU2syBAHAK8aSjDpBDZhCpfmAJK0MF34Klf+1hmK9D9CGIdKeEW02tID5YJUIdZ1uz Uk9KAUiYfhFnpDZ7fnOAJT1PZ5/jk9VebooT2t8lPcdlfJ3BsDPQO1TiKBJ5QTuxgQIG 57Tt9FxgqjdIOujH4jGVu+XyRbZv6HygnCCzFnjHUqyC45lm7xJSlmhJTwjatBDqjHQK /Dc+FI4GdmtC3BQ3pzfY9v5S7c7G20DuVsI9f4UJdINGWcbcieeuYreknuqNPjmpw5kl a64w== 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=f5axQ0mO4kpO+K+YY2LlgHyD0t680/v3sDL49EUqAMg=; b=ozWNQhCuewXWTJA2qr/F3iRJtOa4sveJKsvhyDeTY/4U6baPEsVgZggq8I5WesZbyL pnS9h5hf9oAUrOcKaE0MSJnZ4bWQ424yM1gOsd+Gf6TpCMoy0zLoD7OxSKNZP2qDygN/ OMDSV2QpB+xpOJ9SXQv5onwQOwwJjqapU0ClxM1yOv2J/pfPFY/4CPLa+8Qm0RmH9+wu xJ3Prnyztb99jowgKEOAiv0dDbdX3d1TlWpYSzWgl2EhiA5MG3dRUpjHGOSdoybEnT14 CPLXdsKMG0IGlAAXNsZZcF45uabDzgBAeYoM0hg5GZp0h43wvIyAPDq8nePdl+gPe44c B4sQ== X-Gm-Message-State: APjAAAXcq4sPiUJ+hHAxxfH+5QLU1yORrt1zgbNDyt0Q3PvKrLZGpwVW ea/U5PgmL+XaQl5g0PfhloK3wbxXiTIeOCo+ X-Received: by 2002:adf:f6cb:: with SMTP id y11mr11414457wrp.245.1561163511775; Fri, 21 Jun 2019 17:31:51 -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.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Jun 2019 17:31:51 -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 07/30] crypto: cpt/des - switch to new verification routines Date: Sat, 22 Jun 2019 02:30:49 +0200 Message-Id: <20190622003112.31033-8-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/cpt/cptvf_algs.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) -- 2.20.1 diff --git a/drivers/crypto/cavium/cpt/cptvf_algs.c b/drivers/crypto/cavium/cpt/cptvf_algs.c index f6b0c9df12ed..92132f84931a 100644 --- a/drivers/crypto/cavium/cpt/cptvf_algs.c +++ b/drivers/crypto/cavium/cpt/cptvf_algs.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include @@ -325,14 +325,12 @@ static int cvm_cfb_aes_setkey(struct crypto_ablkcipher *cipher, const u8 *key, static int cvm_cbc_des3_setkey(struct crypto_ablkcipher *cipher, const u8 *key, u32 keylen) { - u32 flags = crypto_ablkcipher_get_flags(cipher); int err; - err = __des3_verify_key(&flags, key); - if (unlikely(err)) { - crypto_ablkcipher_set_flags(cipher, flags); + err = crypto_des3_ede_verify_key(crypto_ablkcipher_tfm(cipher), key, + keylen); + if (unlikely(err)) return err; - } return cvm_setkey(cipher, key, keylen, DES3_CBC); } @@ -340,14 +338,12 @@ static int cvm_cbc_des3_setkey(struct crypto_ablkcipher *cipher, const u8 *key, static int cvm_ecb_des3_setkey(struct crypto_ablkcipher *cipher, const u8 *key, u32 keylen) { - u32 flags = crypto_ablkcipher_get_flags(cipher); int err; - err = __des3_verify_key(&flags, key); - if (unlikely(err)) { - crypto_ablkcipher_set_flags(cipher, flags); + err = crypto_des3_ede_verify_key(crypto_ablkcipher_tfm(cipher), key, + keylen); + if (unlikely(err)) return err; - } return cvm_setkey(cipher, key, keylen, DES3_ECB); }