From 06dc63c6d8da54ee11ceb268cde1fa68161afc96 Mon Sep 17 00:00:00 2001 From: Kyle Date: Wed, 30 Oct 2024 21:36:45 +0800 Subject: [PATCH] Fix WASI platform build issue (#291) --- Sources/CryptoBoringWrapper/Util/RandomBytes.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/CryptoBoringWrapper/Util/RandomBytes.swift b/Sources/CryptoBoringWrapper/Util/RandomBytes.swift index f4aea1fd..c4f5c698 100644 --- a/Sources/CryptoBoringWrapper/Util/RandomBytes.swift +++ b/Sources/CryptoBoringWrapper/Util/RandomBytes.swift @@ -21,9 +21,6 @@ extension UnsafeMutableRawBufferPointer { #if canImport(Darwin) || os(Linux) || os(Android) || os(Windows) var rng = SystemRandomNumberGenerator() - #else - fatalError("No secure random number generator on this platform.") - #endif precondition(count <= self.count) // We store bytes 64-bits at a time until we can't anymore. @@ -41,6 +38,9 @@ extension UnsafeMutableRawBufferPointer { remainingWord >>= 8 targetPtr = UnsafeMutableRawBufferPointer(rebasing: targetPtr[1...]) } + #else + fatalError("No secure random number generator on this platform.") + #endif } }