From cbc7ae15d58b941cc0d03157d18d320ef23d805e Mon Sep 17 00:00:00 2001 From: Michael Griebling Date: Thu, 13 Jul 2023 08:02:27 -0400 Subject: [PATCH] Another attempted fix for Linux. --- Sources/BigInt/BigInt.swift | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Sources/BigInt/BigInt.swift b/Sources/BigInt/BigInt.swift index 19ffcae..b8bfa34 100755 --- a/Sources/BigInt/BigInt.swift +++ b/Sources/BigInt/BigInt.swift @@ -1835,14 +1835,15 @@ extension BInt { static internal func randomBytes(_ bytes: inout Bytes) { // Use nil in place of kSecRandomDefault for Linux compatibility - guard SecRandomCopyBytes(nil, bytes.count, &bytes) == errSecSuccess else { + // Sub 0 for errSecSuccess + guard SecRandomCopyBytes(nil, bytes.count, &bytes) == 0 else { fatalError("randomBytes failed") } } static internal func randomLimbs(_ limbs: inout Limbs) { // Use nil in place of kSecRandomDefault for Linux compatibility - guard SecRandomCopyBytes(nil, 8 * limbs.count, &limbs) == errSecSuccess else { + guard SecRandomCopyBytes(nil, 8 * limbs.count, &limbs) == 0 else { fatalError("randomLimbs failed") } }