From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 835B7AC14C6 for ; Tue, 18 Jul 2023 08:23:49 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=V+Zblz/Dc7aJL3GOJaJSX6qCMpBX87dN00F19wrRM4Y=; c=relaxed/simple; d=groups.io; h=X-Received:X-Received:X-Received:X-Received:X-MS-Exchange-Authentication-Results:Received-SPF:X-Received:X-Received:X-CheckRecipientChecked:X-CR-MTA-CID:X-CR-MTA-TID:X-Received:X-Received:ARC-Seal:ARC-Message-Signature:ARC-Authentication-Results:Authentication-Results-Original:X-Received:X-Received:Message-ID:Date:User-Agent:Subject:To:Cc:References:From:In-Reply-To:X-ClientProxiedBy:MIME-Version:X-MS-TrafficTypeDiagnostic:X-MS-Office365-Filtering-Correlation-Id:x-checkrecipientrouted:NoDisclaimer:X-MS-Exchange-SenderADCheck:X-MS-Exchange-AntiSpam-Relay:X-Microsoft-Antispam-Untrusted:X-Microsoft-Antispam-Message-Info-Original:X-Forefront-Antispam-Report-Untrusted:X-MS-Exchange-Transport-CrossTenantHeadersStamped:Original-Authentication-Results:X-EOPAttributedMessage:X-MS-Exchange-Transport-CrossTenantHeadersStripped:X-MS-PublicTrafficType:X-MS-Office365-Filtering-Correlation-Id-Prvs:X-Microsoft-Antispam-Message-Info:X-OriginatorOrg:X-MS-Exchange-CrossTenant-OriginalArrivalTime:X-M S-Exchange-CrossTenant-Network-Message-Id:X-MS-Exchange-CrossTenant-Id:X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp:X-MS-Exchange-CrossTenant-AuthSource:X-MS-Exchange-CrossTenant-AuthAs:X-MS-Exchange-CrossTenant-FromEntityHeader:X-MS-Exchange-Transport-CrossTenantHeadersStamped:Precedence:List-Unsubscribe:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:X-Gm-Message-State:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1689668628; v=1; b=imV2LM7oWKahwavMbZKLlWZSNW8IHnp3t9p0itG7U78AIlAdjzARxcpa9J3L/KGUUg2tkGNy +nCLYX4CF4zCGc51kpjcgCBg6JYcEbWz42wV8WALiNFT6hMJgazjUpE4pUXXFTqevDmzTO3oFO3 SDYDdetnb0eJJUPIjEkoj8pc= X-Received: by 127.0.0.2 with SMTP id qVmOYY7687511xidvfAE4Bjo; Tue, 18 Jul 2023 01:23:48 -0700 X-Received: from EUR05-AM6-obe.outbound.protection.outlook.com (EUR05-AM6-obe.outbound.protection.outlook.com [40.107.22.72]) by mx.groups.io with SMTP id smtpd.web10.3245.1689668627037199150 for ; Tue, 18 Jul 2023 01:23:47 -0700 X-Received: from DU2PR04CA0332.eurprd04.prod.outlook.com (2603:10a6:10:2b4::20) by PA4PR08MB5965.eurprd08.prod.outlook.com (2603:10a6:102:f3::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.31; Tue, 18 Jul 2023 08:23:43 +0000 X-Received: from DBAEUR03FT018.eop-EUR03.prod.protection.outlook.com (2603:10a6:10:2b4:cafe::9b) by DU2PR04CA0332.outlook.office365.com (2603:10a6:10:2b4::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.33 via Frontend Transport; Tue, 18 Jul 2023 08:23:43 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; pr=C X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DBAEUR03FT018.mail.protection.outlook.com (100.127.142.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.33 via Frontend Transport; Tue, 18 Jul 2023 08:23:43 +0000 X-Received: ("Tessian outbound f5de790fcf89:v145"); Tue, 18 Jul 2023 08:23:43 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: b6ac6ee704df5100 X-CR-MTA-TID: 64aa7808 X-Received: from d5a8a261cb4f.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id F05625B2-B41A-4D9D-993F-57E5607E2021.1; Tue, 18 Jul 2023 08:23:37 +0000 X-Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id d5a8a261cb4f.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 18 Jul 2023 08:23:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IlITzQ3xEgIuD3W2iok5ngEE++tNXBUtjzVyVVNnFaS6ci8CVmWRDIOOSu71HM5dbNsNqEKB5aKAol8Plgw/aLp+uJem4rWlXqUYJtjsH7PgzExpxs8lSuO5m1nVeHm1WjitQ4c+1r67Jp5kJCdcSfKd3FD12koG4ncYHcX2FFXu/ZwwMdhX9wq3ZV9suImopkDJrf1el/DKC33cYu4HjDv13/lZlucHY61ouTBlGpXDeUXkz3et+G54Dvn5ABtMlVfKQXpk4ZbRVYV1HGzE6XBmgC7+DzFj5pvdno1JGz8HtVN/5WfNPt6SuU/CxOgaQSIS1DudUrnfzbc0+MFwqQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ds7L1kjMsDTfxlNbV9bnpC4VbCORtcSesuRaHUUO7Lk=; b=NDiw36eU+vlf56KRTjQ5bSSjen/BCB09l1oQxDsqBDzHPUJ+Cw5D6JaN23OmLFIdcKW2AzTQU4X3Bx+xntw3WH3xCifBKmrG7nIJNtaD8gSQl07TpbSBTurSVnvBgNo0G6higea8vPt8kT9aLZJzWtkI7bWI2rN+qZXz/fJ1t/wIXnFffWTUrpIkG+lWaZ3kw818SD/BTqEMNVpULkp0zfjSZj3D9l75v1JpG6OXQE++K00vdFjx+Ok5ortV/DJS2VTF1IqkXhwzm0LZswRtUR9lwoeh8epjgmEIIYGYDhSWt0bL9/lfwikMmCoXq9yXIHi7IUaky5zdQfF2N9wWgg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-Received: from AM0PR08MB4289.eurprd08.prod.outlook.com (2603:10a6:208:148::12) by AS8PR08MB6469.eurprd08.prod.outlook.com (2603:10a6:20b:33c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6588.32; Tue, 18 Jul 2023 08:23:35 +0000 X-Received: from AM0PR08MB4289.eurprd08.prod.outlook.com ([fe80::da5c:620:3103:ed69]) by AM0PR08MB4289.eurprd08.prod.outlook.com ([fe80::da5c:620:3103:ed69%4]) with mapi id 15.20.6588.031; Tue, 18 Jul 2023 08:23:34 +0000 Message-ID: <96c24531-d8da-551e-f23f-f2fdb4b905a6@arm.com> Date: Tue, 18 Jul 2023 09:23:32 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [edk2-devel] [PATCH v1 1/1] CryptoPkg/BaseCryptoLib: Remove unnecessary key generation. To: "Li, Yi1" , "devel@edk2.groups.io" Cc: "Yao, Jiewen" , "Lu, Xiaoyu1" , "Jiang, Guomin" , "sami.mujawar@arm.com" , "pierre.gondois@arm.com" , "nd@arm.com" References: <20230717095401.1954867-1-yeoreum.yun@arm.com> From: "levi.yun" In-Reply-To: X-ClientProxiedBy: LO4P123CA0547.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:319::16) To AM0PR08MB4289.eurprd08.prod.outlook.com (2603:10a6:208:148::12) MIME-Version: 1.0 X-MS-TrafficTypeDiagnostic: AM0PR08MB4289:EE_|AS8PR08MB6469:EE_|DBAEUR03FT018:EE_|PA4PR08MB5965:EE_ X-MS-Office365-Filtering-Correlation-Id: 2755b0fe-6934-4668-8a07-08db87684c62 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: 3y0ltb6PUdI4JrJgyxCpq3jLRmJ3p7TH+CqOmKqzd0M13m9qLXjL67XMQDbczbkSlHw5zi/bNpSMJe08A+ctcylQnmVWVuMHMlUyzu5TTuL3hOnybFq9qcxjjW17O7hSOVjYu8j4RXxm4nYz5n5v39a2bOlbfjTpE0oW9r/8+LPT68YcGg6CfLgPCc33qUa7Z5a6phGRLatbALiD/z1+01e6CGj12j5Mp5Y/aCwURx/m3nfggvKazuhEqTLBAaDVXLl2yu5GUBobwmWBjzwdr7rLSs/ne+X8O4Xki8S704ob6KbmQs4J/2aAii8NYdKW+6Xn+ZJ3KFFTLyqD5Fax/EP2yV9hb1l6tde3Jo0QhpBrCENuzwBYymDT6566LUg1+u0ZrQqywtNTqM+KXso5i291bllmxBtQvVxWoI44b9UP6reqSY6Sr0th0cAQjIrHFYx02RkJgb/0lsv624ZEz5HgU/dD82G4oyO6+2SJFY+S3yNbEmY/MX5CunqKqPH8l3+zRLfEvV3AE8kYs4kmmJuUEr7DfNK7JbAONVu9INehSWiwSMbK6WmhzAVTnpiCYabGbOoUN5p407Av+WK7sg230g+2m1dWhMgE4zKydmNrp7eKpB5vyKp8jjT2ib/G1d1O3u3dxJ+ImPJl8Y70rg== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM0PR08MB4289.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(136003)(396003)(376002)(366004)(346002)(39860400002)(451199021)(31696002)(86362001)(2906002)(36756003)(31686004)(83380400001)(6512007)(186003)(53546011)(26005)(6506007)(54906003)(6486002)(110136005)(4326008)(66946007)(66476007)(316002)(2616005)(478600001)(66556008)(38100700002)(8676002)(5660300002)(8936002)(41300700001)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6469 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DBAEUR03FT018.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: c1ad90ed-2a53-4dc8-dd8f-08db87684720 X-Microsoft-Antispam-Message-Info: dtopqk92QO6FIo7EKhOQ4k0NsU2+m8nWzyWZQyr9sUU8ycD2W/V2yyeoPGUooRO+v4uxfIvZDwDcT+xWjcOW46KxpY8Et9SPXmbnZBM1rGWHE0tFscYeWLNMzMRbniS5tlnVh5fG/JcRnrhqdTx7VKPcjHa4VIoep01uq9IXBwONVWSyZ1g757KDLnKuBxtWdYBPWj4+EBKB0DBR+IDZeiKZJw7fSPerX6bpuvnJb1dlOq00XJLoqE5V8BwsZL0s/zzEihpIjuQE6rKf91m5Op2UEo+06Hv6o/aDUgYfxH0AAE7SprCdxUCohfnJMnC7GdX/EKnFSf/f/t/CXAYySXM+agh82iAbbdY3npo5u2Fu2yOLE9Ev/YlJ1nTchmqWcfDkYJIcmv1QpQyYm78MlbchoVpHpajL132aJy/GB3LICHGC7zAMK5bt4ajS/3ZekYQq7AzOn+XDPNCHl45B9bwxBNyzA/h3EbvsFbZkZw9KPEsvL8s9kvA6S4liv/ktz4P3nZ0yylDYUcfj9vhJOjvQvMmLxjxzpyzwbtu+fC5o5ae/gCAVCYlm3NR5LQcLHNB6uj6yvGzE7mDNPvXrVgacQs5V3Kw5hGWrHsTkquJqbJyDHvSWcd3PMgiEukQpLg9uA5ffQP8hl5Ha+0Py868RieGkXS0sx0toyybbxqBcE5VWpWvxMD7lrzaAnfCQ7pg7K+v9SL5NlpP1hIoU8RwmpzMfiOt2+TtlsPhAwJCz5rz8a61sOhDXflWPs7PGLfTb2wDuF9eaLYTvDOtVcg== X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Jul 2023 08:23:43.0775 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2755b0fe-6934-4668-8a07-08db87684c62 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: DBAEUR03FT018.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PA4PR08MB5965 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,yeoreum.yun@arm.com X-Gm-Message-State: BFW77xwVZ38Vl1u73SQyJeKVx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=imV2LM7o; arc=reject ("signature check failed: fail, {[1] = sig:microsoft.com:reject}"); dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=arm.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io Hi Li! On 18/07/2023 07:03, Li, Yi1 wrote: > Hi, > > This function has a special use case: when the input PublicKey array is N= ULL and size is 0, the function will generate EC keypair and update context= , and fill PublicKeySize with non-zero keysize to indicate success. > > (CryptEc.c L492) > if ((PublicKey =3D=3D NULL) && (*PublicKeySize !=3D 0)) { > return FALSE; > } Thanks to make me know :) IIUC, That special case could be used with EcGetPubKey. > > I recommend the below changes: > > HalfSize =3D (EC_GROUP_get_degree (Group) + 7) / 8; > > + if ((PublicKey !=3D NULL) && (*PublicKeySize < HalfSize * 2)) { > + *PublicKeySize =3D HalfSize * 2; > + return FALSE; > + } > // Assume RAND_seed was called > if (EC_KEY_generate_key (EcKey) !=3D 1) { > return FALSE; > } > > - if (*PublicKeySize < HalfSize * 2) { > + // If PublicKey is NULL and PublicKeySize is 0, return TRUE and fill Pu= blicKeySize with correct Key size. > + if (*PublicKeySize =3D=3D 0) { > *PublicKeySize =3D HalfSize * 2; > - return FALSE; > + return TRUE; > } Look good to me But it would be better to set key size above of If clause. I'll send the patch again :) Many thanks. -------- Sincerely, Levi. IMPORTANT NOTICE: The contents of this email and any attachments are confid= ential and may also be privileged. If you are not the intended recipient, p= lease notify the sender immediately and do not disclose the contents to any= other person, use it for any purpose, or store or copy the information in = any medium. Thank you. -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#106983): https://edk2.groups.io/g/devel/message/106983 Mute This Topic: https://groups.io/mt/100191693/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-