From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752467AbdF2KTN (ORCPT ); Thu, 29 Jun 2017 06:19:13 -0400 Received: from mail-ve1eur01on0070.outbound.protection.outlook.com ([104.47.1.70]:3456 "EHLO EUR01-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751595AbdF2KTH (ORCPT ); Thu, 29 Jun 2017 06:19:07 -0400 From: =?iso-8859-2?Q?Horia_Geant=E3?= To: David Gstir , Dan Douglass , "herbert@gondor.apana.org.au" , "davem@davemloft.net" CC: "richard@sigma-star.at" , "linux-crypto@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: Re: [PATCH] crypto: caam - properly set IV after {en,de}crypt Thread-Topic: [PATCH] crypto: caam - properly set IV after {en,de}crypt Thread-Index: AQHS8BJRT1JvsDHapk2P0fMxyxi4Kg== Date: Thu, 29 Jun 2017 10:19:01 +0000 Message-ID: References: <20170602122446.2427-1-david@sigma-star.at> <20170628132710.97278-1-david@sigma-star.at> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: sigma-star.at; dkim=none (message not signed) header.d=none;sigma-star.at; dmarc=none action=none header.from=nxp.com; x-originating-ip: [192.88.146.1] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;VI1PR0401MB2621;7:ONdoR4PyOqP71U9rdan4AniTeipiVCSOLq7v7bgGgmJ3GRV5dzZlRKLseNMAGdaf+ziuRIfp/+y5K8V08XLBvcpj5wmMqD0eaufh5/Ugo3/ogsAR43fZakE5MudtXYadw1ZPxZU+pwW85Pr9Ymh3JsSaqbshy5nXsQ3asyCbGrc2tga+5fRbcOellgghkP00x4savq0MppBa/yT32BumBOD8ZMEotoakBaIDdI5oCmYYvOoCbii5iGypMVP0pZFAP5x0AGgUbQJJ3RF7Yi7ri9/f53ROrTwV+7PoHmZKqiLzmsBAKed8xDAb6AsYlSA0/h6QSBykdEGPO7PJjJjLd/qVmw5hUYIKVU9D9P7MCzOiZZf+OGpUNHv99HMCReg+HLJPTgPV6+bGQh5lPCBVtlQbz94u2kbw7+nHQrls9KcEPYfgzGrmi9idY6cEoVIMQGnn3i23zkJz/jGXCu7l1UJ8Yoikv69K9W7lrJgI8HtrW8Tet4/Iooh2JyDqhBmBNy6y0KymegCy5/SmoO2ZUI0fTz3NOcjlkTbMrntKLP+geamI5R1llceTQPqOPxWQ1RK7pr7HvFUIuVokJxryM1mLeaZlmlvQGCJGg0xu5xNfuhow81jfGCx4ePcvbLOBMW8RdYFtxqx9A0OlKgHSZFJV7gpQsk6aX2fiNZdPe+kZgFHnQO1pDIxtfa0/oxn9xUwy3FR4C6N3Gk3QUjfdryHEkFLxNNlY6cC533FV1w2qJNWwOER3WxKOaRvMWmBC9sWbAwLLmppt1jCdQm1iPhgB7LivvPQbr8CsG99wM6I= x-forefront-antispam-report: SFV:SKI;SCL:-1SFV:NSPM;SFS:(10009020)(979002)(6009001)(39400400002)(39860400002)(39450400003)(39840400002)(39410400002)(39850400002)(377454003)(24454002)(74316002)(8936002)(6436002)(305945005)(81166006)(8676002)(6116002)(102836003)(3846002)(14454004)(2906002)(478600001)(53546010)(50986999)(6506006)(76176999)(54356999)(86362001)(2201001)(55016002)(54906002)(99286003)(9686003)(53936002)(4326008)(25786009)(2900100001)(5250100002)(2501003)(7736002)(7696004)(189998001)(6246003)(38730400002)(3280700002)(5660300001)(229853002)(3660700001)(97736004)(33656002)(66066001)(142933001)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0401MB2621;H:VI1PR0401MB2591.eurprd04.prod.outlook.com;FPR:;SPF:None;MLV:ovrnspm;PTR:InfoNoRecords;LANG:en; x-ms-office365-filtering-correlation-id: c132aeb5-a48b-4f89-7516-08d4bed842f1 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254075)(300000503095)(300135400095)(48565401081)(201703131423075)(201703031133081)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095);SRVR:VI1PR0401MB2621; x-ms-traffictypediagnostic: VI1PR0401MB2621: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(236129657087228)(9452136761055)(185117386973197); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(6055026)(6041248)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123564025)(20161123555025)(20161123558100)(20161123560025)(20161123562025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095);SRVR:VI1PR0401MB2621;BCL:0;PCL:0;RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095);SRVR:VI1PR0401MB2621; x-forefront-prvs: 0353563E2B spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-2" MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-originalarrivaltime: 29 Jun 2017 10:19:01.0167 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0401MB2621 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v5TAJHaX021099 On 6/28/2017 4:42 PM, Horia Geantã wrote: > On 6/28/2017 4:27 PM, David Gstir wrote: >> Certain cipher modes like CTS expect the IV (req->info) of >> ablkcipher_request (or equivalently req->iv of skcipher_request) to >> contain the last ciphertext block when the {en,de}crypt operation is done. >> This is currently not the case for the CAAM driver which in turn breaks >> e.g. cts(cbc(aes)) when the CAAM driver is enabled. >> >> This patch fixes the CAAM driver to properly set the IV after the >> {en,de}crypt operation of ablkcipher finishes. >> >> This issue was revealed by the changes in the SW CTS mode in commit >> 0605c41cc53ca ("crypto: cts - Convert to skcipher") >> >> Cc: # 4.8+ >> Signed-off-by: David Gstir > Reviewed-by: Horia Geantã > Btw, instead of updating the IV in SW, CAAM engine could be programmed to do it - by saving the Context Register of the AES accelerator. Unfortunately this would require changes in quite a few places: shared descriptor, HW S/G generation logic, IV dma (un)mapping and maybe others. So it's better to have this fix now (which, considering size, is appropriate for -stable) and later, if needed, offload IV updating in HW. Regards, Horia