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 CA6BD740080 for ; Wed, 4 Oct 2023 09:20:12 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=15Zxc8bp9TVJrENcgqfW1E7krYKh73Xx1w+WESqDOA8=; c=relaxed/simple; d=groups.io; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Disposition; s=20140610; t=1696411211; v=1; b=aW68f3iJhKs16MgeZ+wO07G8LkdxlyV8879REeCkj4sg64+AUKCNQXy/+U6/2J2zXDoi99nK gZXcbW0eGQ9RpQbtNu6m+3Jp9eMJF4fbuT/qyLr8EpPbWv2744gDuSB30z2dD+IaOQh+LBvKm06 u+UVFu1RsmNq6yj/GH/yWeqo= X-Received: by 127.0.0.2 with SMTP id K7wIYY7687511xAUk0lKzPea; Wed, 04 Oct 2023 02:20:11 -0700 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.14204.1696411210159443757 for ; Wed, 04 Oct 2023 02:20:10 -0700 X-Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-440-LbpcR6gmOf6F3JBV30dNSg-1; Wed, 04 Oct 2023 05:19:50 -0400 X-MC-Unique: LbpcR6gmOf6F3JBV30dNSg-1 X-Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 20F413806714; Wed, 4 Oct 2023 09:19:50 +0000 (UTC) X-Received: from sirius.home.kraxel.org (unknown [10.39.193.95]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E5D2D40C6EA8; Wed, 4 Oct 2023 09:19:49 +0000 (UTC) X-Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id AFC9A18017F0; Wed, 4 Oct 2023 11:19:48 +0200 (CEST) Date: Wed, 4 Oct 2023 11:19:48 +0200 From: "Gerd Hoffmann" To: Laszlo Ersek Cc: devel@edk2.groups.io, Yi Li , Guomin Jiang , Xiaoyu Lu , Jiewen Yao , Oliver Steffen Subject: Re: [edk2-devel] [PATCH 1/1] CryptoPkg/TlsLib: fix tls cipher configuration Message-ID: <2dvgzez67f7hcs2m7scppnvmknbspsuyvghzuil4wd3sstbekg@qrgjwqsejp4j> References: <20230929132318.2901308-1-kraxel@redhat.com> <028c50b9-dc23-781b-ce1a-c817a81f9e6e@redhat.com> MIME-Version: 1.0 In-Reply-To: <028c50b9-dc23-781b-ce1a-c817a81f9e6e@redhat.com> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Precedence: Bulk 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,kraxel@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: SUnlC9sKNJEkElizPSCgjGi4x7686176AA= Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=aW68f3iJ; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.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, > > + CHAR8 *CipherString; > > + CHAR8 *CipherStringPosition; > > + > > + STACK_OF (SSL_CIPHER) *OpensslCipherStack; > > Surprisingly, this does pass uncrustify. :) OK. Wasn't my idea, uncrustify actually formatted it that way for me ;) > > - Mapping = TlsGetCipherMapping (CipherId[Index]); > > - if (Mapping == NULL) { > > + for (StackIdx = 0; StackIdx < sk_SSL_CIPHER_num (OpensslCipherStack); StackIdx++) { > > Surprisingly, StackIdx really does have to be INT32 type here; through > multiple macro definitions, sk_SSL_CIPHER_num() seems to expand to > OPENSSL_sk_num(), and that returns a plain "int". OK. Yep. Initially I had UINTN, but that caused CI errors due to the type mismatch ... > Then this loop will never run (which is fine), but *after* the loop, our > condition for "not found" will not hold, because StackIdx will be zero, > but sk_SSL_CIPHER_num() will return (-1). Good point, missed that. > but it's probably better to just skip the whole outer loop if > "OpensslCipherStack" is NULL (as no lookup will succeed). Agree, will do it that way. > (4) Why AsciiStrnLenS(), and not AsciiStrLen()? No good reason. I just looked up the edk2 name of strlen using 'git grep strlen CryptoPkg/Library/Include', and this is the result I got ;) > > - Mapping = MappedCipher[Index]; > > + OpensslCipher = MappedCipher[Index]; > > + OpensslCipherName = SSL_CIPHER_get_name (OpensslCipher); > > + OpensslCipherNameSize = AsciiStrnLenS (OpensslCipherName, MAX_STRING_SIZE); > > (5) Better call this "OpensslCipherNameLength" ("Size" suggests > including the terminating NUL). OK. > (8) Can you > > - assign to yourself, > > - link this patch into a comment on that BZ, > > - and reference the BZ URL in the commit message? Will do. take care, Gerd -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109311): https://edk2.groups.io/g/devel/message/109311 Mute This Topic: https://groups.io/mt/101657203/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-