some more tweaks

This commit is contained in:
cathugger 2017-10-22 11:35:45 +00:00
parent 12b9fd5e40
commit 7281403328
2 changed files with 3 additions and 2 deletions

View File

@ -112,6 +112,7 @@ inline static void ge_initeightpoint() {}
#define ED25519_CUSTOMRANDOM #define ED25519_CUSTOMRANDOM
#define ED25519_CUSTOMHASH #define ED25519_CUSTOMHASH
#include <sodium/crypto_hash_sha512.h> #include <sodium/crypto_hash_sha512.h>
#include <sodium/randombytes.h>
#include "ed25519-donna/ed25519-donna.h" #include "ed25519-donna/ed25519-donna.h"
static int ed25519_seckey_expand(unsigned char *sk,const unsigned char *seed) static int ed25519_seckey_expand(unsigned char *sk,const unsigned char *seed)

4
main.c
View File

@ -817,7 +817,7 @@ end:
return 0; return 0;
} }
static void addu64toscalar32(u8 *dst,u64 v) static void addsztoscalar32(u8 *dst,size_t v)
{ {
int i; int i;
u32 c = 0; u32 c = 0;
@ -897,7 +897,7 @@ initseed:
} }
// found! // found!
// update secret key with counter // update secret key with counter
addu64toscalar32(sk,counter); addsztoscalar32(sk,counter);
// sanity check // sanity check
if (((sk[0] & 248) == sk[0]) && (((sk[31] & 63) | 64) == sk[31])) { if (((sk[0] & 248) == sk[0]) && (((sk[31] & 63) | 64) == sk[31])) {
/* These operations should be a no-op. */ /* These operations should be a no-op. */