src/treesutil.c
/**
 * creates nonce, salt, and then uses password to create
 * secret key and encrypt privatekey
 */
creates nonce, salt, and then uses password to create
secret key and encrypt privatekey
creates nonce salt and then uses password to create secret key and encrypt privatekey
static void
gensecrets(user_t *user, char *password)
{
    randombytes_buf(user->nonce, sizeof user->nonce);
    randombytes_buf(user->salt, sizeof user->salt);
    if(crypto_pwhash(user->secretkey, sizeof user->secretkey,
                     password, strlen(password), user->salt,
                     crypto_pwhash_OPSLIMIT_INTERACTIVE,
                     crypto_pwhash_MEMLIMIT_INTERACTIVE,
                     crypto_pwhash_ALG_ARGON2ID13) != 0) {
        die(false, "key derivation fails for password");
    }
    if(VERBOSE) {
        fprintf(stderr, "Secret key: ");
        print_debug_hex(user->secretkey, sizeof user->secretkey);
    }
    crypto_secretbox_easy(user->locked, user->privkey, sizeof user->privkey,
                          user->nonce, user->secretkey);
}
static void gensecrets ( user_t * user , char * password ) { randombytes_buf ( user -> nonce , sizeof user -> nonce ) ; randombytes_buf ( user -> salt , sizeof user -> salt ) ; if ( crypto_pwhash ( user -> secretkey , sizeof user -> secretkey , password , strlen ( password ) , user -> salt , crypto_pwhash_OPSLIMIT_INTERACTIVE , crypto_pwhash_MEMLIMIT_INTERACTIVE , crypto_pwhash_ALG_ARGON2ID13 ) != 0 ) { die ( false , " " ) ; } if ( VERBOSE ) { fprintf ( stderr , " " ) ; print_debug_hex ( user -> secretkey , sizeof user -> secretkey ) ; } crypto_secretbox_easy ( user -> locked , user -> privkey , sizeof user -> privkey , user -> nonce , user -> secretkey ) ; }
creates nonce, salt, and then uses password to create
 secret key and encrypt privatekey
creates nonce salt and then uses password to create secret key and encrypt privatekey