Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3858323ybl; Tue, 20 Aug 2019 03:24:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqz43Jma1EAliUOUe/5Zs8w3Lcm3wDsaOfAlfFXaQcPOARoOg0i3e4PpjJi0fYj1XzFrgPri X-Received: by 2002:a17:90a:de02:: with SMTP id m2mr25488582pjv.18.1566296682860; Tue, 20 Aug 2019 03:24:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566296682; cv=none; d=google.com; s=arc-20160816; b=J0hbvi8/xcONX1GwP8uk+5oAZWSupQquiUs9rNc9Sx8ZpEhcAUwd4LBk8D8y5v8f8z BJZI+K8vITYexp6aiJBvGDcJONRcE+VlaylpVtvoBqUa7N60ZhMCcCDUGHkq73EJxpPC MgoFyebKqvhTfvgxuppbXeZa/n4NHPv2vTh0tAmU4s5QAyL9Vgy4Pciq/1RxQRG7HsQf /eotX3+Q7p1vF18452+T/M1a13sv4IwSZAxd8lB2njhSfj5z0M1H8oTdrEcuglqU7r8Y /FYeBhj6L6dgy3yz9q4FW/f8xOKILvjNoAKVxmM1G45MOJBi8SpdfEhsVxN28+Na/v/L Q+gQ== 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 :in-reply-to:references:mime-version:dkim-signature; bh=S8S2y1zlk9grIp6w3nbnKh2E/2X8qop1YXVY2f1KEh0=; b=Q6Ja1UPSgZ6bmyfos2dx19nGftkWDy8neWtZhU4I06hZrq0ltFPpQY1hPDMoCNK2B0 3shxAik4Pn0f6OQfbXTF1cKyjJ8o6izpqg/PYlXv77eLu8uogvcu2wbWnuzb/lYpUlDC +h7p82egRPJN8bp71Cdtb6DrZI1fWNsl2FE+D7/HFD2PsZR+GsPDBjlnd5rUsq9KYJbp ONmXlEydChi4ZMrADTcujXQCsaT/4JClwPwj/+zpNQeE44iwoWI4qloS1xKz5OWnmJK4 2b55iqg/g5Lx50OKWWkf4a2ng2jxD2BPijx19dKx5Cm8vUfzULRyLyTC/LhDMazbjcGx T9wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="I/Ccpstf"; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i3si12200080pld.391.2019.08.20.03.24.24; Tue, 20 Aug 2019 03:24:42 -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=@kernel.org header.s=default header.b="I/Ccpstf"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729378AbfHTKYX (ORCPT + 99 others); Tue, 20 Aug 2019 06:24:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:44978 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729341AbfHTKYW (ORCPT ); Tue, 20 Aug 2019 06:24:22 -0400 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (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 674CB22CF4; Tue, 20 Aug 2019 10:24:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566296661; bh=L31s6t7x42v6wJG53Df7WfNP+8oNhH2SFuO8LCDn2co=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=I/CcpstfQYU/vMXJtcm9JPuCFcCCoy+ahKUC8q4SvHvOoPd3Wm1bFxMm6KXVaSEk5 ySTyKLoMtsJTaNUjjfP1ByYefnb89Lo6U/bAnOBgvU6rz4FALln9u2sUq7zpHSQgID ioEl90xpEgkN5q3iw0jzJ5P5cIA49+02bLHShS7A= Received: by mail-lf1-f50.google.com with SMTP id b29so3713311lfq.1; Tue, 20 Aug 2019 03:24:21 -0700 (PDT) X-Gm-Message-State: APjAAAV1CExCHWSBrLztueNUEYjj6OFfO6p8fa4uqnP5sVb28yMg/U4z HqE99o7wfSxH6KDJH2n8lUclOOGw+sbTTmJSPiI= X-Received: by 2002:a19:c20b:: with SMTP id l11mr14856295lfc.106.1566296659635; Tue, 20 Aug 2019 03:24:19 -0700 (PDT) MIME-Version: 1.0 References: <20190819142226.1703-1-ard.biesheuvel@linaro.org> <20190819142226.1703-3-ard.biesheuvel@linaro.org> In-Reply-To: <20190819142226.1703-3-ard.biesheuvel@linaro.org> From: Krzysztof Kozlowski Date: Tue, 20 Aug 2019 12:24:08 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/2] crypto: s5p - use correct block size of 1 for ctr(aes) To: Ard Biesheuvel Cc: linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au, Vladimir Zapolskiy , Kamil Konieczny , "linux-samsung-soc@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Mon, 19 Aug 2019 at 16:24, Ard Biesheuvel wrote: > > Align the s5p ctr(aes) implementation with other implementations > of the same mode, by setting the block size to 1. > > Signed-off-by: Ard Biesheuvel > --- > drivers/crypto/s5p-sss.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/crypto/s5p-sss.c b/drivers/crypto/s5p-sss.c > index ef90c58edb1f..010f1bb20dad 100644 > --- a/drivers/crypto/s5p-sss.c > +++ b/drivers/crypto/s5p-sss.c > @@ -2173,7 +2173,7 @@ static struct crypto_alg algs[] = { > .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | > CRYPTO_ALG_ASYNC | > CRYPTO_ALG_KERN_DRIVER_ONLY, > - .cra_blocksize = AES_BLOCK_SIZE, > + .cra_blocksize = 1, This makes sense but I wonder how does it work later with s5p_aes_crypt() and its check for request length alignment (AES_BLOCK_SIZE). With block size of 1 byte, I understand that req->nbytes can be for example 4 bytes which is not AES block aligned... If my reasoning is correct, then the CTR mode in s5p-sss is not fully working. Best regards, Krzysztof