adjust ./configure format, change ed sign/verify to msg from hash

This commit is contained in:
toddouska
2015-03-19 12:48:32 -07:00
parent d89d524570
commit 478a8bb059
5 changed files with 23 additions and 23 deletions

View File

@ -653,7 +653,7 @@ AM_CONDITIONAL([BUILD_ECC25519], [test "x$ENABLED_ECC25519" = "xyes"])
# ED25519
AC_ARG_ENABLE([ed25519],
[ AS_HELP_STRING(--enable-ed25519 Enable ED25519 (default: disabled))],
[AS_HELP_STRING([--enable-ed25519],[Enable ED25519 (default: disabled)])],
[ ENABLED_ED25519=$enableval ],
[ ENABLED_ED25519=no ]
)

View File

@ -1773,7 +1773,7 @@ void bench_ed25519KeySign(void)
for(i = 0; i < agreeTimes; i++) {
x = sizeof(sig);
ret = wc_ed25519_sign_hash(digest, sizeof(digest), sig, &x, &genKey);
ret = wc_ed25519_sign_msg(digest, sizeof(digest), sig, &x, &genKey);
if (ret != 0) {
printf("ed25519_sign_hash failed\n");
return;
@ -1790,7 +1790,8 @@ void bench_ed25519KeySign(void)
for(i = 0; i < agreeTimes; i++) {
int verify = 0;
ret = wc_ed25519_verify_hash(sig, x, digest, sizeof(digest), &verify, &genKey);
ret = wc_ed25519_verify_msg(sig, x, digest, sizeof(digest), &verify,
&genKey);
if (ret != 0 || verify != 1) {
printf("ed25519_verify_hash failed\n");
return;

View File

@ -710,8 +710,8 @@ int wc_ed25519_make_key(RNG* rng, int keySz, ed25519_key* key)
key is the ed25519 key to use when signing
return 0 on success
*/
int wc_ed25519_sign_hash(const byte* in, word32 inlen, byte* out,
word32 *outlen, ed25519_key* key)
int wc_ed25519_sign_msg(const byte* in, word32 inlen, byte* out,
word32 *outlen, ed25519_key* key)
{
int ret = 0;
byte nonce[64];
@ -761,12 +761,12 @@ int wc_ed25519_sign_hash(const byte* in, word32 inlen, byte* out,
/*
sig is array of bytes containing the signature
siglen is the length of sig byte array
hash the array of bytes containing the message
hashlen length of hash array
msg the array of bytes containing the message
msglen length of msg array
stat will be 1 on successful verify and 0 on unsuccessful
*/
int wc_ed25519_verify_hash(byte* sig, word32 siglen, const byte* hash,
word32 hashlen, int* stat, ed25519_key* key)
int wc_ed25519_verify_msg(byte* sig, word32 siglen, const byte* msg,
word32 msglen, int* stat, ed25519_key* key)
{
int ret;
word32 sigSz;
@ -777,7 +777,7 @@ int wc_ed25519_verify_hash(byte* sig, word32 siglen, const byte* hash,
ge_p2 R;
/* sanity check on arguments */
if (sig == NULL || hash == NULL || stat == NULL || key == NULL)
if (sig == NULL || msg == NULL || stat == NULL || key == NULL)
return BAD_FUNC_ARG;
ret = 0;
@ -796,7 +796,7 @@ int wc_ed25519_verify_hash(byte* sig, word32 siglen, const byte* hash,
ret |= wc_InitSha512(&sha);
ret |= wc_Sha512Update(&sha, sig, 32);
ret |= wc_Sha512Update(&sha, key->p, 32);
ret |= wc_Sha512Update(&sha, hash, hashlen);
ret |= wc_Sha512Update(&sha, msg, msglen);
ret |= wc_Sha512Final(&sha, h);
sc_reduce(h);
@ -818,7 +818,7 @@ int wc_ed25519_init(ed25519_key* key)
if (key == NULL)
return BAD_FUNC_ARG;
ForceZero(key, sizeof(ed25519_key));
XMEMSET(key, 0, sizeof(ed25519_key));
return 0;
}

View File

@ -5691,7 +5691,7 @@ int ed25519_test(void)
pKeySz[i], &key) != 0)
return -1021;
if (wc_ed25519_sign_hash(msgs[i], msgSz[i], out, &outlen, &key)
if (wc_ed25519_sign_msg(msgs[i], msgSz[i], out, &outlen, &key)
!= 0)
return -1022;
@ -5699,13 +5699,13 @@ int ed25519_test(void)
return -1023;
/* test verify on good msg */
if (wc_ed25519_verify_hash(out, outlen, msgs[i], msgSz[i], &verify,
if (wc_ed25519_verify_msg(out, outlen, msgs[i], msgSz[i], &verify,
&key) != 0 || verify != 1)
return -1024;
/* test verify on bad msg */
out[outlen-1] = out[outlen-1] + 1;
if (wc_ed25519_verify_hash(out, outlen, msgs[i], msgSz[i], &verify,
if (wc_ed25519_verify_msg(out, outlen, msgs[i], msgSz[i], &verify,
&key) == 0 || verify == 1)
return -1025;
@ -5728,12 +5728,11 @@ int ed25519_test(void)
/* clear "out" buffer and test sign with imported keys */
outlen = sizeof(out);
XMEMSET(out, 0, sizeof(out));
if (wc_ed25519_sign_hash(msgs[i], msgSz[i], out, &outlen, &key2)
!= 0)
if (wc_ed25519_sign_msg(msgs[i], msgSz[i], out, &outlen, &key2) != 0)
return -1030;
if (wc_ed25519_verify_hash(out, outlen, msgs[i], msgSz[i], &verify,
&key2) != 0 || verify != 1)
if (wc_ed25519_verify_msg(out, outlen, msgs[i], msgSz[i], &verify,
&key2) != 0 || verify != 1)
return -1031;
if (XMEMCMP(out, sigs[i], 64))

View File

@ -60,11 +60,11 @@ typedef struct {
WOLFSSL_API
int wc_ed25519_make_key(RNG* rng, int keysize, ed25519_key* key);
WOLFSSL_API
int wc_ed25519_sign_hash(const byte* in, word32 inlen, byte* out,
word32 *outlen, ed25519_key* key);
int wc_ed25519_sign_msg(const byte* in, word32 inlen, byte* out,
word32 *outlen, ed25519_key* key);
WOLFSSL_API
int wc_ed25519_verify_hash(byte* sig, word32 siglen, const byte* hash,
word32 hashlen, int* stat, ed25519_key* key);
int wc_ed25519_verify_msg(byte* sig, word32 siglen, const byte* msg,
word32 msglen, int* stat, ed25519_key* key);
WOLFSSL_API
int wc_ed25519_init(ed25519_key* key);
WOLFSSL_API