From a24d99d67851e2f6160b1bbf2945abe2f880eee3 Mon Sep 17 00:00:00 2001 From: EinMByte Date: Sun, 30 Aug 2015 10:18:29 +0200 Subject: [PATCH] Use size_t and uint64_t instead of long long in ed25519/. --- core/crypto/ed25519/crypto_hash_sha512.h | 14 +++++++------- core/crypto/ed25519/ed25519_ref10.h | 4 ++-- core/crypto/ed25519/ge_scalarmult_base.cpp | 2 +- core/crypto/ed25519/open.cpp | 2 +- core/crypto/ed25519/sign.cpp | 2 +- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/crypto/ed25519/crypto_hash_sha512.h b/core/crypto/ed25519/crypto_hash_sha512.h index e5b14a66..1991c393 100644 --- a/core/crypto/ed25519/crypto_hash_sha512.h +++ b/core/crypto/ed25519/crypto_hash_sha512.h @@ -4,15 +4,15 @@ #include inline void crypto_hash_sha512(unsigned char* output, const unsigned char* input, - unsigned long long len) + size_t len) { CryptoPP::SHA512 hash; hash.CalculateDigest(output, input, len); } inline void crypto_hash_sha512_2(unsigned char* out, - const unsigned char* in1, unsigned long long len1, - const unsigned char* in2, unsigned long long len2 + const unsigned char* in1, size_t len1, + const unsigned char* in2, size_t len2 ) { CryptoPP::SHA512 hash; @@ -22,10 +22,10 @@ inline void crypto_hash_sha512_2(unsigned char* out, } inline void crypto_hash_sha512_3(unsigned char* out, - const unsigned char* in1, unsigned long long len1, - const unsigned char* in2, unsigned long long len2, - const unsigned char* in3, unsigned long long len3 - ) + const unsigned char* in1, size_t len1, + const unsigned char* in2, size_t len2, + const unsigned char* in3, size_t len3 +) { CryptoPP::SHA512 hash; hash.Update(in1, len1); diff --git a/core/crypto/ed25519/ed25519_ref10.h b/core/crypto/ed25519/ed25519_ref10.h index 1fa76c7a..681b4263 100644 --- a/core/crypto/ed25519/ed25519_ref10.h +++ b/core/crypto/ed25519/ed25519_ref10.h @@ -8,13 +8,13 @@ int ed25519_ref10_pubkey(unsigned char* pk, const unsigned char* sk); int ed25519_ref10_open( const unsigned char* sig, - const unsigned char* m, unsigned long long mlen, + const unsigned char* m, size_t mlen, const unsigned char*pk ); int ed25519_ref10_sign( unsigned char* sig, - const unsigned char* m, unsigned long long mlen, + const unsigned char* m, size_t mlen, const unsigned char* sk, const unsigned char* pk ); diff --git a/core/crypto/ed25519/ge_scalarmult_base.cpp b/core/crypto/ed25519/ge_scalarmult_base.cpp index 421e4fa0..a55c3c46 100644 --- a/core/crypto/ed25519/ge_scalarmult_base.cpp +++ b/core/crypto/ed25519/ge_scalarmult_base.cpp @@ -14,7 +14,7 @@ static unsigned char equal(signed char b,signed char c) static unsigned char negative(signed char b) { - unsigned long long x = b; /* 18446744073709551361..18446744073709551615: yes; 0..255: no */ + uint64_t x = b; /* 18446744073709551361..18446744073709551615: yes; 0..255: no */ x >>= 63; /* 1: yes; 0: no */ return x; } diff --git a/core/crypto/ed25519/open.cpp b/core/crypto/ed25519/open.cpp index 0264f893..2ad0b156 100644 --- a/core/crypto/ed25519/open.cpp +++ b/core/crypto/ed25519/open.cpp @@ -7,7 +7,7 @@ int crypto_sign_open( const unsigned char* sig, - const unsigned char* m, unsigned long long mlen, + const unsigned char* m, size_t mlen, const unsigned char* pk ) { diff --git a/core/crypto/ed25519/sign.cpp b/core/crypto/ed25519/sign.cpp index 06a65ce1..68ab0eab 100644 --- a/core/crypto/ed25519/sign.cpp +++ b/core/crypto/ed25519/sign.cpp @@ -6,7 +6,7 @@ int crypto_sign( unsigned char *sig, - const unsigned char* m, unsigned long long mlen, + const unsigned char* m, size_t mlen, const unsigned char* sk, const unsigned char* pk ) {