Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4103759ybg; Mon, 21 Oct 2019 03:56:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqwdEI5jMWo33Tj4+oZWwRlubWP97iukRyli1f5fW5+o+P8T9sTgVGQv00SVy3XfO2cwwWvN X-Received: by 2002:a17:906:c4a:: with SMTP id t10mr21371134ejf.290.1571655410871; Mon, 21 Oct 2019 03:56:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1571655410; cv=pass; d=google.com; s=arc-20160816; b=jL3H9uHiTvRPW4LNILwF1qTnAMwLh0xwoPjW18hkUuTzDuV10uAQ50tEKWbU6V59DY w4HbLIyqkmNlsfbIdmaqki18zXCkrY7KxoS4qL2BARHJqmg52ThoMGnwTFAgl1dlo+CP P8OiWKY1NktmxJ8w/UGmQZ4EP+PJkDpRHdFAI5EYIM24ie7B4RRflhjf2r+irV/mtWp7 j8lf8oL+P+QibpOuO3AeeQAe7yy4Cs+I58qhx+w9KPkBS1Gx3VfbXvaBrujOC2JOdeeQ B88d1lEt9UAbwqsO456uIS9MrQURI9qkxEf3RfSIkLMAJUyWzfH03i994QHepbH1DRjB o+Xw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:message-id:date:thread-index :thread-topic:subject:to:from:dkim-signature; bh=vwYf75MjPx31xTKvR62HiLAJ8/501UAIekaKlGthX8g=; b=IPqO2eryjyIpSp+V7M/8aHSvTuzqcP8C1OEqPC/O2Ze66wk3JIbJGIirel3FbPH/Ox Je/AFUQ1eaP0yvfsQmiSSg8uxScad1VsS1cKD6szOtikN9QoXgDuTIowEs3ucRwZxNmV xnmcyeEOyL30ejSNjnD1ojYNjBbJ1ddQVgL+X0GqTmPbZmtd3j1kHXVdhNStxk0cAOA4 x9XrLnVfmsQW+8ydxD4VNGe5oLNXyKXGahoXXQ9n59C1MySsJazZzIS18EUCSAJh4uyj wCDtljddH1RxXKnwMavLqzdA5+JLzVUjNrDDyw5NxRqJfi/iWs6rizwqbuqNjFUCocSz DlJA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@verimatrix.com header.s=selector2 header.b=zaNXeyax; arc=pass (i=1 spf=pass spfdomain=verimatrix.com dkim=pass dkdomain=verimatrix.com dmarc=pass fromdomain=verimatrix.com); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=verimatrix.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g40si4035214edb.369.2019.10.21.03.56.17; Mon, 21 Oct 2019 03:56:50 -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=@verimatrix.com header.s=selector2 header.b=zaNXeyax; arc=pass (i=1 spf=pass spfdomain=verimatrix.com dkim=pass dkdomain=verimatrix.com dmarc=pass fromdomain=verimatrix.com); 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=verimatrix.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727832AbfJUKz7 (ORCPT + 99 others); Mon, 21 Oct 2019 06:55:59 -0400 Received: from mail-eopbgr680060.outbound.protection.outlook.com ([40.107.68.60]:27876 "EHLO NAM04-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727831AbfJUKz6 (ORCPT ); Mon, 21 Oct 2019 06:55:58 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZQ49BUyKdqPW61XTi64ufasFosGYdKgV2COutJaX3X/j6fzgdStn3Oqi/Vc7GCK9wmSxJwrfPzlexNZcaV9Wu8nbWHtqm5PXBrUwEcLct09ExXjwtlICd4Ko0DDf0yFK8p/C/zBkKJcBzEd27k/myqnrocDC3EBfmd4eyCrs67Io7ak5gCrE4pBpxfh5iRKNMAl9N+YgVu0Ra3nHmS/DWk+44mIFpBkD1EPqXgDR77VBy/aIvser2U+vskV4q91Qw6DRPY2tNao5dEBaMme8CfFlL/9bSf9vtu3HG9iLqvUlNq6rDNlYw0qaHabkGLueS8I8qENDv7gC4bYW76hhvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vwYf75MjPx31xTKvR62HiLAJ8/501UAIekaKlGthX8g=; b=YsgpPUwW0vJnT4cU5Dv8xGIRyUABzJBullVt62MpgGyadQGOio25khLxGoEdFyhyUQB5QcjkEvKUqpQ4h+pDmbjSB++2QeUBGYeo1Yv77+CKkFWl+VT3cFp/Q5O+2rjjoaE/vOCDAJAxpjAOknkj0zAOcGl9cYoV15xzWd2kveUsEjZ9CGbn6jCMYZc1wDKiRb2EoAN/LbNRkHWAcVx4WEe1ttM7QI5crPaioEHpniE/LlbzFVrQeWDxMrGfmoM2Okpyma1Bcmsi7FZydmI8t+Ipq67nij+z3L70vbNsnQF5Aur62sA0yx8Ve5UrNu/gdmj+IwUM/YTntIYJdXzPTw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=verimatrix.com; dmarc=pass action=none header.from=verimatrix.com; dkim=pass header.d=verimatrix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=verimatrix.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=vwYf75MjPx31xTKvR62HiLAJ8/501UAIekaKlGthX8g=; b=zaNXeyaxpwQZPRfH9leTDGvMymrdwmhBWCxmGYtGXRPI4dPEZDX/ypKo2PBmvvS2Hag53GdIwjTea/b+d6wTbnTa3BGSWnYXDoTT1eeppFWfQVCQxIvchSjR37+RS+RL4nkHPqfL92n43wlwFOgb83YLNWiQuqhYgkzgzbMUstE= Received: from MN2PR20MB2973.namprd20.prod.outlook.com (52.132.172.86) by MN2PR20MB2656.namprd20.prod.outlook.com (20.178.251.207) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.21; Mon, 21 Oct 2019 10:55:56 +0000 Received: from MN2PR20MB2973.namprd20.prod.outlook.com ([fe80::b986:4f02:3206:31e4]) by MN2PR20MB2973.namprd20.prod.outlook.com ([fe80::b986:4f02:3206:31e4%7]) with mapi id 15.20.2347.029; Mon, 21 Oct 2019 10:55:56 +0000 From: Pascal Van Leeuwen To: "linux-crypto@vger.kernel.org" , "herbert@gondor.apana.org.au" Subject: RE: Key endianness? Thread-Topic: Key endianness? Thread-Index: AdWH7WiyGB6aVNy7SJOkTaAoiPGHOgADxdEg Date: Mon, 21 Oct 2019 10:55:56 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=pvanleeuwen@verimatrix.com; x-originating-ip: [188.204.2.113] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 5947232b-c8bc-4765-309b-08d756154020 x-ms-traffictypediagnostic: MN2PR20MB2656: x-ms-exchange-purlcount: 1 x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-forefront-prvs: 0197AFBD92 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(4636009)(39850400004)(346002)(136003)(376002)(366004)(396003)(199004)(189003)(13464003)(7736002)(7696005)(316002)(86362001)(2906002)(71200400001)(71190400001)(478600001)(15974865002)(5660300002)(7116003)(8936002)(476003)(305945005)(74316002)(486006)(25786009)(14444005)(6116002)(256004)(3846002)(55016002)(6436002)(229853002)(9686003)(33656002)(99286004)(76116006)(66476007)(66556008)(64756008)(66446008)(8676002)(6506007)(110136005)(53546011)(52536014)(66946007)(66066001)(14454004)(26005)(81166006)(81156014)(186003)(102836004)(6246003)(3480700005)(2501003)(18886075002);DIR:OUT;SFP:1101;SCL:1;SRVR:MN2PR20MB2656;H:MN2PR20MB2973.namprd20.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: verimatrix.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 0J9HPgWR36fdTgjC26YjKzg0mT24Scml8QoqA/HcNNUBM/I5SNVr3Kmjr8OsaTLVzC6wbvJyOhE1Jpq8ml7ylzeQ23Hzfq+VoUvJBblkg/T1lDMI247IN5R0I3ZfLjpAkp7n8248udtsQF/xX02VjY3J8XeH4RFyZlKHfsFAqjuP3Cvx6zzE7B9XJ3Dv8n+xjrtxiwwdYa0wqEYmCammkmAfCNZzgYq/HcS9rmPbTAmv3bSyf5VafKRYEIaZjJA/B7VnNl5YiiP6mSkTHu026ZMFuTFSy/JUNZJb/YXXkrwUZYgQY228zu793CwPKRGhOEsHFDi9CrmTjswCuwbN12yzesS6lAh+Uh8J7xKG0cL8tjqGqGMWRz69yqfWrA5OUDZG/6/Ttf05YDE8f9/y26HjCS77O64J+6IoEPsOkuQ= x-ms-exchange-transport-forked: True Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: verimatrix.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5947232b-c8bc-4765-309b-08d756154020 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Oct 2019 10:55:56.3919 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: dcb260f9-022d-4495-8602-eae51035a0d0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Qs0y8ze0Pxoh1eko244stbn0DlcAbf5g91jg9/aOWRglWQ4It9jSwiO1mxt1nZgMxrBWsnddif/jPZHxComyPt3qtykpjrpkkacxWvDaVac= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR20MB2656 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Another endianness question: I have some data structure that can be either little or big endian, depending on the exact use case. Currently, I have it defined as u32. This causes sparse errors when accessing it using cpu_to_Xe32() and Xe32_to_cpu(). Now, for the big endian case, I could use htonl()/ntohl() instead, but this is inconsistent with all other endian conversions in the driver ... and there's no little endian alternative I'm aware of. So I don't really like that approach. Alternatively, I could define a union of both a big and little endian version of the data but that would require touching a lot of legacy code (unless I use a C11 anonymous union ... not sure if that would be allowed?) and IMHO is a bit silly. Is there some way of telling sparse to _not_ check for "correct" use of these functions for a certain variable? Regards, Pascal van Leeuwen Silicon IP Architect, Multi-Protocol Engines @ Verimatrix www.insidesecure.com > -----Original Message----- > From: Pascal Van Leeuwen > Sent: Monday, October 21, 2019 11:04 AM > To: linux-crypto@vger.kernel.org; herbert@gondor.apana.org.au > Subject: Key endianness? >=20 > Herbert, >=20 > I'm currently busy fixing some endianness related sparse errors reported > by this kbuild test robot and this triggered my to rethink some endian > conversion being done in the inside-secure driver. >=20 > I actually wonder what the endianness is of the input key data, e.g. the > "u8 *key" parameter to the setkey function. >=20 > I also wonder what the endianness is of the key data in a structure > like "crypto_aes_ctx", as filled in by the aes_expandkey function. >=20 > Since I know my current endianness conversions work on a little endian > CPU, I guess the big question is whether the byte order of this key > data is _CPU byte order_ or always some _fixed byte order_ (e.g. as per > algorithm specification). >=20 > I know I have some customers using big-endian CPU's, so I do care, but > I unfortunately don't have any platform available to test this with. >=20 > Regards, > Pascal van Leeuwen > Silicon IP Architect, Multi-Protocol Engines @ Verimatrix > www.insidesecure.com