Skip to content

Commit

Permalink
Another attempted fix for Linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
mgriebling committed Jul 13, 2023
1 parent b4b6e3b commit cbc7ae1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Sources/BigInt/BigInt.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}
Expand Down

0 comments on commit cbc7ae1

Please sign in to comment.