From: Jeffrey Walton Subject: Re: better patch for linux/bitops.h Date: Thu, 5 May 2016 00:03:29 -0400 Message-ID: References: <20160504190723.GD3901@thunk.org> <572A6CDD.10503@av8n.com> <572A6F1C.2080708@av8n.com> <28624BFC-7C63-4F38-9F67-7CBFB0C6499B@zytor.com> <0015E1DE-DFF9-4CCE-805E-7AC286021BED@zytor.com> <20160505035028.GD10776@thunk.org> Reply-To: noloader@gmail.com Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 To: "Theodore Ts'o" , Jeffrey Walton , "H. Peter Anvin" , John Denker , linux-kernel@vger.kernel.org, Stephan Mueller , Herbert Xu , Andi Kleen , Sandy Harris , cryptography@lakedaemon.net, linux-crypto@vger.kernel.org Return-path: Received: from mail-io0-f175.google.com ([209.85.223.175]:34843 "EHLO mail-io0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750702AbcEEEDa (ORCPT ); Thu, 5 May 2016 00:03:30 -0400 In-Reply-To: <20160505035028.GD10776@thunk.org> Sender: linux-crypto-owner@vger.kernel.org List-ID: On Wed, May 4, 2016 at 11:50 PM, Theodore Ts'o wrote: > ... > But instead of arguing over what works and doesn't, let's just create > the the test set and just try it on a wide range of compilers and > architectures, hmmm? What are the requirements? Here's a short list: * No undefined behavior - important because the compiler writers use the C standard * Compiles to native "rotate IMMEDIATE" if the rotate amount is a "constant expression" and the machine provides it - translates to a native rotate instruction if available - "rotate IMM" can be 3 times faster than "rotate REG" - do any architectures *not* provide a rotate? * Compiles to native "rotate REGISTER" if the rotate is variable and the machine provides it - do any architectures *not* provide a rotate? * Constant time - important to high-integrity code - Non-security code paths probably don't care Maybe the first thing to do is provide a different rotates for the constant-time requirement when its in effect? Jeff