From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.92.20.104]) by mx.groups.io with SMTP id smtpd.web12.990.1596475266050738878 for ; Mon, 03 Aug 2020 10:21:06 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@outlook.com header.s=selector1 header.b=ZyoQpPoM; spf=pass (domain: outlook.com, ip: 40.92.20.104, mailfrom: spbrogan@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BmQJqg4aWPsf8Qkdm+WOwXakCupdpXKmAMN5EHh8wWDfyqZKrKFQ8EP/zZsoZcI+ndDeRu59OSgYoE3VF+ouwJII2oUO59P2fduOhxT6uVbAf4dC6PKnzgE/9J4E4ZNnu0kpMuy1wkl87Pr3d9puf0JtV9tfwbrXttjRKWPT1vxnKAWsyMc32En8fqXvpEYYBcL1MnzR0izTNO28iu82mHd1y6SthK5o0POm3c48mzXUM384c9xXzC+m3xrvkh+TzmSmyWZ9pQc9cTdwwKqgyKF4gmBd2jHROlYV+J/IiGNYPHBsk6PQo/NMu/ddWfiVqV8k12oCEYF44fPw0X6Hyw== 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=nyyf3y8Lvix0SHA9TZ2z2ghXq7UVJinuQKJgNjgf1JE=; b=kM/3Jt6R9czuvldEOq2M8c0DmSRfGNUcuRfFg7p5Z2Q8C/1kKMTv/3Vg/gw0/OukfrwlMAKxxM7BcTZts33Hpu2aoAxyBq5bObazwI4/r1T/TQbOjGbAXcETLWAKnyUQFLXCWAua2+1y+6dK363A1jaYXH9ff1RROp46CL1E/LBShoDfflxZ0cAIX694BGj4Ge86V3CQm6v1pmqiiwtiPsg7j7lfyHIHu61vBAhBIuqTOJY0DIjpZTRIU++Lpq0cdff/vvizLT91dcAozZl0+b+Sk1e2yUbvck/riN8Qf2C0ybwf2Q7mjMFgfZIyr02cRpEy+uiAVdFpABgR+rCchw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nyyf3y8Lvix0SHA9TZ2z2ghXq7UVJinuQKJgNjgf1JE=; b=ZyoQpPoM6F/HVQPhwc+hZ/EZl2J5DOjxUAkfVZpDDeki/vN8WJakEuZgtkG2m+CJYxZG5dUC+0wPys5WUI5PicrI9eVQA66jHgy8vJK5aAR+suR/LpqkEjHE1sAwPJMyvvPJdRuU0OPBbbZK2dBlGBx65noWN4tgy6osrgJIVN/oBwZgT1rcTtbAJEPKKstwQlyGyx0wd9wAsLJyuITwx8yfSnRRp63FS0lrJfIESEk5IEF7dRh1iurGD4DtXmVQMspbBWZyi4/kBghBfOMlSuQbmsM6TXXb1EJN77fADAEvXEFdRriCkZ5/mU0BfqOz4VsRyufCjEsBDrbY8r0r2g== Received: from CO1NAM11FT040.eop-nam11.prod.protection.outlook.com (2a01:111:e400:3861::4a) by CO1NAM11HT163.eop-nam11.prod.protection.outlook.com (2a01:111:e400:3861::428) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.20; Mon, 3 Aug 2020 17:21:04 +0000 Received: from BN8PR07MB6962.namprd07.prod.outlook.com (2a01:111:e400:3861::46) by CO1NAM11FT040.mail.protection.outlook.com (2a01:111:e400:3861::140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3239.20 via Frontend Transport; Mon, 3 Aug 2020 17:21:04 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:8864BB81DB6F94D8203FF704389B62A1C879E71090A5CD791F45A8E1A002528C;UpperCasedChecksum:E3A208C8AAFB164789CAE4C0927137A16E788E38E16AF80AE7D2707422DBF718;SizeAsReceived:9029;Count:48 Received: from BN8PR07MB6962.namprd07.prod.outlook.com ([fe80::4115:2eac:5a88:50b9]) by BN8PR07MB6962.namprd07.prod.outlook.com ([fe80::4115:2eac:5a88:50b9%8]) with mapi id 15.20.3239.021; Mon, 3 Aug 2020 17:21:04 +0000 Subject: Re: [edk2-devel] [PATCH v3 0/3] Use RngLib instead of TimerLib for OpensslLib To: devel@edk2.groups.io, liming.gao@intel.com, "Kinney, Michael D" , "matthewfcarlson@gmail.com" References: <20200731202712.1759-1-matthewfcarlson@gmail.com> From: "Sean" Message-ID: Date: Mon, 3 Aug 2020 10:21:01 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 In-Reply-To: X-ClientProxiedBy: CO2PR05CA0001.namprd05.prod.outlook.com (2603:10b6:102:2::11) To BN8PR07MB6962.namprd07.prod.outlook.com (2603:10b6:408:d6::11) Return-Path: spbrogan@outlook.com X-Microsoft-Original-Message-ID: MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [192.168.2.78] (50.47.113.221) by CO2PR05CA0001.namprd05.prod.outlook.com (2603:10b6:102:2::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3261.13 via Frontend Transport; Mon, 3 Aug 2020 17:21:03 +0000 X-Microsoft-Original-Message-ID: X-TMN: [roojMPBni8zWKxzaONInIo7ufTfNO6lL] X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: 4b6ffa23-504c-4eaa-a04a-08d837d199b1 X-MS-TrafficTypeDiagnostic: CO1NAM11HT163: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: WWEnhOnNtjSHnnJvnU/VUtacYyBmOV+f1Yn7PUfeT2Hi7+riSRboy1MOK+hGPSNJCPDYeGve53KLMHWmpYTVC+51WRCVQjb4sxxkeOErIw9FNniph++jQhNt+9h8q/C14HizUN5fd3ezq6P6HCUI1zV0YX7qHdQk2k8vu8zMZ/bZgsdwOkTQjKop36JxeJBCdGIdkoPaiDlJAvfjdSw75nXXYzODdWXUlClNo0nTGqVR5eAQqDDnp8mTU7yn3dvl X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:0;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR07MB6962.namprd07.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:;DIR:OUT;SFP:1901; X-MS-Exchange-AntiSpam-MessageData: ndyhLTR/IARmMlAQ9OGF4jKRBKU9Mz8ZFSl6pV5G5u6QZMeWupcm09ZCL9LZbF/b90XwlPCRFmnS0AQnwYp4u8JGgE9vEZFgQeLout6PuZA6hpePZmrdbZOCh701WhRPyxOSxwLFjkI8ImdD+qaxFg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4b6ffa23-504c-4eaa-a04a-08d837d199b1 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Aug 2020 17:21:04.4588 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT040.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1NAM11HT163 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable I would rather see the the BaseCryptLib and TlsLib instance in all=20 packages other than CryptoPkg should use the NULL instance of the libs.=20 This would avoid the dependency. Any concerns of going this route? Thanks Sean On 8/3/2020 12:03 AM, Liming Gao wrote: > Hi Matt: > With this change, which library instance should be used for the platf= orm? BaseRngLibTimerLib? >=20 > And, this patch introduces the dependency for RngLib. Then, NetworkPk= g and FmpDevicePkg package level build will break. Will you update them? >=20 > Thanks > Liming > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Michael D= Kinney > Sent: 2020=E5=B9=B48=E6=9C=881=E6=97=A5 5:17 > To: devel@edk2.groups.io; matthewfcarlson@gmail.com; Kinney, Michael D <= michael.d.kinney@intel.com> > Subject: Re: [edk2-devel] [PATCH v3 0/3] Use RngLib instead of TimerLib = for OpensslLib >=20 > Hi Matt, >=20 > 1) BaseRngLibTimerLib > a) The comments incorrectly list delays in ms instead of us. > b) Did you consider use of GetPerformanceCounterProperties()? > I also do not seen an explanation of the delay values used. > (why not smaller or larger values). At a minimum, the file > header should state it only works if the rate of the perf > counter from TimerLib is much greater than 1MHz. > 2) BaseRngLibDxe > a) This is not a lib of type Base. I recommend the name > DxeRngLibRngProtocol. > b) Has a "MU_CHANGE" comment that can be removed > c) GenerateRandomNumberViaNist800Algorithm() assigns values in > declaration. Init should be moved into statements. > d) How would gBS aver be NULL? The INF lists the BootServicesTableL= ib > as a dependency, so the constructer is always run before the > services are used. I think these checks can be removed. > e) Minor code style issues. if statements should have { as end of l= ine. >=20 > With the addition of DxeRngLibRngProtocol to MdePkg, I think the CryptoP= kg DSC can be updated to use this RngLib instance from the Crypto DXE modod= ule. >=20 > Best regards, >=20 > Mike >=20 >> -----Original Message----- >> From: devel@edk2.groups.io On Behalf Of Matthew >> Carlson >> Sent: Friday, July 31, 2020 1:27 PM >> To: devel@edk2.groups.io >> Subject: [edk2-devel] [PATCH v3 0/3] Use RngLib instead of TimerLib >> for OpensslLib >> >> From: Matthew Carlson >> >> Fixes Bugzilla#1871 >> https://github.com/tianocore/edk2/pull/845 >> >> >> Matthew Carlson (3): >> CryptoPkg: OpensslLib: Use RngLib to generate entropy in rand_pool >> MdePkg: TimerRngLib: Added RngLib that uses TimerLib >> MdePkg: BaseRngLibDxe: Add RngLib that uses RngDxe >> >> CryptoPkg/Library/OpensslLib/rand_pool.c >> | 203 ++---------------- >> CryptoPkg/Library/OpensslLib/rand_pool_noise.c >> | 29 --- >> CryptoPkg/Library/OpensslLib/rand_pool_noise_tsc.c >> | 43 ---- >> MdePkg/Library/BaseRngLibDxe/RngDxeLib.c >> | 216 ++++++++++++++++++++ >> MdePkg/Library/BaseRngLibTimerLib/RngLibTimer.c >> | 154 ++++++++++++++ >> CryptoPkg/CryptoPkg.dsc >> | 1 + >> CryptoPkg/Library/OpensslLib/OpensslLib.inf >> | 15 +- >> CryptoPkg/Library/OpensslLib/OpensslLibCrypto.inf >> | 15 +- >> CryptoPkg/Library/OpensslLib/rand_pool_noise.h >> | 29 --- >> MdePkg/Library/BaseRngLibDxe/BaseRngLibDxe.inf >> | 38 ++++ >> >> MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.in >> f | 38 ++++ >> >> MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.un >> i | 17 ++ >> MdePkg/MdePkg.dsc >> | 5 +- >> 13 files changed, 489 insertions(+), 314 deletions(-) delete mode >> 100644 CryptoPkg/Library/OpensslLib/rand_pool_noise.c >> delete mode 100644 >> CryptoPkg/Library/OpensslLib/rand_pool_noise_tsc.c >> create mode 100644 >> MdePkg/Library/BaseRngLibDxe/RngDxeLib.c >> create mode 100644 >> MdePkg/Library/BaseRngLibTimerLib/RngLibTimer.c >> delete mode 100644 >> CryptoPkg/Library/OpensslLib/rand_pool_noise.h >> create mode 100644 >> MdePkg/Library/BaseRngLibDxe/BaseRngLibDxe.inf >> create mode 100644 >> MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.in >> f >> create mode 100644 >> MdePkg/Library/BaseRngLibTimerLib/BaseRngLibTimerLib.un >> i >> >> -- >> 2.27.0.windows.1 >> >> >> >=20 >=20 >=20 >=20 >=20 >=20 >=20