Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp2498564rdb; Wed, 21 Feb 2024 09:20:37 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVe148rV2oJIW/KZalzCEU2PboUQF6BN8qwM/yG4lnecIFYvNHcUiJvVmmcmj4VsM9f6e6ea90wgRstNdwhdMjaFNg6nvR7lRkAauahww== X-Google-Smtp-Source: AGHT+IG8heYrvbafIdZ4Dl6FToBTtP9MqqsrUWiMVsjJZwXRkl53akp/R5C46xdCsDBT9NYEaWy3 X-Received: by 2002:a05:6a20:9e4a:b0:1a0:96cd:3a1d with SMTP id mt10-20020a056a209e4a00b001a096cd3a1dmr11657727pzb.36.1708536037433; Wed, 21 Feb 2024 09:20:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708536037; cv=pass; d=google.com; s=arc-20160816; b=u22Ini6iFX0Vw5m+YHUwD+9qxVthWfnKk+VpB4Zz3AimWPPGJiS4C4rKGtskmKtKQY ck3VWxE/oSM8v1yD6OU5rvfaf5rT9Ry26bzE83BH31e7+eLETdJNyL5j0Ss+zraeyImt oaz+YUcxXj07ZKrQrEFtl6ERTb4wS8ucS6T3Dp8PoEZOPxAr7wdgVdDo46xIIYnIB7U9 5yGC0DqeI0lHRd16RQYx4ADASqS3Lxh/WO5ht4xPtOp3gr5R/OQeOmixhWl5XyE9nUhn TdgMESlF288BAtRtfHr7jpQ19aEzPgrDBCmZ3/9x47CS11FPgCLqzegNZqzMELwJ4pw8 I+9w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=+OG+ecKsQYxVgvbBvL/TtgozTpt4MGBiORcM4WnZxHk=; fh=Z7cMGb8jAu8fgmkdL0gxnqbE9M6Jrp5daCRHGccW3+0=; b=rt1mer+0wZnaGKAvVWefL5uPHK6jnM2gw4JCWP7PALz8Q2DkXRqOid6INeR8b/5fRa Ll78NX0TBQ3MqFxyExmjlsJ0yPXGstP2DbXPyKwAYvwrKUyHDqRzlZq8CkSo60KEcKeL tUy/WSFdqWztgN4lkkpebutkgkGQHQTUDJLIxQLeiFbnhd5OzICjqpe6IgdoDVuYAWo0 TEVarmlAiFtpDG0z8EU5vYTcihpctsusaUYJCqZvn30Sw6TBKAWbI2gPEabXIOw+ao55 pNaHIlFEzYy0ssLnTKTtJk4HyhIyW1sTANKrCjgwKGYBFZPd4Mj9Yn/4ZbUmt+ehZmdB eFbg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=J9luFRKb; arc=pass (i=1 dkim=pass dkdomain=zx2c4.com); spf=pass (google.com: domain of linux-kernel+bounces-75187-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75187-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id ck2-20020a056a02090200b005dc4c1f8c5dsi8946666pgb.579.2024.02.21.09.20.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 09:20:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75187-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=J9luFRKb; arc=pass (i=1 dkim=pass dkdomain=zx2c4.com); spf=pass (google.com: domain of linux-kernel+bounces-75187-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75187-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=zx2c4.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id EF54C2831AD for ; Wed, 21 Feb 2024 17:20:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B56CD83CAC; Wed, 21 Feb 2024 17:20:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="J9luFRKb" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D9F0E33F7 for ; Wed, 21 Feb 2024 17:19:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708535999; cv=none; b=deALYakqR48UqofXNOH9vyo7ASteJitNW8LO8f0M2bLORMg5OXHmJ1Zf//661LOLJF9W5vJJ0M4pNArZbhRcx3tEIROu/VbekH7hj3xlIK4CilvH51qO9dO+a/qzIumZrK6YzJ1IfrScMPJtquD5G0xkpq0+jO0SJH/TG43x2uE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708535999; c=relaxed/simple; bh=mohUC8yf/GvhUgtVjjHOvP3YR1w8wLsVqsCFCBn5yXo=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=SksRUkGQ0NLz25ePe/lS1xPRB7sP3wOmTtQ03akzGspRPwEpuYRWxUw5GjogVemi7G+wn16RzkPiwvttbsIBjlVHhxbbGLeM8SEwVoG4uM0c97oB1H10X8I3C1moW+SGS14/6of+MBmegsww12veyhEdPk9FdHA7PJJNFAO2V5A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b=J9luFRKb; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4262CC433A6 for ; Wed, 21 Feb 2024 17:19:59 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="J9luFRKb" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1708535995; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=+OG+ecKsQYxVgvbBvL/TtgozTpt4MGBiORcM4WnZxHk=; b=J9luFRKbMsBggAKjcd6FoCQCFqK3url7Sdh3XZYJSr4mA1puXzkyaxHqj6pupLqSCWKODQ RNvHBA3KLaP2mjI97rQQtGZkGNkiNYfLecKiKSTRd4TZSrptHSQxNdrKhTN+qZxCisxLkS ewB8VipIPkj8LHt2k6mBzw1NRSS9BQk= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 5f056f35 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Wed, 21 Feb 2024 17:19:55 +0000 (UTC) Received: by mail-yw1-f179.google.com with SMTP id 00721157ae682-60884277a6dso8161497b3.1 for ; Wed, 21 Feb 2024 09:19:54 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUNaN9GuYeloOIGuCg6uRXWFDvU5D/qLf23R3OZ9SljR1wGAJsr2gRwqNH0P44L1xP6k0UvfWSIPo/hIGenbxAG4P1m5zqA6Ph+VYb9 X-Gm-Message-State: AOJu0Ywq339mDingVJklGc/aQ+4khCutQTWT/UEM/g9uzxEcz0h5GAQv vMmDy2xkKaGR9ZnJ6X3PLK/tHOj8C7Og59+G/E2q0Bs/HrKijoy446Hu+E1RVBLSGoyXz2a4YIq T+VF/RSy9FdfxUIRczDUySAghYK0= X-Received: by 2002:a0d:e250:0:b0:608:94b5:3e2 with SMTP id l77-20020a0de250000000b0060894b503e2mr418397ywe.4.1708535993716; Wed, 21 Feb 2024 09:19:53 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240221123248.25570-1-Jason@zx2c4.com> In-Reply-To: From: "Jason A. Donenfeld" Date: Wed, 21 Feb 2024 18:19:41 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3] x86/coco: Require seeding RNG with RDRAND on CoCo systems To: Dave Hansen Cc: x86@kernel.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, Borislav Petkov , =?UTF-8?Q?Daniel_P_=2E_Berrang=C3=A9?= , Dave Hansen , Elena Reshetova , "H . Peter Anvin" , Ingo Molnar , "Kirill A . Shutemov" , "Theodore Ts'o" , Thomas Gleixner Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Feb 21, 2024 at 5:55=E2=80=AFPM Dave Hansen = wrote: > > On 2/21/24 04:32, Jason A. Donenfeld wrote: > > +__init void cc_random_init(void) > > +{ > > + unsigned long rng_seed[32 / sizeof(long)]; > > My only nit with this is the magic "32". > > Why not 16? Or 64? 32 bytes =3D 256-bits =3D what we're targeting. Very normal thing to see places in the RNG, used all over random.c and lots of platform drivers. Pretty obvious and straightforward to anyone familiar with this kind of code. Not the kind of thing you'd want to replace with some abstracted constant that makes you search.