diff --git a/BitcoinKit.xcodeproj/project.pbxproj b/BitcoinKit.xcodeproj/project.pbxproj index 92968933..ceb75be8 100644 --- a/BitcoinKit.xcodeproj/project.pbxproj +++ b/BitcoinKit.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 50; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -1157,8 +1157,8 @@ isa = PBXNativeTarget; buildConfigurationList = 147494DB201F9A29006D1CF8 /* Build configuration list for PBXNativeTarget "BitcoinKit" */; buildPhases = ( - 292B636820E7BF7000F5040A /* SwiftLint */, 1482B628202954CC0098B612 /* Build Libraries */, + 292B636820E7BF7000F5040A /* SwiftLint */, 147494C2201F9A29006D1CF8 /* Sources */, 147494C3201F9A29006D1CF8 /* Frameworks */, 147494C4201F9A29006D1CF8 /* Headers */, @@ -1253,6 +1253,7 @@ /* Begin PBXShellScriptBuildPhase section */ 1482B628202954CC0098B612 /* Build Libraries */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -1264,7 +1265,6 @@ runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; shellScript = "if [ ! -d \"$SRCROOT/Libraries/secp256k1/lib\" ] || [ ! -d \"$SRCROOT/Libraries/openssl/lib\" ]; then\n env -i PATH=$PATH sh \"$SRCROOT/setup/build_libraries.sh\"\nfi\n"; - showEnvVarsInLog = 0; }; 292B636820E7BF7000F5040A /* SwiftLint */ = { isa = PBXShellScriptBuildPhase; @@ -1278,7 +1278,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "if which swiftlint >/dev/null; then\n pwd\n swiftlint autocorrect\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi"; + shellScript = "if which swiftlint >/dev/null; then\n pwd\n swiftlint autocorrect\n swiftlint\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; }; /* End PBXShellScriptBuildPhase section */ @@ -1615,7 +1615,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -1671,8 +1671,9 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + IPHONEOS_DEPLOYMENT_TARGET = 9.0; MTL_ENABLE_DEBUG_INFO = NO; + ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; diff --git a/Sources/BitcoinKitPrivate/BitcoinKit.Private.swift b/Sources/BitcoinKitPrivate/BitcoinKit.Private.swift index 83006ab2..3bd2c0dd 100644 --- a/Sources/BitcoinKitPrivate/BitcoinKit.Private.swift +++ b/Sources/BitcoinKitPrivate/BitcoinKit.Private.swift @@ -224,13 +224,13 @@ public class _HDKey { } BN_mod_add(privateKeyNum, privateKeyNum, factor, curveOrder, ctx) - // Check for invalid derivation. - //if BN_is_zero(privateKeyNum) { - // return nil - //} - if privateKeyNum.pointee.top == 0 { // BN_is_zero +// Check for invalid derivation. + if (BN_is_zero(privateKeyNum) != 0) { return nil } +// if privateKeyNum.pointee.top == 0 { // BN_is_zero +// return nil +// } let numBytes = ((BN_num_bits(privateKeyNum)+7)/8) // BN_num_bytes result = Data(count: Int(numBytes)) result.withUnsafeMutableBytes { (ptr: UnsafeMutableRawBufferPointer) in diff --git a/setup/build_crypto.sh b/setup/build_crypto.sh index 8fcc1734..7934da01 100644 --- a/setup/build_crypto.sh +++ b/setup/build_crypto.sh @@ -1,7 +1,7 @@ #!/bin/sh set -ex -SCRIPT_DIR="`pwd`/`dirname $0`" +SCRIPT_DIR="`dirname $0`" OPENSSL_VERSION=1.0.2n TDIR=`mktemp -d` @@ -9,7 +9,7 @@ trap "{ cd - ; rm -rf $TDIR; exit 255; }" SIGINT cd $TDIR -curl -O https://www.openssl.org/source/openssl-$OPENSSL_VERSION.tar.gz +curl -O https://www.openssl.org/source/old/1.0.2/openssl-$OPENSSL_VERSION.tar.gz tar zxf openssl-$OPENSSL_VERSION.tar.gz cd openssl-$OPENSSL_VERSION @@ -17,8 +17,10 @@ cd openssl-$OPENSSL_VERSION sh "$SCRIPT_DIR/build_crypto_impl.sh" iphoneos arm64 sh "$SCRIPT_DIR/build_crypto_impl.sh" iphoneos armv7s sh "$SCRIPT_DIR/build_crypto_impl.sh" iphoneos armv7 -sh "$SCRIPT_DIR/build_crypto_impl.sh" iphonesimulator x86_64 sh "$SCRIPT_DIR/build_crypto_impl.sh" iphonesimulator i386 +sh "$SCRIPT_DIR/build_crypto_impl.sh" iphonesimulator x86_64 + + mkdir -p "$SCRIPT_DIR/../Libraries/openssl/lib" diff --git a/setup/build_secp256k1.sh b/setup/build_secp256k1.sh index 631dde0f..9dec35bd 100644 --- a/setup/build_secp256k1.sh +++ b/setup/build_secp256k1.sh @@ -19,7 +19,7 @@ TARGETDIR_SIMULATOR="$CURRENTPATH/.build/iphonesimulator" mkdir -p "$TARGETDIR_SIMULATOR" (cd src && ./autogen.sh) -(cd src && ./configure --host=x86_64-apple-darwin CC=`xcrun -find clang` CFLAGS="-O3 -arch i386 -arch x86_64 -isysroot `xcrun -sdk iphonesimulator --show-sdk-path` -fembed-bitcode-marker -mios-simulator-version-min=8.0" CXX=`xcrun -find clang++` CXXFLAGS="-O3 -arch i386 -arch x86_64 -isysroot `xcrun -sdk iphonesimulator --show-sdk-path` -fembed-bitcode-marker -mios-simulator-version-min=8.0" --prefix="$TARGETDIR_IPHONEOS" && make install) +(cd src && ./configure --host=x86_64-apple-darwin CC=`xcrun -find clang` CFLAGS="-O3 -arch x86_64 -isysroot `xcrun -sdk iphonesimulator --show-sdk-path` -fembed-bitcode-marker -mios-simulator-version-min=8.0" CXX=`xcrun -find clang++` CXXFLAGS="-O3 -arch x86_64 -isysroot `xcrun -sdk iphonesimulator --show-sdk-path` -fembed-bitcode-marker -mios-simulator-version-min=8.0" --prefix="$TARGETDIR_IPHONEOS" && make install) (cd src && ./configure --host=arm-apple-darwin CC=`xcrun -find clang` CFLAGS="-O3 -arch armv7 -arch armv7s -arch arm64 -isysroot `xcrun -sdk iphoneos --show-sdk-path` -fembed-bitcode -mios-version-min=8.0" CXX=`xcrun -find clang++` CXXFLAGS="-O3 -arch armv7 -arch armv7s -arch arm64 -isysroot `xcrun -sdk iphoneos --show-sdk-path` -fembed-bitcode -mios-version-min=8.0" --prefix="$TARGETDIR_SIMULATOR" && make install) cd -