Received: by 10.223.176.46 with SMTP id f43csp2570972wra; Sun, 21 Jan 2018 23:09:18 -0800 (PST) X-Google-Smtp-Source: AH8x225qzxG5o/GtSn7loH4zGvh7FflOEkMFWRmDoaw/d27/QCScH/3oelw3qhHZFXyGVY4tFiSw X-Received: by 10.98.17.21 with SMTP id z21mr7450050pfi.86.1516604958236; Sun, 21 Jan 2018 23:09:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516604958; cv=none; d=google.com; s=arc-20160816; b=U2ohi0ZjNWHE3VvhEtmFIjFAy64igl+7/kme1fJWUMqgTI3a1bhRr93Fm7G97ka/5I 1/ejrKiq0jin0fM9BQx5af/SGtOOtUv1+NdGnksM03vKMAtpR0QKo9yQTIMQapTqKMtn oaSX2//iMsFxdFYPDFrwJKqkTXkpimRhApkE9TS344IiyJXlujxtKnXlHp10BsIiRAjq EK+yULwTxjUE+i5wwv7X8EFalO/J4WfH2oDwUz2UaHg4sM1/ZNl9d3MpMM3hIXuxuBPb ooZaPO37ePBCWaSRxQ1oPVzkrLKEQHjGyrMITbkBE5QyDDwnAxBzH2YzCBNeL97AzfXs uJRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=kPMY9l2oZc7ZuMmclTMYUdamcQp5nm18UtRCv4dnZu8=; b=WqhLCzjN6BgrHs5uudAvKt2z9HqDV8s8DSGhKCj4uE0l/Ylcqe2FmEzF03hGSZ9DUY 8qo97xCjJh0awj+KWSykQs6iUgVRY2I0o34BjQL1r2Il/vpJ2uNbyQ4EttjIoyZ8FBVu eLZCWLpCLKm90Z5m25XdT63h82D0whVU/ChlS6OuhS96+DPXaaKJx4k3u7H8AtqMTgDx UlQeB1dfhh6h7MxOExC1zEs9NQA4p98oxQMZH/K56Ekg0c72HCKLKihFXSok0a8qPPxi wUTN3G71UxXTGMCeMje5JmSEdJtfKMoEuzgcPxNh4mGSG94r0wydqFsZuI7QykSQngNB 0bfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@benyossef-com.20150623.gappssmtp.com header.s=20150623 header.b=aBI1wS4g; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h13si13032644pgq.776.2018.01.21.23.09.03; Sun, 21 Jan 2018 23:09:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-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=@benyossef-com.20150623.gappssmtp.com header.s=20150623 header.b=aBI1wS4g; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751151AbeAVHIS (ORCPT + 99 others); Mon, 22 Jan 2018 02:08:18 -0500 Received: from mail-oi0-f44.google.com ([209.85.218.44]:41489 "EHLO mail-oi0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751102AbeAVHIR (ORCPT ); Mon, 22 Jan 2018 02:08:17 -0500 Received: by mail-oi0-f44.google.com with SMTP id m83so2796994oik.8 for ; Sun, 21 Jan 2018 23:08:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=benyossef-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=kPMY9l2oZc7ZuMmclTMYUdamcQp5nm18UtRCv4dnZu8=; b=aBI1wS4gu8036SsSo7eYZg6+FYPJan9WVs6afwgZTD30Wem7X2tbDOfx3Etvly41gi 2JjGIetQfPnmEoMv7i9XmpfZNWfH8QOKohyBX0lLpZ1bEVeLwpUgWmNRXwBNEsISiR/i Nx51TvpUQe8MyHf+lhb0QAvQDm0ITkbUsW6NPRz3aDsHAkMLfW+CEVdueTK6S8MSUBiZ p/mYS4d9YuQyxSI2d3kXQPD5I3zUo9bIYdwk+J1QoOas8w6cXuHY74ZvQeR08nTbaOW7 QNuJbhJQ2t+NjWtN+SKVcsdy8Z1vnwM7U+abvmiXZKmgq3S18og0vnBJ6TKHEhqb/xKF 7pEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=kPMY9l2oZc7ZuMmclTMYUdamcQp5nm18UtRCv4dnZu8=; b=OM7FKe8FghA+jBHi02gFJIfB0pN++Le+LVdSbsiFho1J6vgZr7U/a58kMkr+C0R4fr iThcC/4fhgU2x/y4g38eN4hbqdA8UuLAqk03VSgl/55KqbmwNRXw5YnHS5l8/19sAdaW Asz3eqIOwWfgvYFdEdNflUqhhaSK4enjuN7Ys/Nd376Z/iM+J++cxL2FiyoSqb64epHx SlhbdUtz5fYdhfP/DgnZKwuuLHAKvmv4pLacqGjROE6XmaKVRPvd1Lao9iGkK7Cm3iK6 seXFWqZ1liM6F0h0nzuBoImF4QElS2Gm+w21Sf2zIdmerPEoCh5q+a/r6s/9LZ2SV0AW h4PA== X-Gm-Message-State: AKwxytdC7YqunaUkAKfTt9SptVvneea84TUWpkYK3oD68XdKBzVqh3ca nbAVWTI+miwyt3g7qqntFwGBoNnVTmAvhxToTWVaVv0YsgQ= X-Received: by 10.202.218.213 with SMTP id r204mr2941082oig.94.1516604896560; Sun, 21 Jan 2018 23:08:16 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.38.230 with HTTP; Sun, 21 Jan 2018 23:08:16 -0800 (PST) X-Originating-IP: [217.140.96.140] In-Reply-To: <2378888.JBO5RdML52@tauon.chronox.de> References: <1515662239-1714-1-git-send-email-gilad@benyossef.com> <1515662239-1714-4-git-send-email-gilad@benyossef.com> <2378888.JBO5RdML52@tauon.chronox.de> From: Gilad Ben-Yossef Date: Mon, 22 Jan 2018 09:08:16 +0200 Message-ID: Subject: Re: [PATCH 3/7] crypto: ccree: add ablkcipher support To: Stephan Mueller Cc: Herbert Xu , "David S. Miller" , Greg Kroah-Hartman , Ofir Drang , Linux kernel mailing list , Linux Crypto Mailing List , devel@driverdev.osuosl.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 11, 2018 at 12:03 PM, Stephan Mueller wrote: > Am Donnerstag, 11. Januar 2018, 10:17:10 CET schrieb Gilad Ben-Yossef: > > Hi Gilad, > >> + // verify weak keys >> + if (ctx_p->flow_mode == S_DIN_to_DES) { >> + if (!des_ekey(tmp, key) && >> + (crypto_tfm_get_flags(tfm) & CRYPTO_TFM_REQ_WEAK_KEY)) { >> + tfm->crt_flags |= CRYPTO_TFM_RES_WEAK_KEY; >> + dev_dbg(dev, "weak DES key"); >> + return -EINVAL; >> + } >> + } >> + if (ctx_p->cipher_mode == DRV_CIPHER_XTS && >> + xts_check_key(tfm, key, keylen)) { >> + dev_dbg(dev, "weak XTS key"); >> + return -EINVAL; >> + } >> + if (ctx_p->flow_mode == S_DIN_to_DES && >> + keylen == DES3_EDE_KEY_SIZE && >> + cc_verify_3des_keys(key, keylen)) { >> + dev_dbg(dev, "weak 3DES key"); >> + return -EINVAL; >> + } > > For the DES key, wouldn't it make sense to use __des3_ede_setkey? > > Note, I would plan to release a patch for review to change that function to > disallow key1 == key2 or key1 == key3 or key2 == key3 in FIPS mode. I took your advise and did just that in v2. Thanks for the review! Gilad -- Gilad Ben-Yossef Chief Coffee Drinker "If you take a class in large-scale robotics, can you end up in a situation where the homework eats your dog?" -- Jean-Baptiste Queru