From 01c3fdfb8500003ea90ed082370566702dc72024 Mon Sep 17 00:00:00 2001 From: buttaface Date: Tue, 1 Jun 2021 15:00:49 +0530 Subject: [PATCH] Fix build for 32-bit platforms (#85) Motivation: I couldn't build for Android armv7 on the CI I set up without this. Modifications: Initialize with the right size of UInt to BoringSSL. Result: I can build for armv7 again. Co-authored-by: Cory Benfield --- Sources/_CryptoExtras/Util/BoringSSLHelpers.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/_CryptoExtras/Util/BoringSSLHelpers.swift b/Sources/_CryptoExtras/Util/BoringSSLHelpers.swift index b306c7f5..5c4f5cef 100644 --- a/Sources/_CryptoExtras/Util/BoringSSLHelpers.swift +++ b/Sources/_CryptoExtras/Util/BoringSSLHelpers.swift @@ -78,7 +78,7 @@ extension String { extension FixedWidthInteger { func withBignumPointer(_ block: (UnsafeMutablePointer) throws -> ReturnType) rethrows -> ReturnType { - precondition(self.bitWidth <= 64) + precondition(self.bitWidth <= UInt.bitWidth) var bn = BIGNUM() CCryptoBoringSSL_BN_init(&bn) @@ -86,7 +86,7 @@ extension FixedWidthInteger { CCryptoBoringSSL_BN_clear(&bn) } - CCryptoBoringSSL_BN_set_word(&bn, UInt64(self)) + CCryptoBoringSSL_BN_set_word(&bn, .init(self)) return try block(&bn) }