Files
Si BeaumontandCory Benfield b0b1963823 Add AES.GCM.open and seal APIs over output span (#507)
### Motivation:

We don't have any API for `AES.GCM.seal` or `open` a read-only buffer
into a caller-provided destination.

### Modifications:

- Add `seal` and `open` helpers to `BoringSSLAEAD.AEADContext` that take
`RawSpan` as input and append to an `OutputRawSpan`.
- Refactor the in-place versions to throw from inside the BoringSSL
call, to match the new functions.
- Add `AES.GCM._seal(_:using:nonce:authenticating:tag:output:)` and
`AES.GCM._open(_:using:nonce:authenticating:tag:output:)` to
CryptoExtras.
- Add tests.

### Result:

New API in CryptoExtras:
- `AES.GCM._seal(_:using:nonce:authenticating:tag:output:)`
- `AES.GCM._open(_:using:nonce:authenticating:tag:output:)`

---------

Co-authored-by: Cory Benfield <lukasa@apple.com>
2026-11-23 18:05:24 +00:00

110 lines
3.5 KiB
CMake

##===----------------------------------------------------------------------===##
##
## This source file is part of the SwiftCrypto open source project
##
## Copyright (c) 2023 Apple Inc. and the SwiftCrypto project authors
## Licensed under Apache License v2.0
##
## See LICENSE.txt for license information
## See CONTRIBUTORS.txt for the list of SwiftCrypto project authors
##
## SPDX-License-Identifier: Apache-2.0
##
##===----------------------------------------------------------------------===##
add_library(CryptoExtras
"AES/AES_CBC.swift"
"AES/AES_CFB.swift"
"AES/AES_CTR.swift"
"AES/AES_GCM+Extensions.swift"
"AES/AES_GCM_SIV.swift"
"AES/Block Function.swift"
"AES/BoringSSL/AES_CBC_boring.swift"
"AES/BoringSSL/AES_CFB_boring.swift"
"AES/BoringSSL/AES_CTR_boring.swift"
"AES/BoringSSL/AES_GCM_SIV_boring.swift"
"AES/BoringSSL/AES_GCM_boring.swift"
"AES/CMAC.swift"
"ARC/ARC+API.swift"
"ARC/ARC.swift"
"ARC/ARCCredential.swift"
"ARC/ARCEncoding.swift"
"ARC/ARCPrecredential.swift"
"ARC/ARCPresentation.swift"
"ARC/ARCRequest.swift"
"ARC/ARCResponse.swift"
"ARC/ARCServer.swift"
"ChaCha20CTR/BoringSSL/ChaCha20CTR_boring.swift"
"ChaCha20CTR/ChaCha20CTR.swift"
"Digests/BoringSSL/BoringSSLSHA512256Context.swift"
"Digests/BoringSSL/BoringSSLSHA512256HashFunction.swift"
"Digests/SHA512256.swift"
"Digests/SHA512256Digest.swift"
"EC/Curve25519+PEM.swift"
"EC/ObjectIdentifier.swift"
"EC/PKCS8DERRepresentation.swift"
"EC/PKCS8PrivateKey.swift"
"EC/RFC8410AlgorithmIdentifier.swift"
"ECToolbox/BoringSSL/ECToolbox_boring.swift"
"ECToolbox/ECToolbox.swift"
"H2G/HashToField.swift"
"Key Derivation/KDF.swift"
"Key Derivation/PBKDF2/BoringSSL/PBKDF2_boring.swift"
"Key Derivation/PBKDF2/BoringSSL/PBKDF2_commoncrypto.swift"
"Key Derivation/PBKDF2/PBKDF2.swift"
"Key Derivation/Scrypt/BoringSSL/Scrypt_boring.swift"
"Key Derivation/Scrypt/Scrypt.swift"
"OPRFs/OPRF.swift"
"OPRFs/OPRFClient.swift"
"OPRFs/OPRFServer.swift"
"OPRFs/VOPRF+API.swift"
"OPRFs/VOPRFClient.swift"
"OPRFs/VOPRFServer.swift"
"RSA/BoringSSLPassphraseCallbackManager.swift"
"RSA/RSA+BlindSigning.swift"
"RSA/RSA.swift"
"RSA/RSA_boring.swift"
"Reexport.swift"
"Util/BoringSSL/Zeroization_boring.swift"
"Util/BoringSSLHelpers.swift"
"Util/CryptoKitErrors_boring.swift"
"Util/Data+Extensions.swift"
"Util/DigestType.swift"
"Util/Error.swift"
"Util/I2OSP.swift"
"Util/IntegerEncoding.swift"
"Util/PEMDocument.swift"
"Util/PrettyBytes.swift"
"Util/SubjectPublicKeyInfo.swift"
"Util/ThreadSpecific/ThreadOps.swift"
"Util/ThreadSpecific/ThreadPosix.swift"
"Util/ThreadSpecific/ThreadSpecific.swift"
"Util/ThreadSpecific/ThreadWindows.swift"
"Util/Zeroization.swift"
"ZKPs/DLEQ.swift"
"ZKPs/Prover.swift"
"ZKPs/Verifier.swift"
"ZKPs/ZKPToolbox.swift"
)
target_compile_options(CryptoExtras PRIVATE -DCRYPTO_IN_SWIFTPM)
target_include_directories(CryptoExtras PRIVATE
$<TARGET_PROPERTY:CCryptoBoringSSL,INCLUDE_DIRECTORIES>)
target_link_libraries(CryptoExtras PUBLIC
$<$<NOT:$<PLATFORM_ID:Darwin>>:Foundation>
Crypto
CryptoBoringWrapper
CCryptoBoringSSL)
target_compile_options(CryptoExtras PRIVATE ${SWIFT_CRYPTO_COMPILE_OPTIONS})
target_link_options(CryptoExtras PRIVATE
"$<$<PLATFORM_ID:Darwin>:SHELL:-Xlinker -framework -Xlinker Security>")
set_target_properties(CryptoExtras PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_Swift_MODULE_DIRECTORY})
set_property(GLOBAL APPEND PROPERTY SWIFT_CRYPTO_EXPORTS CryptoExtras)