diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 6ae77021..e511476d 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -10,7 +10,7 @@ on: jobs: soundness: name: Soundness - uses: swiftlang/github-workflows/.github/workflows/soundness.yml@0.0.7 + uses: swiftlang/github-workflows/.github/workflows/soundness.yml@0.0.13 with: license_header_check_project_name: "SwiftCrypto" docs_check_enabled: false @@ -19,28 +19,23 @@ jobs: name: Unit tests uses: apple/swift-nio/.github/workflows/unit_tests.yml@main with: - linux_5_10_arguments_override: "--explicit-target-dependency-import-check error" - linux_6_1_arguments_override: "--explicit-target-dependency-import-check error" - linux_6_2_arguments_override: "--explicit-target-dependency-import-check error" - linux_6_3_arguments_override: "--explicit-target-dependency-import-check error" - linux_nightly_next_arguments_override: "--explicit-target-dependency-import-check error" - linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error" - windows_6_1_enabled: true + linux_6_2_arguments_override: "-Xswiftc -warnings-as-errors -Xswiftc -Wwarning -Xswiftc ImplementationOnlyDeprecated --explicit-target-dependency-import-check error" + linux_6_3_arguments_override: "-Xswiftc -warnings-as-errors -Xswiftc -Wwarning -Xswiftc ImplementationOnlyDeprecated --explicit-target-dependency-import-check error" + linux_nightly_next_arguments_override: "--build-system native -Xswiftc -warnings-as-errors -Xswiftc -Wwarning -Xswiftc ImplementationOnlyDeprecated --explicit-target-dependency-import-check error" + linux_nightly_main_arguments_override: "--build-system native --explicit-target-dependency-import-check error" windows_6_2_enabled: true windows_6_3_enabled: true windows_nightly_next_enabled: true windows_nightly_main_enabled: true - windows_6_1_arguments_override: "--explicit-target-dependency-import-check error" - windows_6_2_arguments_override: "--explicit-target-dependency-import-check error" - windows_6_3_arguments_override: "--explicit-target-dependency-import-check error" - windows_nightly_next_arguments_override: "--explicit-target-dependency-import-check error" - windows_nightly_main_arguments_override: "--explicit-target-dependency-import-check error" + windows_6_2_arguments_override: "-Xswiftc -warnings-as-errors -Xswiftc -Wwarning -Xswiftc ImplementationOnlyDeprecated --explicit-target-dependency-import-check error" + windows_6_3_arguments_override: "-Xswiftc -warnings-as-errors -Xswiftc -Wwarning -Xswiftc ImplementationOnlyDeprecated --explicit-target-dependency-import-check error" + windows_nightly_next_arguments_override: "--build-system native -Xswiftc -warnings-as-errors -Xswiftc -Wwarning -Xswiftc ImplementationOnlyDeprecated --explicit-target-dependency-import-check error" + windows_nightly_main_arguments_override: "--build-system native --explicit-target-dependency-import-check error" release-builds: name: Release builds uses: apple/swift-nio/.github/workflows/release_builds.yml@main with: - windows_6_1_enabled: true windows_6_2_enabled: true windows_6_3_enabled: true windows_nightly_next_enabled: true diff --git a/Package.swift b/Package.swift index 5eae0628..5dedf462 100644 --- a/Package.swift +++ b/Package.swift @@ -38,11 +38,17 @@ let nonDarwinPlatforms: [Platform] = [ .custom("freebsd"), ] -let swiftSettings: [SwiftSetting] = [ +var swiftSettings: [SwiftSetting] = [ .define("CRYPTO_IN_SWIFTPM"), .enableExperimentalFeature("Lifetimes"), + .enableExperimentalFeature("SourceWarningControl"), ] +// Only enable CheckImplementationOnly on 6.4 -- 6.3 has the feature, but produces many false positives. +#if compiler(>=6.4) +swiftSettings.append(.enableExperimentalFeature("CheckImplementationOnly")) +#endif + // This doesn't work when cross-compiling: the privacy manifest will be included in the Bundle and // Foundation will be linked. This is, however, strictly better than unconditionally adding the // resource. @@ -98,6 +104,10 @@ let package = Package( .when(platforms: [Platform.wasi]) ), .define("OPENSSL_NO_ASM", .when(platforms: [Platform.wasi])), + // BoringSSL is vendored verbatim; we don't fix its warnings. Xcode enables + // -Wshorten-64-to-32 by default (SwiftPM does not), which produces dozens + // of warnings. Silence that group here. + .disableWarning("shorten-64-to-32"), ] ), .target( @@ -113,6 +123,7 @@ let package = Package( .headerSearchPath("low/KeccakP-1600"), .headerSearchPath("low/common"), .headerSearchPath("common"), + .disableWarning("macro-redefined"), ] ), .target( @@ -141,6 +152,7 @@ let package = Package( .target(name: "CXKCPShims", condition: .when(platforms: nonDarwinPlatforms)), ], exclude: privacyManifestExclude + [ + "vendored-sources.txt", "CMakeLists.txt", "Signatures/BoringSSL/MLDSA_boring.swift.gyb", "KEM/BoringSSL/MLKEM_boring.swift.gyb", diff --git a/Sources/Crypto/AEADs/AES/GCM/BoringSSL/AES-GCM_boring.swift b/Sources/Crypto/AEADs/AES/GCM/BoringSSL/AES-GCM_boring.swift index 7e18dd30..b697571e 100644 --- a/Sources/Crypto/AEADs/AES/GCM/BoringSSL/AES-GCM_boring.swift +++ b/Sources/Crypto/AEADs/AES/GCM/BoringSSL/AES-GCM_boring.swift @@ -14,7 +14,11 @@ #if canImport(CryptoKit) @_exported import CryptoKit #else +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +#else @_implementationOnly import CCryptoBoringSSL +#endif import CryptoBoringWrapper #if canImport(FoundationEssentials) import FoundationEssentials diff --git a/Sources/Crypto/AEADs/ChachaPoly/BoringSSL/ChaChaPoly_boring.swift b/Sources/Crypto/AEADs/ChachaPoly/BoringSSL/ChaChaPoly_boring.swift index ebc111a2..215fb6bd 100644 --- a/Sources/Crypto/AEADs/ChachaPoly/BoringSSL/ChaChaPoly_boring.swift +++ b/Sources/Crypto/AEADs/ChachaPoly/BoringSSL/ChaChaPoly_boring.swift @@ -14,8 +14,13 @@ #if canImport(CryptoKit) @_exported import CryptoKit #else +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSLShims +#else @_implementationOnly import CCryptoBoringSSL @_implementationOnly import CCryptoBoringSSLShims +#endif import CryptoBoringWrapper #if canImport(FoundationEssentials) import FoundationEssentials diff --git a/Sources/Crypto/Digests/BoringSSL/Digest_boring.swift b/Sources/Crypto/Digests/BoringSSL/Digest_boring.swift index 724033e4..1d134f99 100644 --- a/Sources/Crypto/Digests/BoringSSL/Digest_boring.swift +++ b/Sources/Crypto/Digests/BoringSSL/Digest_boring.swift @@ -14,7 +14,11 @@ #if canImport(CryptoKit) @_exported import CryptoKit #else +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +#else @_implementationOnly import CCryptoBoringSSL +#endif @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol HashFunctionImplementationDetails: HashFunction where Digest: DigestPrivate {} diff --git a/Sources/Crypto/Digests/XKCP/Digest_xkcp.swift b/Sources/Crypto/Digests/XKCP/Digest_xkcp.swift index 7c927594..4cb54a8c 100644 --- a/Sources/Crypto/Digests/XKCP/Digest_xkcp.swift +++ b/Sources/Crypto/Digests/XKCP/Digest_xkcp.swift @@ -14,8 +14,13 @@ #if canImport(CryptoKit) @_exported import CryptoKit #else +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CXKCP +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CXKCPShims +#else @_implementationOnly import CXKCP @_implementationOnly import CXKCPShims +#endif @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) protocol XKCPBackedHashFunction: HashFunctionImplementationDetails { diff --git a/Sources/Crypto/KEM/BoringSSL/MLKEM_boring.swift b/Sources/Crypto/KEM/BoringSSL/MLKEM_boring.swift index efb8b7e7..c51c616c 100644 --- a/Sources/Crypto/KEM/BoringSSL/MLKEM_boring.swift +++ b/Sources/Crypto/KEM/BoringSSL/MLKEM_boring.swift @@ -19,7 +19,11 @@ #if canImport(CryptoKit) @_exported import CryptoKit #else +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +#else @_implementationOnly import CCryptoBoringSSL +#endif #if canImport(FoundationEssentials) import FoundationEssentials #else diff --git a/Sources/Crypto/KEM/BoringSSL/MLKEM_boring.swift.gyb b/Sources/Crypto/KEM/BoringSSL/MLKEM_boring.swift.gyb index 3cf87085..825fe21b 100644 --- a/Sources/Crypto/KEM/BoringSSL/MLKEM_boring.swift.gyb +++ b/Sources/Crypto/KEM/BoringSSL/MLKEM_boring.swift.gyb @@ -19,7 +19,11 @@ #if canImport(CryptoKit) @_exported import CryptoKit #else +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +#else @_implementationOnly import CCryptoBoringSSL +#endif #if canImport(FoundationEssentials) import FoundationEssentials #else diff --git a/Sources/Crypto/KEM/BoringSSL/MLKEM_wrapper.swift b/Sources/Crypto/KEM/BoringSSL/MLKEM_wrapper.swift index 61c11132..743379db 100644 --- a/Sources/Crypto/KEM/BoringSSL/MLKEM_wrapper.swift +++ b/Sources/Crypto/KEM/BoringSSL/MLKEM_wrapper.swift @@ -15,7 +15,11 @@ #if canImport(CryptoKit) @_exported import CryptoKit #else +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +#else @_implementationOnly import CCryptoBoringSSL +#endif #if canImport(FoundationEssentials) import FoundationEssentials #else diff --git a/Sources/Crypto/KEM/BoringSSL/XWing_boring.swift b/Sources/Crypto/KEM/BoringSSL/XWing_boring.swift index 4260631f..332e58cf 100644 --- a/Sources/Crypto/KEM/BoringSSL/XWing_boring.swift +++ b/Sources/Crypto/KEM/BoringSSL/XWing_boring.swift @@ -15,7 +15,11 @@ #if canImport(CryptoKit) @_exported import CryptoKit #else +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +#else @_implementationOnly import CCryptoBoringSSL +#endif #if canImport(FoundationEssentials) import FoundationEssentials #else diff --git a/Sources/Crypto/Key Agreement/BoringSSL/ECDH_boring.swift b/Sources/Crypto/Key Agreement/BoringSSL/ECDH_boring.swift index 19c9e983..9910016b 100644 --- a/Sources/Crypto/Key Agreement/BoringSSL/ECDH_boring.swift +++ b/Sources/Crypto/Key Agreement/BoringSSL/ECDH_boring.swift @@ -14,7 +14,11 @@ #if canImport(CryptoKit) @_exported import CryptoKit #else +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +#else @_implementationOnly import CCryptoBoringSSL +#endif @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension P256.KeyAgreement.PrivateKey { diff --git a/Sources/Crypto/Key Derivation/ANSIx963.swift b/Sources/Crypto/Key Derivation/ANSIx963.swift index 84f2e68b..081069d7 100644 --- a/Sources/Crypto/Key Derivation/ANSIx963.swift +++ b/Sources/Crypto/Key Derivation/ANSIx963.swift @@ -17,9 +17,9 @@ #else #if canImport(FoundationEssentials) -public import FoundationEssentials +import FoundationEssentials #else -public import Foundation +import Foundation #endif internal struct ANSIKDFx963: Sendable { diff --git a/Sources/Crypto/Key Wrapping/BoringSSL/AESWrap_boring.swift b/Sources/Crypto/Key Wrapping/BoringSSL/AESWrap_boring.swift index 5f41c5c0..52ff9fbd 100644 --- a/Sources/Crypto/Key Wrapping/BoringSSL/AESWrap_boring.swift +++ b/Sources/Crypto/Key Wrapping/BoringSSL/AESWrap_boring.swift @@ -14,7 +14,11 @@ #if canImport(CryptoKit) @_exported import CryptoKit #else +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +#else @_implementationOnly import CCryptoBoringSSL +#endif #if canImport(FoundationEssentials) import FoundationEssentials #else diff --git a/Sources/Crypto/Keys/EC/BoringSSL/Ed25519_boring.swift b/Sources/Crypto/Keys/EC/BoringSSL/Ed25519_boring.swift index c7d0b19a..466e8d68 100644 --- a/Sources/Crypto/Keys/EC/BoringSSL/Ed25519_boring.swift +++ b/Sources/Crypto/Keys/EC/BoringSSL/Ed25519_boring.swift @@ -14,8 +14,13 @@ #if canImport(CryptoKit) @_exported import CryptoKit #else +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSLShims +#else @_implementationOnly import CCryptoBoringSSL @_implementationOnly import CCryptoBoringSSLShims +#endif #if canImport(FoundationEssentials) import FoundationEssentials #else diff --git a/Sources/Crypto/Keys/EC/BoringSSL/NISTCurvesKeys_boring.swift b/Sources/Crypto/Keys/EC/BoringSSL/NISTCurvesKeys_boring.swift index ff7d2e41..1443e4d0 100644 --- a/Sources/Crypto/Keys/EC/BoringSSL/NISTCurvesKeys_boring.swift +++ b/Sources/Crypto/Keys/EC/BoringSSL/NISTCurvesKeys_boring.swift @@ -14,8 +14,13 @@ #if canImport(CryptoKit) @_exported import CryptoKit #else +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSLShims +#else @_implementationOnly import CCryptoBoringSSL @_implementationOnly import CCryptoBoringSSLShims +#endif import CryptoBoringWrapper #if canImport(FoundationEssentials) import FoundationEssentials diff --git a/Sources/Crypto/Keys/EC/BoringSSL/X25519Keys_boring.swift b/Sources/Crypto/Keys/EC/BoringSSL/X25519Keys_boring.swift index 1c0c4b55..981c5de8 100644 --- a/Sources/Crypto/Keys/EC/BoringSSL/X25519Keys_boring.swift +++ b/Sources/Crypto/Keys/EC/BoringSSL/X25519Keys_boring.swift @@ -14,8 +14,13 @@ #if canImport(CryptoKit) @_exported import CryptoKit #else +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSLShims +#else @_implementationOnly import CCryptoBoringSSL @_implementationOnly import CCryptoBoringSSLShims +#endif #if canImport(FoundationEssentials) import FoundationEssentials #else diff --git a/Sources/Crypto/Signatures/BoringSSL/ECDSASignature_boring.swift b/Sources/Crypto/Signatures/BoringSSL/ECDSASignature_boring.swift index d5e0ebdc..a6b88eb8 100644 --- a/Sources/Crypto/Signatures/BoringSSL/ECDSASignature_boring.swift +++ b/Sources/Crypto/Signatures/BoringSSL/ECDSASignature_boring.swift @@ -14,8 +14,13 @@ #if canImport(CryptoKit) @_exported import CryptoKit #else +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSLShims +#else @_implementationOnly import CCryptoBoringSSL @_implementationOnly import CCryptoBoringSSLShims +#endif import CryptoBoringWrapper #if canImport(FoundationEssentials) import FoundationEssentials diff --git a/Sources/Crypto/Signatures/BoringSSL/ECDSA_boring.swift b/Sources/Crypto/Signatures/BoringSSL/ECDSA_boring.swift index 7a3c2731..5e38386f 100644 --- a/Sources/Crypto/Signatures/BoringSSL/ECDSA_boring.swift +++ b/Sources/Crypto/Signatures/BoringSSL/ECDSA_boring.swift @@ -14,7 +14,11 @@ #if canImport(CryptoKit) @_exported import CryptoKit #else +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +#else @_implementationOnly import CCryptoBoringSSL +#endif import CryptoBoringWrapper #if canImport(FoundationEssentials) import FoundationEssentials diff --git a/Sources/Crypto/Signatures/BoringSSL/EdDSA_boring.swift b/Sources/Crypto/Signatures/BoringSSL/EdDSA_boring.swift index 7ae85eee..89d2e5be 100644 --- a/Sources/Crypto/Signatures/BoringSSL/EdDSA_boring.swift +++ b/Sources/Crypto/Signatures/BoringSSL/EdDSA_boring.swift @@ -14,8 +14,13 @@ #if canImport(CryptoKit) @_exported import CryptoKit #else +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSLShims +#else @_implementationOnly import CCryptoBoringSSL @_implementationOnly import CCryptoBoringSSLShims +#endif #if canImport(FoundationEssentials) import FoundationEssentials #else diff --git a/Sources/Crypto/Signatures/BoringSSL/MLDSA_boring.swift b/Sources/Crypto/Signatures/BoringSSL/MLDSA_boring.swift index c4da5198..7429d72a 100644 --- a/Sources/Crypto/Signatures/BoringSSL/MLDSA_boring.swift +++ b/Sources/Crypto/Signatures/BoringSSL/MLDSA_boring.swift @@ -15,7 +15,11 @@ #if canImport(CryptoKit) @_exported import CryptoKit #else +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +#else @_implementationOnly import CCryptoBoringSSL +#endif #if canImport(FoundationEssentials) import FoundationEssentials #else @@ -26,7 +30,11 @@ import Foundation // any edits of this file WILL be overwritten and thus discarded // see section `gyb` in `README` for details. +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +#else @_implementationOnly import CCryptoBoringSSL +#endif #if canImport(FoundationEssentials) import FoundationEssentials #else diff --git a/Sources/Crypto/Signatures/BoringSSL/MLDSA_boring.swift.gyb b/Sources/Crypto/Signatures/BoringSSL/MLDSA_boring.swift.gyb index f8292c3e..6b73db93 100644 --- a/Sources/Crypto/Signatures/BoringSSL/MLDSA_boring.swift.gyb +++ b/Sources/Crypto/Signatures/BoringSSL/MLDSA_boring.swift.gyb @@ -15,7 +15,11 @@ #if canImport(CryptoKit) @_exported import CryptoKit #else +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +#else @_implementationOnly import CCryptoBoringSSL +#endif #if canImport(FoundationEssentials) import FoundationEssentials #else @@ -26,7 +30,11 @@ import Foundation // any edits of this file WILL be overwritten and thus discarded // see section `gyb` in `README` for details. +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +#else @_implementationOnly import CCryptoBoringSSL +#endif #if canImport(FoundationEssentials) import FoundationEssentials #else diff --git a/Sources/Crypto/Signatures/BoringSSL/MLDSA_wrapper.swift b/Sources/Crypto/Signatures/BoringSSL/MLDSA_wrapper.swift index de29a6cc..24a6f9d2 100644 --- a/Sources/Crypto/Signatures/BoringSSL/MLDSA_wrapper.swift +++ b/Sources/Crypto/Signatures/BoringSSL/MLDSA_wrapper.swift @@ -15,7 +15,11 @@ #if canImport(CryptoKit) @_exported import CryptoKit #else +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +#else @_implementationOnly import CCryptoBoringSSL +#endif #if canImport(FoundationEssentials) import FoundationEssentials #else diff --git a/Sources/Crypto/Util/BoringSSL/CryptoKitErrors_boring.swift b/Sources/Crypto/Util/BoringSSL/CryptoKitErrors_boring.swift index b19b346f..0a04ae8f 100644 --- a/Sources/Crypto/Util/BoringSSL/CryptoKitErrors_boring.swift +++ b/Sources/Crypto/Util/BoringSSL/CryptoKitErrors_boring.swift @@ -14,7 +14,11 @@ #if canImport(CryptoKit) @_exported import CryptoKit #else +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +#else @_implementationOnly import CCryptoBoringSSL +#endif @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension CryptoKitError { diff --git a/Sources/Crypto/Util/BoringSSL/Zeroization_boring.swift b/Sources/Crypto/Util/BoringSSL/Zeroization_boring.swift index 1991f2f6..3a268aa2 100644 --- a/Sources/Crypto/Util/BoringSSL/Zeroization_boring.swift +++ b/Sources/Crypto/Util/BoringSSL/Zeroization_boring.swift @@ -12,7 +12,11 @@ // //===----------------------------------------------------------------------===// #if !canImport(Darwin) +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +#else @_implementationOnly import CCryptoBoringSSL +#endif @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) typealias errno_t = CInt diff --git a/Sources/CryptoBoringWrapper/AEAD/BoringSSLAEAD.swift b/Sources/CryptoBoringWrapper/AEAD/BoringSSLAEAD.swift index 61d417e6..fa716701 100644 --- a/Sources/CryptoBoringWrapper/AEAD/BoringSSLAEAD.swift +++ b/Sources/CryptoBoringWrapper/AEAD/BoringSSLAEAD.swift @@ -12,8 +12,13 @@ // //===----------------------------------------------------------------------===// +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSLShims +#else @_implementationOnly import CCryptoBoringSSL @_implementationOnly import CCryptoBoringSSLShims +#endif #if canImport(FoundationEssentials) import FoundationEssentials diff --git a/Sources/CryptoBoringWrapper/CryptoKitErrors_boring.swift b/Sources/CryptoBoringWrapper/CryptoKitErrors_boring.swift index bc3a5c25..7de92e25 100644 --- a/Sources/CryptoBoringWrapper/CryptoKitErrors_boring.swift +++ b/Sources/CryptoBoringWrapper/CryptoKitErrors_boring.swift @@ -12,7 +12,11 @@ // //===----------------------------------------------------------------------===// +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +#else @_implementationOnly import CCryptoBoringSSL +#endif @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) public enum CryptoBoringWrapperError: Error { diff --git a/Sources/CryptoBoringWrapper/EC/EllipticCurve.swift b/Sources/CryptoBoringWrapper/EC/EllipticCurve.swift index c333ecbd..01614506 100644 --- a/Sources/CryptoBoringWrapper/EC/EllipticCurve.swift +++ b/Sources/CryptoBoringWrapper/EC/EllipticCurve.swift @@ -11,7 +11,11 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +#else @_implementationOnly import CCryptoBoringSSL +#endif /// A wrapper around BoringSSL's EC_GROUP object that handles reference counting and /// liveness. diff --git a/Sources/CryptoBoringWrapper/EC/EllipticCurvePoint.swift b/Sources/CryptoBoringWrapper/EC/EllipticCurvePoint.swift index dc593879..1ed46bb4 100644 --- a/Sources/CryptoBoringWrapper/EC/EllipticCurvePoint.swift +++ b/Sources/CryptoBoringWrapper/EC/EllipticCurvePoint.swift @@ -11,8 +11,13 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSLShims +#else @_implementationOnly import CCryptoBoringSSL @_implementationOnly import CCryptoBoringSSLShims +#endif #if canImport(FoundationEssentials) import protocol FoundationEssentials.ContiguousBytes diff --git a/Sources/CryptoBoringWrapper/Util/ArbitraryPrecisionInteger.swift b/Sources/CryptoBoringWrapper/Util/ArbitraryPrecisionInteger.swift index db851f35..4e817f42 100644 --- a/Sources/CryptoBoringWrapper/Util/ArbitraryPrecisionInteger.swift +++ b/Sources/CryptoBoringWrapper/Util/ArbitraryPrecisionInteger.swift @@ -12,8 +12,13 @@ // //===----------------------------------------------------------------------===// +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSLShims +#else @_implementationOnly import CCryptoBoringSSL @_implementationOnly import CCryptoBoringSSLShims +#endif #if canImport(FoundationEssentials) import FoundationEssentials diff --git a/Sources/CryptoBoringWrapper/Util/FiniteFieldArithmeticContext.swift b/Sources/CryptoBoringWrapper/Util/FiniteFieldArithmeticContext.swift index 33c66d8b..8b3b1d73 100644 --- a/Sources/CryptoBoringWrapper/Util/FiniteFieldArithmeticContext.swift +++ b/Sources/CryptoBoringWrapper/Util/FiniteFieldArithmeticContext.swift @@ -12,7 +12,11 @@ // //===----------------------------------------------------------------------===// +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +#else @_implementationOnly import CCryptoBoringSSL +#endif #if canImport(FoundationEssentials) import FoundationEssentials diff --git a/Sources/CryptoExtras/AES/AES_GCM_SIV.swift b/Sources/CryptoExtras/AES/AES_GCM_SIV.swift index 33d0c7ed..5bf5b95f 100644 --- a/Sources/CryptoExtras/AES/AES_GCM_SIV.swift +++ b/Sources/CryptoExtras/AES/AES_GCM_SIV.swift @@ -13,8 +13,13 @@ //===----------------------------------------------------------------------===// import Crypto +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSLShims +#else @_implementationOnly import CCryptoBoringSSL @_implementationOnly import CCryptoBoringSSLShims +#endif import CryptoBoringWrapper #if canImport(FoundationEssentials) import FoundationEssentials diff --git a/Sources/CryptoExtras/AES/Block Function.swift b/Sources/CryptoExtras/AES/Block Function.swift index 0bf0ccbc..e90385a4 100644 --- a/Sources/CryptoExtras/AES/Block Function.swift +++ b/Sources/CryptoExtras/AES/Block Function.swift @@ -13,8 +13,13 @@ //===----------------------------------------------------------------------===// import Crypto +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSLShims +#else @_implementationOnly import CCryptoBoringSSL @_implementationOnly import CCryptoBoringSSLShims +#endif import CryptoBoringWrapper #if canImport(FoundationEssentials) import FoundationEssentials diff --git a/Sources/CryptoExtras/AES/BoringSSL/AES_CFB_boring.swift b/Sources/CryptoExtras/AES/BoringSSL/AES_CFB_boring.swift index 69e57dda..17787f4a 100644 --- a/Sources/CryptoExtras/AES/BoringSSL/AES_CFB_boring.swift +++ b/Sources/CryptoExtras/AES/BoringSSL/AES_CFB_boring.swift @@ -12,9 +12,14 @@ // //===----------------------------------------------------------------------===// -@_implementationOnly import CCryptoBoringSSL import Crypto +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +#else +@_implementationOnly import CCryptoBoringSSL +#endif + #if canImport(FoundationEssentials) import FoundationEssentials #else diff --git a/Sources/CryptoExtras/AES/BoringSSL/AES_CTR_boring.swift b/Sources/CryptoExtras/AES/BoringSSL/AES_CTR_boring.swift index 2ed03be5..0588c2e8 100644 --- a/Sources/CryptoExtras/AES/BoringSSL/AES_CTR_boring.swift +++ b/Sources/CryptoExtras/AES/BoringSSL/AES_CTR_boring.swift @@ -12,9 +12,14 @@ // //===----------------------------------------------------------------------===// -@_implementationOnly import CCryptoBoringSSL import Crypto +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +#else +@_implementationOnly import CCryptoBoringSSL +#endif + #if canImport(FoundationEssentials) import FoundationEssentials #else diff --git a/Sources/CryptoExtras/AES/BoringSSL/AES_GCM_SIV_boring.swift b/Sources/CryptoExtras/AES/BoringSSL/AES_GCM_SIV_boring.swift index 6185a0e7..afa427b3 100644 --- a/Sources/CryptoExtras/AES/BoringSSL/AES_GCM_SIV_boring.swift +++ b/Sources/CryptoExtras/AES/BoringSSL/AES_GCM_SIV_boring.swift @@ -14,11 +14,17 @@ // This is a copy ChaChaPoly_boring just with a different set aes algos -@_implementationOnly import CCryptoBoringSSL -@_implementationOnly import CCryptoBoringSSLShims import Crypto import CryptoBoringWrapper +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSLShims +#else +@_implementationOnly import CCryptoBoringSSL +@_implementationOnly import CCryptoBoringSSLShims +#endif + #if canImport(FoundationEssentials) import FoundationEssentials #else @@ -92,7 +98,7 @@ enum OpenSSLAESGCMSIVImpl { ) } - return try AES.GCM._SIV.SealedBox(combined: combined, nonceByteCount: nonce.bytes.count) + return AES.GCM._SIV.SealedBox(combined: combined, nonceByteCount: nonce.bytes.count) } @inlinable diff --git a/Sources/CryptoExtras/AES/CMAC.swift b/Sources/CryptoExtras/AES/CMAC.swift index c9629334..a5a4b201 100644 --- a/Sources/CryptoExtras/AES/CMAC.swift +++ b/Sources/CryptoExtras/AES/CMAC.swift @@ -11,9 +11,15 @@ // SPDX-License-Identifier: Apache-2.0 // //===----------------------------------------------------------------------===// -@_implementationOnly import CCryptoBoringSSL + import Crypto +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +#else +@_implementationOnly import CCryptoBoringSSL +#endif + #if canImport(FoundationEssentials) import FoundationEssentials #else diff --git a/Sources/CryptoExtras/ChaCha20CTR/BoringSSL/ChaCha20CTR_boring.swift b/Sources/CryptoExtras/ChaCha20CTR/BoringSSL/ChaCha20CTR_boring.swift index 701bf8d8..45b13e7a 100644 --- a/Sources/CryptoExtras/ChaCha20CTR/BoringSSL/ChaCha20CTR_boring.swift +++ b/Sources/CryptoExtras/ChaCha20CTR/BoringSSL/ChaCha20CTR_boring.swift @@ -12,11 +12,17 @@ // //===----------------------------------------------------------------------===// -@_implementationOnly import CCryptoBoringSSL -@_implementationOnly import CCryptoBoringSSLShims import Crypto import CryptoBoringWrapper +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSLShims +#else +@_implementationOnly import CCryptoBoringSSL +@_implementationOnly import CCryptoBoringSSLShims +#endif + #if canImport(FoundationEssentials) import FoundationEssentials #else diff --git a/Sources/CryptoExtras/ChaCha20CTR/ChaCha20CTR.swift b/Sources/CryptoExtras/ChaCha20CTR/ChaCha20CTR.swift index 385fa6e6..c9fd91b1 100644 --- a/Sources/CryptoExtras/ChaCha20CTR/ChaCha20CTR.swift +++ b/Sources/CryptoExtras/ChaCha20CTR/ChaCha20CTR.swift @@ -12,8 +12,13 @@ // //===----------------------------------------------------------------------===// +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSLShims +#else @_implementationOnly import CCryptoBoringSSL @_implementationOnly import CCryptoBoringSSLShims +#endif import Crypto import CryptoBoringWrapper #if canImport(FoundationEssentials) diff --git a/Sources/CryptoExtras/Digests/BoringSSL/BoringSSLSHA512256Context.swift b/Sources/CryptoExtras/Digests/BoringSSL/BoringSSLSHA512256Context.swift index c091bc3f..8fe33e1c 100644 --- a/Sources/CryptoExtras/Digests/BoringSSL/BoringSSLSHA512256Context.swift +++ b/Sources/CryptoExtras/Digests/BoringSSL/BoringSSLSHA512256Context.swift @@ -12,9 +12,14 @@ // //===----------------------------------------------------------------------===// -@_implementationOnly import CCryptoBoringSSL import Crypto +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +#else +@_implementationOnly import CCryptoBoringSSL +#endif + #if canImport(Darwin) import Darwin #endif diff --git a/Sources/CryptoExtras/Digests/BoringSSL/BoringSSLSHA512256HashFunction.swift b/Sources/CryptoExtras/Digests/BoringSSL/BoringSSLSHA512256HashFunction.swift index d97a2369..5b7151fb 100644 --- a/Sources/CryptoExtras/Digests/BoringSSL/BoringSSLSHA512256HashFunction.swift +++ b/Sources/CryptoExtras/Digests/BoringSSL/BoringSSLSHA512256HashFunction.swift @@ -12,9 +12,10 @@ // //===----------------------------------------------------------------------===// -@_implementationOnly import CCryptoBoringSSL import Crypto +@_implementationOnly import CCryptoBoringSSL + struct BoringSSLSHA512256HashFunction { static var digestSize: Int { Int(SHA256_DIGEST_LENGTH) diff --git a/Sources/CryptoExtras/Key Derivation/PBKDF2/BoringSSL/PBKDF2_boring.swift b/Sources/CryptoExtras/Key Derivation/PBKDF2/BoringSSL/PBKDF2_boring.swift index 6bfbad71..e096ddc8 100644 --- a/Sources/CryptoExtras/Key Derivation/PBKDF2/BoringSSL/PBKDF2_boring.swift +++ b/Sources/CryptoExtras/Key Derivation/PBKDF2/BoringSSL/PBKDF2_boring.swift @@ -20,8 +20,13 @@ import Foundation #endif #if !canImport(CommonCrypto) +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSLShims +#else @_implementationOnly import CCryptoBoringSSL @_implementationOnly import CCryptoBoringSSLShims +#endif @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) internal struct BoringSSLPBKDF2 { diff --git a/Sources/CryptoExtras/Key Derivation/Scrypt/BoringSSL/Scrypt_boring.swift b/Sources/CryptoExtras/Key Derivation/Scrypt/BoringSSL/Scrypt_boring.swift index b89c9bd1..719f295f 100644 --- a/Sources/CryptoExtras/Key Derivation/Scrypt/BoringSSL/Scrypt_boring.swift +++ b/Sources/CryptoExtras/Key Derivation/Scrypt/BoringSSL/Scrypt_boring.swift @@ -12,9 +12,15 @@ // //===----------------------------------------------------------------------===// +import Crypto + +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSLShims +#else @_implementationOnly import CCryptoBoringSSL @_implementationOnly import CCryptoBoringSSLShims -import Crypto +#endif #if canImport(FoundationEssentials) #if os(Windows) diff --git a/Sources/CryptoExtras/RSA/RSA_boring.swift b/Sources/CryptoExtras/RSA/RSA_boring.swift index dd967f2f..2a8a1d4c 100644 --- a/Sources/CryptoExtras/RSA/RSA_boring.swift +++ b/Sources/CryptoExtras/RSA/RSA_boring.swift @@ -12,12 +12,18 @@ // //===----------------------------------------------------------------------===// -// NOTE: This file is unconditionally compiled because RSABSSA is implemented using BoringSSL on all platforms. -@_implementationOnly import CCryptoBoringSSL -@_implementationOnly import CCryptoBoringSSLShims import Crypto import CryptoBoringWrapper +// NOTE: This file is unconditionally compiled because RSABSSA is implemented using BoringSSL on all platforms. +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSLShims +#else +@_implementationOnly import CCryptoBoringSSL +@_implementationOnly import CCryptoBoringSSLShims +#endif + #if canImport(FoundationEssentials) #if os(Windows) import ucrt diff --git a/Sources/CryptoExtras/Util/BoringSSL/Zeroization_boring.swift b/Sources/CryptoExtras/Util/BoringSSL/Zeroization_boring.swift index 1991f2f6..3a268aa2 100644 --- a/Sources/CryptoExtras/Util/BoringSSL/Zeroization_boring.swift +++ b/Sources/CryptoExtras/Util/BoringSSL/Zeroization_boring.swift @@ -12,7 +12,11 @@ // //===----------------------------------------------------------------------===// #if !canImport(Darwin) +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +#else @_implementationOnly import CCryptoBoringSSL +#endif @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) typealias errno_t = CInt diff --git a/Sources/CryptoExtras/Util/BoringSSLHelpers.swift b/Sources/CryptoExtras/Util/BoringSSLHelpers.swift index b560330c..5d4f4381 100644 --- a/Sources/CryptoExtras/Util/BoringSSLHelpers.swift +++ b/Sources/CryptoExtras/Util/BoringSSLHelpers.swift @@ -13,8 +13,13 @@ //===----------------------------------------------------------------------===// // NOTE: This file is unconditionally compiled because RSABSSA is implemented using BoringSSL on all platforms. +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSLShims +#else @_implementationOnly import CCryptoBoringSSL @_implementationOnly import CCryptoBoringSSLShims +#endif #if canImport(FoundationEssentials) import FoundationEssentials #else diff --git a/Sources/CryptoExtras/Util/CryptoKitErrors_boring.swift b/Sources/CryptoExtras/Util/CryptoKitErrors_boring.swift index 21d5da6f..cf3528dc 100644 --- a/Sources/CryptoExtras/Util/CryptoKitErrors_boring.swift +++ b/Sources/CryptoExtras/Util/CryptoKitErrors_boring.swift @@ -12,9 +12,14 @@ // //===----------------------------------------------------------------------===// -@_implementationOnly import CCryptoBoringSSL import Crypto +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +#else +@_implementationOnly import CCryptoBoringSSL +#endif + @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) extension CryptoKitError { /// A helper function that packs the value of `ERR_get_error` into the internal error field. diff --git a/Sources/CryptoExtras/Util/DigestType.swift b/Sources/CryptoExtras/Util/DigestType.swift index 469c5687..171caf47 100644 --- a/Sources/CryptoExtras/Util/DigestType.swift +++ b/Sources/CryptoExtras/Util/DigestType.swift @@ -13,7 +13,11 @@ //===----------------------------------------------------------------------===// // NOTE: This file is unconditionally compiled because RSABSSA is implemented using BoringSSL on all platforms. +#if hasFeature(SourceWarningControl) +@diagnose(ImplementationOnlyDeprecated, as: ignored) @_implementationOnly import CCryptoBoringSSL +#else @_implementationOnly import CCryptoBoringSSL +#endif import Crypto @available(macOS 10.15, iOS 13, watchOS 6, tvOS 13, macCatalyst 13, visionOS 1.0, *) diff --git a/Tests/CryptoExtrasTests/AES_CFBTests.swift b/Tests/CryptoExtrasTests/AES_CFBTests.swift index 207a4d33..1de46022 100644 --- a/Tests/CryptoExtrasTests/AES_CFBTests.swift +++ b/Tests/CryptoExtrasTests/AES_CFBTests.swift @@ -45,7 +45,7 @@ final class AES_CFBTests: XCTestCase { func testVector(_ vector: TestVector) throws { let (contiguousPlaintextData, discontiguousPlaintextData) = vector.plaintext.asDataProtocols() - for plaintextData in [contiguousPlaintextData as DataProtocol, discontiguousPlaintextData as DataProtocol] { + for plaintextData in [contiguousPlaintextData as (any DataProtocol), discontiguousPlaintextData as (any DataProtocol)] { let key = SymmetricKey(data: Data(vector.key)) let iv = try AES._CFB.IV(ivBytes: vector.iv) let ciphertext = try AES._CFB.encrypt(plaintextData, using: key, iv: iv) diff --git a/Tests/CryptoTests/Authenticated Encryption/AES-GCM-Runner.swift b/Tests/CryptoTests/Authenticated Encryption/AES-GCM-Runner.swift index e860b71b..166a5120 100644 --- a/Tests/CryptoTests/Authenticated Encryption/AES-GCM-Runner.swift +++ b/Tests/CryptoTests/Authenticated Encryption/AES-GCM-Runner.swift @@ -151,7 +151,7 @@ class AESGCMTests: XCTestCase { let ciphertext = Array("This pretty clearly isn't ciphertext, but sure why not".utf8) let (contiguousCiphertext, discontiguousCiphertext) = ciphertext.asDataProtocols() - let contiguousSB = try orFail { try AES.GCM.SealedBox(combined: contiguousCiphertext) } + let contiguousSB = try orFail { AES.GCM.SealedBox(combined: contiguousCiphertext) } let discontiguousSB = try orFail { try AES.GCM.SealedBox(combined: discontiguousCiphertext) } XCTAssertEqual(contiguousSB.combined, discontiguousSB.combined) XCTAssertEqual(Array(contiguousSB.nonce), Array(discontiguousSB.nonce))