Return-Path: Received: from mail-it1-f193.google.com ([209.85.166.193]:38852 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387873AbeKFETI (ORCPT ); Mon, 5 Nov 2018 23:19:08 -0500 Received: by mail-it1-f193.google.com with SMTP id k141-v6so12375103itk.3 for ; Mon, 05 Nov 2018 10:58:06 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <20181105182314.c7xdsolvxr2iyd5n@sole.flsd.net> References: <20181024032356.3388-1-vt@altlinux.org> <20181024032356.3388-2-vt@altlinux.org> <20181105182314.c7xdsolvxr2iyd5n@sole.flsd.net> From: Ard Biesheuvel Date: Mon, 5 Nov 2018 19:58:05 +0100 Message-ID: Subject: Re: [PATCH v3 1/3] crypto: streebog - add Streebog hash function To: Ard Biesheuvel , Herbert Xu , "David S. Miller" , Greg Kroah-Hartman , Thomas Gleixner , Philippe Ombredanne , Kate Stewart , "open list:HARDWARE RANDOM NUMBER GENERATOR CORE" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-crypto-owner@vger.kernel.org List-ID: On 5 November 2018 at 19:23, Vitaly Chikunov wrote: > Ard, > > On Mon, Nov 05, 2018 at 02:22:21PM +0100, Ard Biesheuvel wrote: >> >> > +static const struct streebog_uint512 buffer512 = { { >> > + cpu_to_le64(0x200ULL), >> >> Can we keep the memory representation in native endianness, and only >> swab the in/output [where needed]? > > I hope you do not insist on that? > > The code is using same primitives to add/xor/permute with data from > these arrays (buffer512[] and C[], those which use cpu_to_le64), and > from generic data buffers. Having these arrays in native endianness will > cause complexities - code split and duplications. For example, XLPS > permutation will require two versions, with one accessing (y) as is and > another as cpu_to_le64(y). > > The code is based on canonical implementation by RFC 6986 ("GOST R > 34.11-2012: Hash Function") author, and I don't want it do deviate that > much from the original, which would complicate algorithm reviews. > That is a very good reason, so unless anyone has concerns about the performance on BE systems, let's leave it as is.