Browse Source

Use size_t and uint64_t instead of long long in ed25519/.

pull/263/head
EinMByte 9 years ago
parent
commit
a24d99d678
  1. 14
      core/crypto/ed25519/crypto_hash_sha512.h
  2. 4
      core/crypto/ed25519/ed25519_ref10.h
  3. 2
      core/crypto/ed25519/ge_scalarmult_base.cpp
  4. 2
      core/crypto/ed25519/open.cpp
  5. 2
      core/crypto/ed25519/sign.cpp

14
core/crypto/ed25519/crypto_hash_sha512.h

@ -4,15 +4,15 @@
#include <cryptopp/sha.h> #include <cryptopp/sha.h>
inline void crypto_hash_sha512(unsigned char* output, const unsigned char* input, inline void crypto_hash_sha512(unsigned char* output, const unsigned char* input,
unsigned long long len) size_t len)
{ {
CryptoPP::SHA512 hash; CryptoPP::SHA512 hash;
hash.CalculateDigest(output, input, len); hash.CalculateDigest(output, input, len);
} }
inline void crypto_hash_sha512_2(unsigned char* out, inline void crypto_hash_sha512_2(unsigned char* out,
const unsigned char* in1, unsigned long long len1, const unsigned char* in1, size_t len1,
const unsigned char* in2, unsigned long long len2 const unsigned char* in2, size_t len2
) )
{ {
CryptoPP::SHA512 hash; 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, inline void crypto_hash_sha512_3(unsigned char* out,
const unsigned char* in1, unsigned long long len1, const unsigned char* in1, size_t len1,
const unsigned char* in2, unsigned long long len2, const unsigned char* in2, size_t len2,
const unsigned char* in3, unsigned long long len3 const unsigned char* in3, size_t len3
) )
{ {
CryptoPP::SHA512 hash; CryptoPP::SHA512 hash;
hash.Update(in1, len1); hash.Update(in1, len1);

4
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( int ed25519_ref10_open(
const unsigned char* sig, const unsigned char* sig,
const unsigned char* m, unsigned long long mlen, const unsigned char* m, size_t mlen,
const unsigned char*pk const unsigned char*pk
); );
int ed25519_ref10_sign( int ed25519_ref10_sign(
unsigned char* sig, 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 const unsigned char* sk, const unsigned char* pk
); );

2
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) 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 */ x >>= 63; /* 1: yes; 0: no */
return x; return x;
} }

2
core/crypto/ed25519/open.cpp

@ -7,7 +7,7 @@
int crypto_sign_open( int crypto_sign_open(
const unsigned char* sig, const unsigned char* sig,
const unsigned char* m, unsigned long long mlen, const unsigned char* m, size_t mlen,
const unsigned char* pk const unsigned char* pk
) )
{ {

2
core/crypto/ed25519/sign.cpp

@ -6,7 +6,7 @@
int crypto_sign( int crypto_sign(
unsigned char *sig, 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 const unsigned char* sk, const unsigned char* pk
) )
{ {

Loading…
Cancel
Save