Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2977104ybb; Mon, 30 Mar 2020 17:29:43 -0700 (PDT) X-Google-Smtp-Source: ADFU+vumPLe2xhAv6QeOzbgh94R0hRRHMhznMCGR8YEmXH/eEQmgID653ARY4bB0+goSs0FF+ceQ X-Received: by 2002:a9d:748a:: with SMTP id t10mr6825812otk.244.1585614583406; Mon, 30 Mar 2020 17:29:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585614583; cv=none; d=google.com; s=arc-20160816; b=xKT9I1wTIZpxyCFk2CdWLMSAaS3pscpbxT0uS5Z4v4UtZ5X0Yp3sesK4+7XmN0Aahe 831K7tpdaHUyM8udUFN+Gndhd1Xu3XXOHf98j/k5mgYCONrLQUuAql1NCuLRM8OQckjF 4pnSF10TfYHf0b8FphlV/Ligd/PJympMSPj40g6hMwp8nsQts6oMnCSzU/nHoLTwN6gn K6B8GWRN+hrNXIOlOxo11WxaRJKkYOGbRg2doaJ/RcUkE3YKvH1xLfS1smZjaj1DFsH9 omT/01N2zDJw2A5v9TuxiarXGRw8WjkRWsO0VXoSAL/mR8tG8Y9YhuRbDdEsldN4aOYT qJWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=J5rqyz3AkWbhOrMTsjqvVHghVe+mUN4oqkFWY1fJjzI=; b=1E2mCKxEf3EDlsTITVe4bKJwuAlA7OI1sZ3AnmaKuZE2EIIoGdBX69qfwHK03xbNaR Bpd1Vr325uBjOP1OpVWQ/HeDXxg4LJag64bAfB6G+yzY/nh40kzVVjunur2zrnWwIH+F dQXa46a+Fy5iS98XBOoKTP9J2Ej3W+5zbBYpXQIAmz6Lbep9mSlTniv5cbaCHKXbHxxR 8kBgB+JRxjSgua3h7b+1byYfQh4vdishGHcxnBVfqoUK1rbr1yCB+wd7wAZJytpxiRtr +ZBxNRNmWzD6k+Rs4azfLi8e8Wc0cL1N4MVPt8/90j/TSLbj0zFvEwoJV3nHCHAwHt9U Fo8g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m9si4534590otp.239.2020.03.30.17.29.30; Mon, 30 Mar 2020 17:29:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729776AbgCaA1w (ORCPT + 99 others); Mon, 30 Mar 2020 20:27:52 -0400 Received: from mx.sdf.org ([205.166.94.20]:50593 "EHLO mx.sdf.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729509AbgCaA1w (ORCPT ); Mon, 30 Mar 2020 20:27:52 -0400 Received: from sdf.org (IDENT:lkml@sdf.lonestar.org [205.166.94.16]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 02V0Rcil008616 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO); Tue, 31 Mar 2020 00:27:39 GMT Received: (from lkml@localhost) by sdf.org (8.15.2/8.12.8/Submit) id 02V0RcpH025667; Tue, 31 Mar 2020 00:27:38 GMT Date: Tue, 31 Mar 2020 00:27:38 +0000 From: George Spelvin To: Mark Rutland Cc: linux-kernel@vger.kernel.org, Catalin Marinas , Will Deacon , linux-arm-kernel@lists.infradead.org, lkml@sdf.org Subject: Re: [RFC PATCH v1 44/50] arm64: ptr auth: Use get_random_u64 instead of _bytes Message-ID: <20200331002738.GE9199@SDF.ORG> References: <202003281643.02SGhOi3016886@sdf.org> <20200330105745.GA1309@C02TD0UTHF1T.local> <20200330193237.GC9199@SDF.ORG> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200330193237.GC9199@SDF.ORG> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 30, 2020 at 07:32:37PM +0000, George Spelvin wrote: > On Mon, Mar 30, 2020 at 11:57:45AM +0100, Mark Rutland wrote: >> As I am unaware, how does the cost of get_random_bytes() compare to the >> cost of get_random_u64()? > > It's approximately 8 times the cost. Just a expand on on a point I may have left unclear: One get_random_bytes(), for a length up to 32 bytes, is approximately 8x the one get_random_u64(). (Then it jumps to 16x for up to 96 bytes.) Since were're using *two* get_random_u64() calls to replace one get_random_bytes(), it's a 4x cost difference between the two alternative ways of generating a 128-bit key.