diff --git a/Package.swift b/Package.swift index 9162f16..5496097 100644 --- a/Package.swift +++ b/Package.swift @@ -28,7 +28,8 @@ let package = Package( .define("ED25519_CUSTOMRANDOM"), .define("ED25519_CUSTOMHASH"), .define("ED25519_NO_INLINE_ASM"), - .headerSearchPath("src") + .headerSearchPath("src"), + .headerSearchPath("src/ed25519-donna") ] ), .target( diff --git a/Sources/CSr25519/src/ristretto255.h b/Sources/CSr25519/src/ristretto255.h index df63f68..9f4db3d 100644 --- a/Sources/CSr25519/src/ristretto255.h +++ b/Sources/CSr25519/src/ristretto255.h @@ -5,7 +5,7 @@ #ifndef __ristretto255_H__ #define __ristretto255_H__ -#include "ed25519-donna/ed25519-donna.h" +#include "ed25519-donna.h" typedef uint8_t ristretto255_hash_output[64]; diff --git a/Sources/CSr25519/src/sha2.h b/Sources/CSr25519/src/sha2.h index bbc193d..628e6c5 100644 --- a/Sources/CSr25519/src/sha2.h +++ b/Sources/CSr25519/src/sha2.h @@ -46,7 +46,7 @@ typedef struct _SHA512_CTX { #define REVERSE32(w,x) { \ uint32_t tmp = (w); \ tmp = (tmp >> 16) | (tmp << 16); \ - (x) = ((tmp & 0xff00ff00UL) >> 8) | ((tmp & 0x00ff00ffUL) << 8); \ + (x) = ((tmp & (uint32_t)0xff00ff00UL) >> 8) | ((tmp & (uint32_t)0x00ff00ffUL) << 8); \ } #define REVERSE64(w,x) { \ diff --git a/Sources/CSr25519/src/sr25519.c b/Sources/CSr25519/src/sr25519.c index f906876..907b488 100644 --- a/Sources/CSr25519/src/sr25519.c +++ b/Sources/CSr25519/src/sr25519.c @@ -9,7 +9,7 @@ void divide_scalar_bytes_by_cofactor(uint8_t *scalar, size_t scalar_len) { uint8_t low = 0; - for (int i = scalar_len - 1; i >= 0; i--) { + for (ptrdiff_t i = scalar_len - 1; i >= 0; i--) { uint8_t r = scalar[i] & 7; scalar[i] >>= 3; scalar[i] += low; diff --git a/Sr25519.podspec b/Sr25519.podspec index 941cb06..9073669 100644 --- a/Sr25519.podspec +++ b/Sr25519.podspec @@ -24,10 +24,12 @@ Swift wrapper for sr25519-donna C library. Provides Sr25519 and Ed25519 wrappers s.subspec 'CSr25519' do |ss| ss.source_files = 'Sources/CSr25519/src/**/*.{h,c}' - ss.public_header_files = 'Sources/CSr25519/include/*.h' + ss.public_header_files = 'Sources/CSr25519/src/sr25519.h', 'Sources/CSr25519/src/sr25519-random*.h', 'Sources/CSr25519/src/ed25519-donna/ed25519.h' ss.pod_target_xcconfig = { - 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) ED25519_CUSTOMRANDOM ED25519_CUSTOMHASH ED25519_NO_INLINE_ASM' + 'GCC_PREPROCESSOR_DEFINITIONS' => '$(inherited) ED25519_CUSTOMRANDOM ED25519_CUSTOMHASH ED25519_NO_INLINE_ASM', + 'GCC_WARN_UNUSED_FUNCTION' => 'NO', + 'GCC_WARN_UNUSED_VARIABLE' => 'NO' } end diff --git a/Tests/Sr25519Tests/SrVrfTests.swift b/Tests/Sr25519Tests/SrVrfTests.swift index 053e1ea..378b013 100644 --- a/Tests/Sr25519Tests/SrVrfTests.swift +++ b/Tests/Sr25519Tests/SrVrfTests.swift @@ -7,8 +7,6 @@ import XCTest @testable import Sr25519 -import CSr25519 -import Sr25519Helpers final class Sr25519VrfTests: XCTestCase { let kpData = "88dca235b034ac1a0e6aa9bfe3e919f74eb7d726345bec42979e6f1a20905e58ac5ea3a293dfd93859ee64a5b825937753864c19be857f045758dcae10259ba1049b21bb9cb88471b9dadb50b925135cfb291a463043635b58599a2d01b1fd18".hexData!