From patchwork Thu Jun 27 12:02:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 167938 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2249452ilk; Thu, 27 Jun 2019 05:03:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqxSmDfV3wp53tE16sHBKtmR7dyZJWpV+kLF2Qvz4ExbZADWBsh7F8teDJKiD9v7uymCUMxG X-Received: by 2002:a65:63d1:: with SMTP id n17mr3551873pgv.382.1561637017656; Thu, 27 Jun 2019 05:03:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561637017; cv=none; d=google.com; s=arc-20160816; b=xFHv0630wJHAVsO2gwT2kSTeNmURRwKYMooe8fIBJED4/9GY2LUuFhenLeUBZTIqp7 tcLqdugxyhRyt9N7huy4+1xLA9III/6kYhrgBzwYS7pTlxFbqKstBCLJTKuU80mtJn9/ Jb+A86waWW2kWocJtwbss/7LSAAcmTvMNg+DzOJC/a1LS8HIxyGP585LVnVeQ7hKUTH1 iQ3S7aBlOKRF/VjgBLhwXcNDxborf39cLIG/KNQIP+2ES+mm3wWp/Hz7uCuytUh3K29B WYAfFcsCsytjyUXnQwHluj+RvEaqS98MsnEa3Tq+3Jl4Us2MiEfK5+VPPPeHidZ1seum orug== 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=lw7IfSvEuxhbx4Wlk78c29jrNjDUKTz/yRyE8QUP9h8=; b=LZ5+fakNXUlu59wMcvUog010GQWqB2YBz7F8/n+ztukvsSdDmoKMJAOh2gnK9MBAM2 /9qxKmOGPU92x37ARWTagBW7CEPoV6SHF2NnkjLqO8E2vEW5guCmzcXBXqZYqg45bb7K SVXr1gpTy8sY8haUQdvpKGtZoGBKyG9WWQtpFVwrNui5HDdBqoJJaoCGswQ86nvJSUDC vU/5/BPz/0Ook+FtnOmV0Tibmtc/dbrQys9kP2aJAtMvuE2MLYNpFEkMDywnjjx9dk7m WbRV94LRyZ1ZNA3PstVnnUzWhk3LPvHLcKouNwdDk6u424ryHjbkrFhwcum5XjmGBcfu 3hbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hIZgrMA7; 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 m39si2229121plg.155.2019.06.27.05.03.36; Thu, 27 Jun 2019 05:03:37 -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=hIZgrMA7; 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 S1726571AbfF0MDg (ORCPT + 3 others); Thu, 27 Jun 2019 08:03:36 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:38972 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726682AbfF0MDf (ORCPT ); Thu, 27 Jun 2019 08:03:35 -0400 Received: by mail-wm1-f66.google.com with SMTP id z23so5412457wma.4 for ; Thu, 27 Jun 2019 05:03:34 -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=lw7IfSvEuxhbx4Wlk78c29jrNjDUKTz/yRyE8QUP9h8=; b=hIZgrMA7BCMMKtpmuYsbI4pxMZK4jLiRMFaOsWlaBl3bxtr+MMkwryGKgwWyiYGltn VunsnzuNPRfjBRTey19Tzu+Idekf0dpmj2muspqLAiOwquqwzy7bhubQ1rvqXEZ1gw88 nG44Aih10JdebfWd6EMPY4zpnXeW9d8CAI65rPo+X5Vqlk0WEPl7KvjvY6WGRBp1SUlS haPswalJLeWGfqVj7n0Q3iPB7jSWDYW39wu74RA9rWa4iUP7cy9RTN2X0iG4giAjksQj N5IYmiPXF/fr9c2jZjoPEhj+1O63CDcrsRs0dbK7nizm0ivrM4nDKdz+SntoRWVbEwPC voJw== 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=lw7IfSvEuxhbx4Wlk78c29jrNjDUKTz/yRyE8QUP9h8=; b=YzEueKrmme2wQ32QexzyrwEmdXfDb0ghNa9akN1FuSiBPiptSGla2v1bnAj3nUQv1s np4U6YotCQXbAtP1jYkHaW8v7Pnl+WG1EjYHVbxq0D/FaRxpd3+fXo81LMQdK73VG6AC ERpUN1RRov68ti8OVwlsLohFonB7009bbvXDk7/w83FAu+U+9wX1FzBlStNyHmvxNKGj YOIxLsUtZqZmQHD0EtdDRGLcCNMKU8Prz5ECwfX2zhJLTqfFElihtkUl4N6vlEGP9UpQ xHA9v8OZRw+6aZnoxHTuXsbfY5yj/dxn+CXYe/u6XNqZU0YK2JWylu7CUackJN0OOIMr u/Ow== X-Gm-Message-State: APjAAAWDZXs1IJHWJlTzPoJj2ESlTGwBwo0S8bwX+XJ0DgggYt75sbeB WChmyTlQYaIrojx7Oat1tn9/UiHl0+/zWQ== X-Received: by 2002:a7b:c148:: with SMTP id z8mr3078275wmi.142.1561637013653; Thu, 27 Jun 2019 05:03:33 -0700 (PDT) Received: from localhost.localdomain (laubervilliers-657-1-83-120.w92-154.abo.wanadoo.fr. [92.154.90.120]) by smtp.gmail.com with ESMTPSA id z126sm7732431wmb.32.2019.06.27.05.03.32 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 27 Jun 2019 05:03:32 -0700 (PDT) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, ebiggers@kernel.org, horia.geanta@nxp.com, Ard Biesheuvel Subject: [PATCH v2 07/30] crypto: cpt/des - switch to new verification routines Date: Thu, 27 Jun 2019 14:02:51 +0200 Message-Id: <20190627120314.7197-8-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190627120314.7197-1-ard.biesheuvel@linaro.org> References: <20190627120314.7197-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 | 16 +++++----------- 1 file changed, 5 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..f9b0ac792d6d 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,11 @@ 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); + if (unlikely(err)) return err; - } return cvm_setkey(cipher, key, keylen, DES3_CBC); } @@ -340,14 +337,11 @@ 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); + if (unlikely(err)) return err; - } return cvm_setkey(cipher, key, keylen, DES3_ECB); }