From 42c29720e8f0d895e452498046f5a9542572b08c Mon Sep 17 00:00:00 2001 From: Franz Busch Date: Fri, 3 Nov 2023 11:00:17 +0000 Subject: [PATCH 1/4] Revert "Ship with BoringSSL (#135)" This reverts commit 5dbf2fadd2ae30d4a90a1df0b8a02083727ba36a. --- Package.swift | 15 ++++++++++----- Sources/COpenSSL/module.modulemap | 0 Sources/Crdkafka/custom/include/openssl/err.h | 15 --------------- Sources/Crdkafka/custom/include/openssl/evp.h | 15 --------------- Sources/Crdkafka/custom/include/openssl/hmac.h | 15 --------------- Sources/Crdkafka/custom/include/openssl/pkcs12.h | 15 --------------- Sources/Crdkafka/custom/include/openssl/sha.h | 15 --------------- Sources/Crdkafka/custom/include/openssl/ssl.h | 15 --------------- Sources/Crdkafka/custom/include/openssl/x509.h | 15 --------------- .../Crdkafka/custom/include/openssl/x509_vfy.h | 15 --------------- docker/Dockerfile | 1 + 11 files changed, 11 insertions(+), 125 deletions(-) create mode 100644 Sources/COpenSSL/module.modulemap delete mode 100644 Sources/Crdkafka/custom/include/openssl/err.h delete mode 100644 Sources/Crdkafka/custom/include/openssl/evp.h delete mode 100644 Sources/Crdkafka/custom/include/openssl/hmac.h delete mode 100644 Sources/Crdkafka/custom/include/openssl/pkcs12.h delete mode 100644 Sources/Crdkafka/custom/include/openssl/sha.h delete mode 100644 Sources/Crdkafka/custom/include/openssl/ssl.h delete mode 100644 Sources/Crdkafka/custom/include/openssl/x509.h delete mode 100644 Sources/Crdkafka/custom/include/openssl/x509_vfy.h diff --git a/Package.swift b/Package.swift index 8d463327..2a1d99e8 100644 --- a/Package.swift +++ b/Package.swift @@ -46,8 +46,7 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/apple/swift-nio.git", from: "2.55.0"), - .package(url: "https://github.com/apple/swift-nio-ssl", from: "2.25.0"), - .package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.1.0"), + .package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.0.0-beta.1"), .package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"), // The zstd Swift package produces warnings that we cannot resolve: // https://github.com/facebook/zstd/issues/3328 @@ -57,7 +56,7 @@ let package = Package( .target( name: "Crdkafka", dependencies: [ - .product(name: "NIOSSL", package: "swift-nio-ssl"), + "COpenSSL", .product(name: "libzstd", package: "zstd"), ], exclude: rdkafkaExclude, @@ -66,9 +65,7 @@ let package = Package( cSettings: [ // dummy folder, because config.h is included as "../config.h" in librdkafka .headerSearchPath("./custom/config/dummy"), - .headerSearchPath("./custom/include"), .headerSearchPath("./librdkafka/src"), - .define("_GNU_SOURCE", to: "1"), // Fix build error for Swift 5.9 onwards ], linkerSettings: [ .linkedLibrary("curl"), @@ -91,6 +88,14 @@ let package = Package( "Kafka", ] ), + .systemLibrary( + name: "COpenSSL", + pkgConfig: "openssl", + providers: [ + .brew(["libressl"]), + .apt(["libssl-dev"]), + ] + ), .testTarget( name: "KafkaTests", dependencies: ["Kafka"] diff --git a/Sources/COpenSSL/module.modulemap b/Sources/COpenSSL/module.modulemap new file mode 100644 index 00000000..e69de29b diff --git a/Sources/Crdkafka/custom/include/openssl/err.h b/Sources/Crdkafka/custom/include/openssl/err.h deleted file mode 100644 index 61a232a5..00000000 --- a/Sources/Crdkafka/custom/include/openssl/err.h +++ /dev/null @@ -1,15 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the swift-kafka-client open source project -// -// Copyright (c) 2023 Apple Inc. and the swift-kafka-client project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-kafka-client project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -#include "CNIOBoringSSL_err.h" diff --git a/Sources/Crdkafka/custom/include/openssl/evp.h b/Sources/Crdkafka/custom/include/openssl/evp.h deleted file mode 100644 index 54218188..00000000 --- a/Sources/Crdkafka/custom/include/openssl/evp.h +++ /dev/null @@ -1,15 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the swift-kafka-client open source project -// -// Copyright (c) 2023 Apple Inc. and the swift-kafka-client project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-kafka-client project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -#include "CNIOBoringSSL_evp.h" diff --git a/Sources/Crdkafka/custom/include/openssl/hmac.h b/Sources/Crdkafka/custom/include/openssl/hmac.h deleted file mode 100644 index 60a44389..00000000 --- a/Sources/Crdkafka/custom/include/openssl/hmac.h +++ /dev/null @@ -1,15 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the swift-kafka-client open source project -// -// Copyright (c) 2023 Apple Inc. and the swift-kafka-client project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-kafka-client project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -#include "CNIOBoringSSL_hmac.h" diff --git a/Sources/Crdkafka/custom/include/openssl/pkcs12.h b/Sources/Crdkafka/custom/include/openssl/pkcs12.h deleted file mode 100644 index 5d13efe2..00000000 --- a/Sources/Crdkafka/custom/include/openssl/pkcs12.h +++ /dev/null @@ -1,15 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the swift-kafka-client open source project -// -// Copyright (c) 2023 Apple Inc. and the swift-kafka-client project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-kafka-client project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -#include "CNIOBoringSSL_pkcs12.h" diff --git a/Sources/Crdkafka/custom/include/openssl/sha.h b/Sources/Crdkafka/custom/include/openssl/sha.h deleted file mode 100644 index e58bcc98..00000000 --- a/Sources/Crdkafka/custom/include/openssl/sha.h +++ /dev/null @@ -1,15 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the swift-kafka-client open source project -// -// Copyright (c) 2023 Apple Inc. and the swift-kafka-client project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-kafka-client project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -#include "CNIOBoringSSL_sha.h" diff --git a/Sources/Crdkafka/custom/include/openssl/ssl.h b/Sources/Crdkafka/custom/include/openssl/ssl.h deleted file mode 100644 index 634d88d4..00000000 --- a/Sources/Crdkafka/custom/include/openssl/ssl.h +++ /dev/null @@ -1,15 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the swift-kafka-client open source project -// -// Copyright (c) 2023 Apple Inc. and the swift-kafka-client project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-kafka-client project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -#include "CNIOBoringSSL_ssl.h" diff --git a/Sources/Crdkafka/custom/include/openssl/x509.h b/Sources/Crdkafka/custom/include/openssl/x509.h deleted file mode 100644 index 3db443e9..00000000 --- a/Sources/Crdkafka/custom/include/openssl/x509.h +++ /dev/null @@ -1,15 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the swift-kafka-client open source project -// -// Copyright (c) 2023 Apple Inc. and the swift-kafka-client project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-kafka-client project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -#include "CNIOBoringSSL_x509.h" diff --git a/Sources/Crdkafka/custom/include/openssl/x509_vfy.h b/Sources/Crdkafka/custom/include/openssl/x509_vfy.h deleted file mode 100644 index aba8dcb1..00000000 --- a/Sources/Crdkafka/custom/include/openssl/x509_vfy.h +++ /dev/null @@ -1,15 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// This source file is part of the swift-kafka-client open source project -// -// Copyright (c) 2023 Apple Inc. and the swift-kafka-client project authors -// Licensed under Apache License v2.0 -// -// See LICENSE.txt for license information -// See CONTRIBUTORS.txt for the list of swift-kafka-client project authors -// -// SPDX-License-Identifier: Apache-2.0 -// -//===----------------------------------------------------------------------===// - -#include "CNIOBoringSSL_x509_vfy.h" diff --git a/docker/Dockerfile b/docker/Dockerfile index 31ae9a21..f1d19afd 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -15,6 +15,7 @@ ENV LANGUAGE en_US.UTF-8 # Dependencies RUN apt-get update RUN apt-get install libsasl2-dev -y +RUN apt-get install libssl-dev -y # tools RUN mkdir -p $HOME/.tools From c0301ed0974aae78ffe35177bba6ecca4af142db Mon Sep 17 00:00:00 2001 From: Franz Busch Date: Fri, 3 Nov 2023 11:13:20 +0000 Subject: [PATCH 2/4] Use correct service lifecycle --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index 2a1d99e8..aa93da09 100644 --- a/Package.swift +++ b/Package.swift @@ -46,7 +46,7 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/apple/swift-nio.git", from: "2.55.0"), - .package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.0.0-beta.1"), + .package(url: "https://github.com/swift-server/swift-service-lifecycle.git", from: "2.0.0"), .package(url: "https://github.com/apple/swift-log.git", from: "1.0.0"), // The zstd Swift package produces warnings that we cannot resolve: // https://github.com/facebook/zstd/issues/3328 From 4125cec45bc46ae9e96149223faf7dd68724f92b Mon Sep 17 00:00:00 2001 From: Franz Busch Date: Fri, 3 Nov 2023 11:15:04 +0000 Subject: [PATCH 3/4] Switch to OpenSSL --- docker/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index f1d19afd..0b7a72a4 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -15,7 +15,7 @@ ENV LANGUAGE en_US.UTF-8 # Dependencies RUN apt-get update RUN apt-get install libsasl2-dev -y -RUN apt-get install libssl-dev -y +RUN apt-get install openssl -y # tools RUN mkdir -p $HOME/.tools From 5c31a584c96040314875a2a296eecf3687da1739 Mon Sep 17 00:00:00 2001 From: Franz Busch Date: Fri, 3 Nov 2023 11:26:00 +0000 Subject: [PATCH 4/4] Update to rdkafka 2.3.0 --- Sources/Crdkafka/librdkafka | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/Crdkafka/librdkafka b/Sources/Crdkafka/librdkafka index c282ba24..95a542c8 160000 --- a/Sources/Crdkafka/librdkafka +++ b/Sources/Crdkafka/librdkafka @@ -1 +1 @@ -Subproject commit c282ba2423b2694052393c8edb0399a5ef471b3f +Subproject commit 95a542c87c61d2c45b445f91c73dd5442eb04f3c