Only set certificate file credentials when files are provided #250
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
I'm using
quic_load_sdk_config
like so:This fails for me with error -1.
It turns out that the
quic_load_sdk_config()
function in src/supplemental/quic/quic_api.c unconditionally setsQUIC_CREDENTIAL_TYPE_CERTIFICATE_FILE
andQUIC_CREDENTIAL_FLAG_INDICATE_CERTIFICATE_RECEIVED
whenTLS is enabled, even when no client certificate files are provided (empty certfile and keyfile
strings).
This doesn't seem to match the msquic API spec which requires:
QUIC_CREDENTIAL_TYPE_NONE
for client-only scenarios without client certificatesQUIC_CREDENTIAL_TYPE_CERTIFICATE_FILE
only when actual certificate files are providedThe causes MsQuic->ConfigurationLoadCredential() to fail with error (-268435457) for a (presumably?) legitimate client-only TLS configurations where only server certificate verification is needed.
Solution
contain non-empty paths
QUIC_CREDENTIAL_TYPE_NONE
(set at initialization) for client-only scenarios with emptycertificate paths
QUIC_CREDENTIAL_FLAG_INDICATE_CERTIFICATE_RECEIVED
flag inside the certificate fileconditional block
Testing
Fix resolves
ConfigurationLoadCredential
failures for client-only QUIC TLS configuration that I'm trying to use.Question
Is this a valid use case and I hit a bug, or am I doing this all wrong?