test
This commit is contained in:
@@ -962,12 +962,15 @@ uint256 komodo_kvsig(uint8_t *buf,int32_t len,uint256 privkey)
|
||||
|
||||
int32_t komodo_kvsigverify(uint8_t *buf,int32_t len,uint256 pubkey,uint256 sig)
|
||||
{
|
||||
bits256 hash,checksig;
|
||||
vcalc_sha256(0,hash.bytes,buf,len);
|
||||
checksig = curve25519_shared(hash,*(bits256 *)&pubkey);
|
||||
if ( memcmp(&checksig,&sig,sizeof(sig)) != 0 )
|
||||
return(-1);
|
||||
else return(0);
|
||||
bits256 hash,checksig; static uint256 zeroes;
|
||||
if ( memcmp(&pubkey,&zeroes,sizeof(pubkey)) != 0 )
|
||||
{
|
||||
vcalc_sha256(0,hash.bytes,buf,len);
|
||||
checksig = curve25519_shared(hash,*(bits256 *)&pubkey);
|
||||
if ( memcmp(&checksig,&sig,sizeof(sig)) != 0 )
|
||||
return(-1);
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -506,6 +506,7 @@ Value kvupdate(const Array& params, bool fHelp)
|
||||
haveprivkey = 0;
|
||||
memset(&sig,0,sizeof(sig));
|
||||
memset(&privkey,0,sizeof(privkey));
|
||||
memset(&refprivkey,0,sizeof(refpubkey));
|
||||
memset(&pubkey,0,sizeof(pubkey));
|
||||
if ( (n= (int32_t)params.size()) >= 3 )
|
||||
{
|
||||
@@ -544,13 +545,12 @@ Value kvupdate(const Array& params, bool fHelp)
|
||||
ret.push_back(Pair("error",(char *)"cant modify write once key without passphrase"));
|
||||
return ret;
|
||||
}
|
||||
sig = komodo_kvsig(keyvalue,keylen+refvaluesize,privkey);
|
||||
for (i=0; i<32; i++)
|
||||
printf("%02x",((uint8_t *)&sig)[i]);
|
||||
printf(" sig for keylen.%d + valuesize.%d\n",keylen,refvaluesize);
|
||||
}
|
||||
sig = komodo_kvsig(keyvalue,keylen+refvaluesize,privkey);
|
||||
for (i=0; i<32; i++)
|
||||
printf("%02x",((uint8_t *)&sig)[i]);
|
||||
printf(" sig for keylen.%d + valuesize.%d\n",keylen,refvaluesize);
|
||||
}
|
||||
printf("refvaluesize.%d tmpflags.%d\n",refvaluesize,tmpflags);
|
||||
ret.push_back(Pair("coin",(char *)(ASSETCHAINS_SYMBOL[0] == 0 ? "KMD" : ASSETCHAINS_SYMBOL)));
|
||||
height = chainActive.Tip()->nHeight;
|
||||
if ( memcmp(&zeroes,&refpubkey,sizeof(refpubkey)) != 0 )
|
||||
|
||||
Reference in New Issue
Block a user