mirror of
https://github.com/apple/swift-crypto
synced 2026-11-22 04:30:39 +00:00
Avoid TSAN issue in _CryptoExtras/AES/CMAC (#402)
### Motivation: swift-crypto currently fails to compile with TSAN enabled in 5.10 and 6.0 due to a TSAN error stemming from the use of `consuming` in the `finalize()` method of `_CryptoExtras/AES/CMAC`. ### Modifications: Like #384, the `consuming finalize()` method in `_CryptoExtras/AES/CMAC` is now wrapped inside a `#if compiler(>=6.1)` condition. A non-consuming variant is used otherwise. ### Result: `swift-crypto` can successfully compile with TSAN enabled in 5.10 and 6.0.
This commit is contained in:
1 parent
b7c303d97b
commit
d1c6b70f7c
1 file changed
+14
@@ -65,6 +65,10 @@ extension AES {
|
||||
self.backing.update(bufferPointer)
|
||||
}
|
||||
|
||||
// This enhancement can only be present on 6.1 or later because of the
|
||||
// absence of https://github.com/swiftlang/swift/pull/76186 in older
|
||||
// compilers.
|
||||
#if compiler(>=6.1)
|
||||
/// Finalizes the message authentication computation and returns the
|
||||
/// computed code.
|
||||
///
|
||||
@@ -77,6 +81,16 @@ extension AES {
|
||||
self.cowIfNeeded()
|
||||
return self.backing.finalize()
|
||||
}
|
||||
#else
|
||||
/// Finalizes the message authentication computation and returns the
|
||||
/// computed code.
|
||||
///
|
||||
/// - Returns: The message authentication code.
|
||||
public func finalize() -> AES.CMAC.MAC {
|
||||
var `self` = self
|
||||
return self.backing.finalize()
|
||||
}
|
||||
#endif
|
||||
|
||||
/// Updates the MAC with data.
|
||||
///
|
||||
|
||||
Reference in new issue
Block a user