As a standard pattern, the vendoring script needed some changes, as did
our internal code.
The biggest change here is that BoringSSL has changed its name mangling
scheme. This causes us to no longer need to explicitly write the prefix
out anymore: in fact, doing that causes compiler errors. So this patch
rewrites the code to resolve that issue.
Along the way, I've also added some checks for making sure the name
mangling is correct.
Motivation:
Unfortunately, `internal import` doesn't do implementation-hiding in the
build system. This means that the C header files do become visible to
all dependencies, which can cause problems when the ssl.h headers from
elsewhere are included.
Modifications:
Revert to `@_implementationOnly` imports.
Result:
Better builds, unfortunately more warnings
Currently, the certs returned by the sslContextCallback are added to the
context, rather than replacing the certs already in the context.
This means that, if a callback is used to return a new chain to be used,
the old and new chains are both presented (but only the new leaf). This
should not cause any problem, but it is inefficient
Change: Clear the additional certs before adding the new ones
Motivation:
The sslContextCallback overrides modify the SSL_CTX object itself.
That's not useful: in addition to having a global effect, which is
rarely what we want, certain modifications don't apply that late, and
setting the credentials is one of them. The result is that the callback
didn't actually do anything. Not that useful.
Modifications:
- Extract the cert chain setting functions from NIOSSLContext and move
them to general-purpose functions.
- Add support there for calling them on a SSL * as well as on a SSL_CTX
*
- Call them in an override function on SSLConnection
- Call that!
- Add a bunch of tests.
Result:
The callback actually does what it should.