Commit Graph
7 Commits
Author SHA1 Message Date
Cory Benfield 45b1f82692 Rename everything. (#75)
Motivation:

Unfortunately, it turns out that the word "OpenSSL" just ended up everwhere
in our codebase, including in the names of our types. This was, in hindsight,
a bit of an unfortunate bit of naming.

We should take this breaking opportunity to give these types better names.
In particular, we should stop identifying them as belonging to any library
other than this one, "NIOSSL". That way we become somewhat independent of
the specific way that this library is implemented.

Modifications:

Renamed a bunch of stuff. Internal types mostly got their names changed
from OpenSSL->BoringSSL. External types generally got their names changed
to "NIOSSL", except where those types directly reflected a BoringSSL
implementation detail, specifically in the errors.

The main name changes are:

SSLContext -> NIOSSLContext
OpenSSLError -> BoringSSLError
NIOOpenSSLError -> NIOSSLError
OpenSSLInternalError -> BoringSSLInternalError
OpenSSLPKCS12Bundle -> NIOSSLPKCS12Bundle
OpenSSLPassphraseCallback -> NIOSSLPassphraseCallback
OpenSSLPassphraseSetter -> NIOSSLPassphraseSetter
OpenSSLPrivateKey -> NIOSSLPrivateKey
OpenSSLPublicKey -> NIOSSLPublicKey
OpenSSLCertificate -> NIOSSLCertificate
OpenSSLVerificationResult -> NIOSSLVerificationResult
OpenSSLVerificationCallback -> NIOSSLVerificationCallback
OpenSSLCertificateSource -> NIOSSLCertificateSource
OpenSSLPrivateKeySource -> NIOSSLPrivateKeySource
OpenSSLTrustRoots -> NIOSSLTrustRoots
OpenSSLSerializationFormats -> NIOSSLSerializationFormats
OpenSSLHandler -> NIOSSLHandler
OpenSSLClientHandler -> NIOSSLClientHandler
OpenSSLServerHandler -> NIOSSLServerHandler

Oh, and renamed the module too: it's now NIOSSL, instead of NIOOpenSSL.

Result:

Users have better names for things.
2019-03-01 17:25:33 +00:00
Cory Benfield f63c57657a Locate default ca-certificates on Linux. (#71)
Motivation:

When we moved away from the system copy of OpenSSL, we lost the
compiled-in locations of the default root CAs. We should go looking for
them so that certificate verification still works!

Modifications:

- Added a runtime one-off search to locate the roots.

Result:

Certificate verification works on Linux
2019-02-28 10:48:11 +00:00
Cory Benfield f0e77e00a4 Support removing TLS handlers from live connections. (#54)
Motivation:

In some unusual protocol scenarios it is desirable to remove a TLS
tunnel from an active connection. Currently NIOOpenSSL does not
support doing this: the only way to get it to issue a CLOSE_NOTIFY
is to call close() on the Channel. This is less than ideal.

Modifications:

- Added a OpenSSLHandler.stopTLS method
- Reworked the internal state machine to handle this use-case.

Result:

Users can safely unwrap TLS from a Channel.
2018-12-10 11:39:40 +00:00
Cory Benfield 9e7e47c1ca Add custom ByteBufferBIO object. (#27)
Motivation:

Currently we use OpenSSL with MemoryBIO objects. These objects are an
implementation of OpenSSL's pervasive BIO abstraction that wrap a simple
heap-allocated buffer.

The result of this is that we have the following data pipeline for
reads:

1. Ciphertext read from the socket into ByteBuffer
2. Ciphertext copied from ByteBuffer to memory BIO
3. Ciphertext copied from memory BIO to transient OpenSSL memory
4. Ciphertext decrypted
5. Plaintext copied from transient OpenSSL memory to ByteBuffer.

And for writes:

1. Plaintext copied from ByteBuffer to transient OpenSSL memory.
2. Plaintext encrypted.
3. Ciphertext copied from transient OpenSSL memory to memory BIO.
4. Plaintext copied from memory BIO to ByteBuffer.
5. Plaintext copied from ByteBuffer to kernel.

The thing is, we don't need all of these copies. Specifically, the
interposing of a memory BIO is totally unnnecessary. We can remove
that copy by implementing the BIO abstraction ourself on top of the
ByteBuffer objects we're using.

This patch does just that.

Modifications:

- Implement a new ByteBufferBIO object.
- Rewrite some core code to use ByteBufferBIO.

Result:

Less memory copying, better efficiency.
2018-08-17 11:52:02 +01:00
Cory Benfield c5e345b62e Add support for PKCS#12 bundles. (#23)
Motivation:

As requested in #17, it's not uncommon to want to support PKCS#12 bundles.
This patch adds support for unpacking PKCS#12 bundles into useful data types
for NIOOpenSSL.

Modifications:

Added new OpenSSLPKCS12Bundle type.
Added new fromUnsafePointer(takingOwnership:) static functions to
    OpenSSLCertificate and OpenSSLPrivateKey.
Deprecated fromUnsafePointer(pointer:) on OpenSSLCertificate and
    OpenSSLPrivateKey.

Result:

PKCS#12 bundles can be used to distribute certs/keys for SwiftNIO.
2018-07-12 11:48:28 +01:00
tomer doron c3902674f0 update linux test extensions (#8)
Motivation:

up to date test extentions with appropriate legal header

Modifications:

regenerate linux test extensions with updated generator

Result:

linux test extensions have correct legal header
2018-02-26 18:32:06 -08:00
Johannes Weiß a6936a36f1 move OpenSSL support from NIO main repo 2018-01-25 18:35:14 +00:00