fixed scrypt() call and pbp pk export signature

This commit is contained in:
git@daemon.de
2014-02-03 12:19:17 +01:00
parent 71013ac03d
commit 777fa01c74
7 changed files with 42 additions and 28 deletions

View File

@@ -246,7 +246,6 @@ pcp_pubkey_t *pcp_ed_verify_buffered(FILE *in, pcp_pubkey_t *p) {
}
// else: if unarmored, sighash is already filled
// huh, how did we made it til here?
unsigned char *verifiedhash = NULL;
if(p == NULL) {

View File

@@ -25,7 +25,7 @@
/*
* AS of 16/01/2014 I'm using scrypt() instead of my crafted key
* derivation function. However, I create a hash from the pcp_script()
* derivation function. However, I create a hash from the pcp_scrypt()
* result anyway because I need a cure25519 secret.
*/
unsigned char *pcp_derivekey(char *passphrase, unsigned char *nonce) {
@@ -33,7 +33,7 @@ unsigned char *pcp_derivekey(char *passphrase, unsigned char *nonce) {
size_t plen = strnlen(passphrase, 255);
// create the scrypt hash
unsigned char *scrypted = pcp_scrypt(passphrase, plen, nonce);
unsigned char *scrypted = pcp_scrypt(passphrase, plen, nonce, crypto_secretbox_NONCEBYTES);
// make a hash from the scrypt() result
crypto_hash_sha256(key, (unsigned char*)scrypted, 64);

View File

@@ -21,7 +21,7 @@
#include "scrypt.h"
unsigned char* pcp_scrypt(char *passwd, size_t passwdlen, unsigned char *nonce) {
unsigned char* pcp_scrypt(char *passwd, size_t passwdlen, unsigned char *nonce, size_t noncelen) {
uint8_t *dk = ucmalloc(64); // resulting hash
// constants
@@ -30,7 +30,7 @@ unsigned char* pcp_scrypt(char *passwd, size_t passwdlen, unsigned char *nonce)
uint32_t p = 1;
size_t buflen = 64;
if (crypto_scrypt(passwd, passwdlen, (uint8_t *)nonce, crypto_secretbox_NONCEBYTES, N, r, p, dk, buflen) == 0) {
if (crypto_scrypt(passwd, passwdlen, (uint8_t *)nonce, noncelen, N, r, p, dk, buflen) == 0) {
return dk;
}
else {