From 33f65a3cbc52f8c19295723af9cbecc2195484e1 Mon Sep 17 00:00:00 2001 From: Si Beaumont Date: Thu, 27 Jun 2024 15:01:40 +0100 Subject: [PATCH] Change inclusiveMin param of ArbitraryPrecisionInteger.random from UInt64 to UInt (#242) --- Sources/CryptoBoringWrapper/ArbitraryPrecisionInteger.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/CryptoBoringWrapper/ArbitraryPrecisionInteger.swift b/Sources/CryptoBoringWrapper/ArbitraryPrecisionInteger.swift index f465b7d7..a5590629 100644 --- a/Sources/CryptoBoringWrapper/ArbitraryPrecisionInteger.swift +++ b/Sources/CryptoBoringWrapper/ArbitraryPrecisionInteger.swift @@ -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()