-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use new API on new windows to get TLS13 #37888
Conversation
Tagging subscribers to this area: @dotnet/ncl |
src/libraries/Common/src/Interop/Windows/SspiCli/SecuritySafeHandles.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Windows/SspiCli/SecuritySafeHandles.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Windows/SspiCli/Interop.SSPI.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Windows/SspiCli/Interop.SSPI.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Windows.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Windows.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Windows.cs
Outdated
Show resolved
Hide resolved
this is ready for another review round. |
public int cCreds; | ||
|
||
// This is pointer to arry of CERT_CONTEXT* | ||
// We do not use it directly in .NET. Instead, we wrap returned OS pointer in safe handle. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment needed? I'm not even sure what it means; we do use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the meaning was that we do not dereference or use CERT_CONTEXT in .NET. So it is pointer to a structure but that is hidden to PAL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added that comment after your questions about IntPtr vs something strongly typed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the "it" in we dot not use it" is referring to CERT_CONTEXT rather than to paCred? That was my confusion.
But, even so, we are kind of using it, aren't we? X509Certificate.Handle must be a CERT_CONTEXT*; we're storing that into paCred, effectively storing a pointer to an array of one CERT_CONTEXT. So while we're not naming it as such, we are using it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. I assumed the "directly" would be a hint but obviously it is not clear. I was also thinking about also adding CERT_CONTEXT so we can see details in debugger but that is somewhat complicated with more pointers inside.
Maybe Windbg could do cast to native but I failed so far with VS.
src/libraries/Common/src/Interop/Windows/SspiCli/SSPIWrapper.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Windows/SspiCli/SSPIWrapper.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Windows.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Windows.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Windows.cs
Outdated
Show resolved
Hide resolved
credential.pTlsParameters = &tlsParameters; | ||
} | ||
|
||
return AcquireCredentialsHandle(direction, &credential); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This credential
is storing a pointer to something on the stack. I assume that whatever AcquireCredentialsHandle returns doesn't expect that to still be alive?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not as far as I know. I can verify that as well. I expect tile time to be same as the structure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, thanks.
src/libraries/System.Net.Security/src/System/Net/Security/SslStreamPal.Windows.cs
Outdated
Show resolved
Hide resolved
src/libraries/Common/src/Interop/Windows/SspiCli/SecuritySafeHandles.cs
Outdated
Show resolved
Hide resolved
/azp run runtime-libraries |
No pipelines are associated with this pull request. |
/azp help |
Supported commands
See additional documentation. |
/azp list |
@wfurt I know CI is acting weird. However this was merged without CI run. There was only the cla that was triggered. |
oops. I let it sit and did something else and then I saw it green. |
Update SslStream to use SCH_CREDENTIALS on new Windows builds. It does not allow to enforce EncryptionPolicy.NoEncryption so when requested, we will fall-back to legacy API and protocols.
It will negotiate TLS 1.3 on Windows insider build and it will pass all tests (but the one bellow)
fixes #1720
SslStream_StreamToStream_ClientInitiatedCloseNotify_Ok test was failing. After some experiments, it can pass if server passes some data before shutdown. This is probably OS bug and ticket was opened to track it. Completion of TLS 1.3 piggy backs on application frames but this should work IMHO. I updated the test to run with and without extra data to make it more visible. We can decided what to do when we get new windows build to CI.