From: "Michael Brown" <mcb30@ipxe.org>
To: devel@edk2.groups.io, abner.chang@amd.com
Cc: Saloni Kasbekar <saloni.kasbekar@intel.com>,
Zachary Clark-williams <zachary.clark-williams@intel.com>,
Nickle Wang <nicklew@nvidia.com>,
Igor Kulchytskyy <igork@ami.com>
Subject: Re: [edk2-devel] [RFC][PATCH 0/2] Introduce HTTPS Platform TLS policy
Date: Mon, 1 Jan 2024 23:07:21 +0000 [thread overview]
Message-ID: <0102018cc7481f4b-30b20784-217d-4677-8854-055c9e509c70-000000@eu-west-1.amazonses.com> (raw)
In-Reply-To: <MN2PR12MB39667B61B8AF57340295961EEA9DA@MN2PR12MB3966.namprd12.prod.outlook.com>
On 29/12/2023 15:07, Chang, Abner via groups.io wrote:
> To locate TLS protocol from the HTTP handle and configure TLS configuration data at the return from EfiHttpRequest during that short window of non-blocking request is not reliable. It also doesn't make sense to ask upper layer application to do this when it first time invokes EfiHttpRequest.
> I already refactored TlsCreateChild to install TLS protocol on HTTP handle. I also implemented the corresponding code in Redfish REST EX to listen the installation of TLS protocol and hook the SetSessionData. It works fine on the system, however I really don’t like having the upper layer application to do this much just for overriding TLS configuration data. The code looked a specific implementation to hack the TLS protocol interface. Plus I still have to add few code in TlsConfigCertificate to skip configure certificate with checking TlsVerifyMethod.
> We should sit back to consider introducing a new protocol for upper layer application to provide their own TLS configuration data, as the root cause is that hard coded TLS configuration data in HttpSupport.c. We shouldn't have the code like that and add the burdens to application.
>
> What my thought is as below and maybe more elegant than the patch a sent,
> - Still install TLS on HTTP handle, then upper layer application can listen to the installation of EFI TLS protocol to find the correct HTTP handle.
> - Move TLS_CONFIG_DATA in a public header file.
> - Introduce a new protocol called EDKII_HTTP_TLS_CONFIGURATION_DATA
> - Upper layer application installs this protocol with their own TLS_CONFIG_DATA.
> - TlsConfigureSession locates EDKII_HTTP_TLS_CONFIGURATION_DATA to replace the default TLS_CONFIG_DATA.
>
> This way we can remove that hardcoded code and fix the root cause, also the upper layer application do not have to take the burden.
> What do you think?
Firstly, thank you very much for taking the time to dig through this and
work towards a cleaner design - I, for one, really appreciate it.
I think we're completely agreed that installing the TLS protocols on the
HTTP handle is the right thing to do - that seems to be a clear
improvement over the status quo where there's no introspectable
relationship between the two handles.
I'm torn on the use of TLS_CONFIG_DATA. For better or worse, the
existing and standardised EFI_TLS_CONFIGURATION_PROTOCOL is verb-based,
using SetData() and GetData() methods. Adding a noun-based protocol for
TLS configuration seems to cut across this, with the potential to look
confusing: a new reader of the code could legitimately wonder why the
codebase contains two competing solutions to what is essentially the
same problem.
Given that the verb-based approach of EFI_TLS_CONFIGURATION_PROTOCOL has
made it as far as being standardised and included in the UEFI
specification, I think we probably need to accept that this is the
"correct" way to perform TLS configuration within UEFI code. The
problem with HttpsSupport.c then becomes that there is no good
opportunity for a consumer to call SetData(), since (a)
EFI_TLS_CONFIGURATION_PROTOCOL comes into existence only halfway through
the call to EFI_HTTP_PROTOCOL.Request() and (b) the call to
TlsConfigureSession() will overwrite the configuration anyway.
Is there a way that TlsConfigureSession() could sensibly provide an
opportunity for the consumer to make calls to SetData(), so that the
consumer could cleanly override any default configuration?
Looking through the code, TlsConfigureSession() is called only from
HttpInitSession(), which in turn is called only from EfiHttpRequest().
This call is followed immediately by the line:
HttpNotify (HttpEventInitSession, Status);
which seems to already use an existing EDKII_HTTP_CALLBACK_PROTOCOL to
notify an arbitrary list of interested consumers that an event has taken
place (in this case, that a session has just been initialised).
What do you think about:
- installing TLS on HTTP handle (as you have already implemented)
- using EDKII_HTTP_CALLBACK_PROTOCOL to catch the HttpEventInitSession
and perform whatever calls are needed to SetData() to modify the TLS
configuration?
Thanks,
Michael
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113015): https://edk2.groups.io/g/devel/message/113015
Mute This Topic: https://groups.io/mt/103368438/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2024-01-01 23:07 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-26 11:28 [edk2-devel] [RFC][PATCH 0/2] Introduce HTTPS Platform TLS policy Chang, Abner via groups.io
2023-12-26 11:28 ` [edk2-devel] [RFC][PATCH 1/2] NetworkPkg: EDKII HTTPS platform " Chang, Abner via groups.io
2023-12-26 11:28 ` [edk2-devel] [RFC][PATCH 2/2] NetworkPkg: Check " Chang, Abner via groups.io
2023-12-27 15:55 ` [edk2-devel] [RFC][PATCH 0/2] Introduce HTTPS Platform " Michael Brown
2023-12-28 2:47 ` Chang, Abner via groups.io
2023-12-28 14:16 ` Michael Brown
2023-12-28 15:04 ` Chang, Abner via groups.io
2023-12-28 15:31 ` Michael Brown
2023-12-28 23:37 ` Chang, Abner via groups.io
2023-12-29 0:01 ` Michael Brown
2023-12-29 15:07 ` Chang, Abner via groups.io
2023-12-30 11:31 ` Chang, Abner via groups.io
2024-01-01 23:07 ` Michael Brown [this message]
2024-01-02 6:06 ` Chang, Abner via groups.io
2024-01-02 12:42 ` Michael Brown
2024-01-02 16:31 ` Chang, Abner via groups.io
2024-01-02 17:46 ` Michael Brown
2024-01-04 3:13 ` Chang, Abner via groups.io
2024-01-05 8:41 ` Chang, Abner via groups.io
2024-01-05 17:16 ` Michael Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0102018cc7481f4b-30b20784-217d-4677-8854-055c9e509c70-000000@eu-west-1.amazonses.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox