mirror of
https://github.com/apple/swift-nio-ssl
synced 2026-11-27 05:04:24 +00:00
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.
39 lines
1.2 KiB
Swift
39 lines
1.2 KiB
Swift
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the SwiftNIO open source project
|
|
//
|
|
// Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
|
|
// Licensed under Apache License v2.0
|
|
//
|
|
// See LICENSE.txt for license information
|
|
// See CONTRIBUTORS.txt for the list of SwiftNIO project authors
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// LinuxMain.swift
|
|
//
|
|
import XCTest
|
|
|
|
///
|
|
/// NOTE: This file was generated by generate_linux_tests.rb
|
|
///
|
|
/// Do NOT edit this file directly as it will be regenerated automatically when needed.
|
|
///
|
|
|
|
#if os(Linux) || os(FreeBSD)
|
|
@testable import NIOOpenSSLTests
|
|
|
|
XCTMain([
|
|
testCase(ByteBufferBIOTest.allTests),
|
|
testCase(ClientSNITests.allTests),
|
|
testCase(IdentityVerificationTest.allTests),
|
|
testCase(OpenSSLALPNTest.allTests),
|
|
testCase(OpenSSLIntegrationTest.allTests),
|
|
testCase(SSLCertificateTest.allTests),
|
|
testCase(SSLPKCS12BundleTest.allTests),
|
|
testCase(SSLPrivateKeyTest.allTests),
|
|
testCase(TLSConfigurationTest.allTests),
|
|
])
|
|
#endif |