mirror of
https://github.com/apple/swift-crypto
synced 2026-11-26 04:47:49 +00:00
Motivation: Some critical use-cases require RSA signing support. This is most commonly required when interacting with legacy systems. While RSA is an older and less efficient cryptosystem than the elliptic-curve algorithms supported by Swift Crypto already, those interop use-cases are unavoidable. This version of the patch does not promote RSA to supported API at this time, as we'd like to let the API bake somewhat. Users are free to use it, but these APIs are not covered by semantic versioning at this time and may break in future. Modifications: - Defined new RSA API - Implemented on top of `Security` when available - Implemented on top of BoringSSL when `Security` is unavailable Result: Users can do RSA if needed.
70 lines
2.8 KiB
Swift
70 lines
2.8 KiB
Swift
// swift-tools-version:5.1
|
|
//===----------------------------------------------------------------------===//
|
|
//
|
|
// This source file is part of the SwiftCrypto open source project
|
|
//
|
|
// Copyright (c) 2019 Apple Inc. and the SwiftCrypto project authors
|
|
// Licensed under Apache License v2.0
|
|
//
|
|
// See LICENSE.txt for license information
|
|
// See CONTRIBUTORS.md for the list of SwiftCrypto project authors
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
// This package contains a vendored copy of BoringSSL. For ease of tracking
|
|
// down problems with the copy of BoringSSL in use, we include a copy of the
|
|
// commit hash of the revision of BoringSSL included in the given release.
|
|
// This is also reproduced in a file called hash.txt in the
|
|
// Sources/CCryptoBoringSSL directory. The source repository is at
|
|
// https://boringssl.googlesource.com/boringssl.
|
|
//
|
|
// BoringSSL Commit: 04b3213d43492b6c9e0434d8e2a4530a9938f958
|
|
|
|
import PackageDescription
|
|
|
|
let swiftSettings: [SwiftSetting] = [
|
|
.define("CRYPTO_IN_SWIFTPM"),
|
|
// To develop this on Apple platforms, uncomment this define.
|
|
// .define("CRYPTO_IN_SWIFTPM_FORCE_BUILD_API"),
|
|
]
|
|
|
|
let package = Package(
|
|
name: "swift-crypto",
|
|
platforms: [
|
|
.macOS(.v10_15),
|
|
.iOS(.v13),
|
|
.watchOS(.v6),
|
|
.tvOS(.v13),
|
|
],
|
|
products: [
|
|
.library(name: "Crypto", targets: ["Crypto"]),
|
|
.library(name: "_CryptoExtras", targets: ["_CryptoExtras"]),
|
|
/* This target is used only for symbol mangling. It's added and removed automatically because it emits build warnings. MANGLE_START
|
|
.library(name: "CCryptoBoringSSL", type: .static, targets: ["CCryptoBoringSSL"]),
|
|
MANGLE_END */
|
|
],
|
|
dependencies: [],
|
|
targets: [
|
|
.target(
|
|
name: "CCryptoBoringSSL",
|
|
cSettings: [
|
|
/*
|
|
* This define is required on Windows, but because we need older
|
|
* versions of SPM, we cannot conditionally define this on Windows
|
|
* only. Unconditionally define it instead.
|
|
*/
|
|
.define("WIN32_LEAN_AND_MEAN"),
|
|
]
|
|
),
|
|
.target(name: "CCryptoBoringSSLShims", dependencies: ["CCryptoBoringSSL"]),
|
|
.target(name: "Crypto", dependencies: ["CCryptoBoringSSL", "CCryptoBoringSSLShims"], swiftSettings: swiftSettings),
|
|
.target(name: "_CryptoExtras", dependencies: ["CCryptoBoringSSL", "CCryptoBoringSSLShims", "Crypto"]),
|
|
.target(name: "crypto-shasum", dependencies: ["Crypto"]),
|
|
.testTarget(name: "CryptoTests", dependencies: ["Crypto"], swiftSettings: swiftSettings),
|
|
.testTarget(name: "_CryptoExtrasTests", dependencies: ["_CryptoExtras"]),
|
|
],
|
|
cxxLanguageStandard: .cxx11
|
|
)
|