mirror of
https://github.com/krzyzanowskim/CryptoSwift.git
synced 2026-06-06 20:17:32 +00:00
Merge pull request #979 from GoodNotes/swiftwasm-support
Make CryptoSwift compilable with SwiftWasm
This commit is contained in:
@@ -23,6 +23,8 @@ import Darwin
|
||||
import Glibc
|
||||
#elseif canImport(ucrt)
|
||||
import ucrt
|
||||
#elseif canImport(WASILibc)
|
||||
import WASILibc
|
||||
#endif
|
||||
|
||||
/// Counter with Cipher Block Chaining-Message Authentication Code
|
||||
|
||||
@@ -22,6 +22,8 @@ import Darwin
|
||||
import Glibc
|
||||
#elseif canImport(ucrt)
|
||||
import ucrt
|
||||
#elseif canImport(WASILibc)
|
||||
import WASILibc
|
||||
#endif
|
||||
|
||||
/// A key derivation function.
|
||||
|
||||
@@ -22,6 +22,8 @@ import Darwin
|
||||
import Glibc
|
||||
#elseif canImport(ucrt)
|
||||
import ucrt
|
||||
#elseif canImport(WASILibc)
|
||||
import WASILibc
|
||||
#endif
|
||||
|
||||
public extension PKCS5 {
|
||||
|
||||
@@ -35,6 +35,8 @@ final class SecureBytes {
|
||||
self.bytes.withUnsafeBufferPointer { (pointer) -> Void in
|
||||
#if os(Windows)
|
||||
VirtualLock(UnsafeMutableRawPointer(mutating: pointer.baseAddress), SIZE_T(pointer.count))
|
||||
#elseif os(WASI)
|
||||
// not supported on WASI
|
||||
#else
|
||||
mlock(pointer.baseAddress, pointer.count)
|
||||
#endif
|
||||
@@ -45,6 +47,8 @@ final class SecureBytes {
|
||||
self.bytes.withUnsafeBufferPointer { (pointer) -> Void in
|
||||
#if os(Windows)
|
||||
VirtualUnlock(UnsafeMutableRawPointer(mutating: pointer.baseAddress), SIZE_T(pointer.count))
|
||||
#elseif os(WASI)
|
||||
// not supported on WASI
|
||||
#else
|
||||
munlock(pointer.baseAddress, pointer.count)
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user