Skip to content
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

Custom tls chain impl to fix callback issue and avoid copying #1246

Merged
merged 5 commits into from
Jan 13, 2020

Conversation

AndreasReich
Copy link

Introduces a custom x509 chain impl. This allows us to preserve the native handle during the validation process which means that we don't need to recreate a native x509 chain during validation.

The original motivation however is quite distinct from that and sparked by https://fogbugz.unity3d.com/f/cases/1191987/ (for which this is a fix):
Depending on the used overload of MobileTlsContext.ValidateCertificate, the user does not receive any certificate in callbacks like ServicePointManager.ServerCertificateValidationCallback. Essentially the implementation fails to pass through the certificate if a X509CertificateCollection is provided, but works fine if a X509Chain is passed in (which is why this PR implements a X509ChainImpl)
The AppleTls implementation (on which the UnityTls backend is based) has the same issue. See here mono#10198

I added a regression test on https://github.cds.internal.unity3d.com/unity/unity/tree/platform/foundation/tls/regression-test-1191987 which passes with Mono built from this branch but not before
(Ideally we merge this alongside the next mono update in trunk cc: @joncham )

less native/managed transitions/copies & verification callback support
WIP: Fails various Unity Playmode TLs tests so far
Introduced by accident in last commit
@unity-cla-assistant
Copy link
Collaborator

unity-cla-assistant commented Jan 3, 2020

CLA assistant check
All committers have signed the CLA.

@AndreasReich AndreasReich merged commit fa291e1 into unity-master Jan 13, 2020
@AndreasReich AndreasReich deleted the unitytls/custom-chain branch January 13, 2020 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants