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

Pass presented chain to Verifiers #54

Merged
merged 2 commits into from
May 20, 2017

Conversation

dadrian
Copy link
Member

@dadrian dadrian commented May 15, 2017

This approach is thread safe and allows the intermediate set used by a
Verifier to be appended with the chain presented by the host.

This approach is thread safe and allows the intermediate set used by a
Verifier to be appended with the chain presented by the host.
@dadrian dadrian requested a review from zakird May 15, 2017 16:03
@dadrian
Copy link
Member Author

dadrian commented May 15, 2017

This depends on #53.

@@ -127,7 +128,11 @@ type Verifier struct {
func (v *Verifier) convertOptions(opt *VerificationOptions) (out x509.VerifyOptions) {
out.CurrentTime = opt.VerifyTime
out.Roots = v.Roots
out.Intermediates = v.Intermediates
if opt.PresentedChain != nil && opt.PresentedChain.Size() > 0 {
out.Intermediates = v.Intermediates.Sum(opt.PresentedChain)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear to me that this is the correct approach. What performance impact does this have? Is this better or worse than adding and removing the chain from the cert pool?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't add and remove the chain from the cert pool while being thread safe in the current setup.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright. What's the performance impact?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove logic would have to reindex everything "after" the certificate being removed in two maps. In the common case this would be quick (remove the last certificate), but it's still pretty gnarly. There's a bunch of edge cases in the removal code (what if multiple certs have the same subject and you're removing only one of them) and in it's usage (what if the presented chain certificate was already in the pool and we remove it?)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have no idea what the performance impact of this change is, in the same way we have no idea what the performance of this code before the change is. If we're too slow, we can profile. This feels like optimizing too early.

@dadrian dadrian merged commit d0f457a into master May 20, 2017
@dadrian dadrian deleted the dadrian/verifier-with-presented-chain branch May 20, 2017 23:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants