Skip to content

Commit

Permalink
Change inclusiveMin param of ArbitraryPrecisionInteger.random from UI…
Browse files Browse the repository at this point in the history
…nt64 to UInt (#242)
  • Loading branch information
simonjbeaumont authored Jun 27, 2024
1 parent fdfdc11 commit 33f65a3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Sources/CryptoBoringWrapper/ArbitraryPrecisionInteger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -436,12 +436,12 @@ extension ArbitraryPrecisionInteger {
}

@inlinable
public static func random(inclusiveMin: UInt64, exclusiveMax: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger {
public static func random(inclusiveMin: UInt, exclusiveMax: ArbitraryPrecisionInteger) throws -> ArbitraryPrecisionInteger {
var result = ArbitraryPrecisionInteger()

guard result.withUnsafeMutableBignumPointer({ resultPtr in
exclusiveMax.withUnsafeBignumPointer { exclusiveMaxPtr in
CCryptoBoringSSL_BN_rand_range_ex(resultPtr, inclusiveMin, exclusiveMaxPtr)
CCryptoBoringSSL_BN_rand_range_ex(resultPtr, BN_ULONG(inclusiveMin), exclusiveMaxPtr)
}
}) == 1 else {
throw CryptoBoringWrapperError.internalBoringSSLError()
Expand Down

0 comments on commit 33f65a3

Please sign in to comment.