client/profile.c
int gen_profile(struct profile *data) {
	if(cs_rand(data->salt, 32) != 0) {
		return -1;
	}
	data->nonce = 0;
	data->server_accounts = NULL;

	uint8_t scrypt_out[96];

	if(scrypt(data->pass, strlen(data->pass), data->salt, 32,
		(uint64_t)1 << 16, 8, 1, 96, scrypt_out) != 0) {
		return -1;
	}

	memcpy(data->pw_check, &scrypt_out[ 0], 32);
	memcpy(data->symm_key, &scrypt_out[32], 32);
	memcpy(data->hmac_key, &scrypt_out[64], 32);

	memset(scrypt_out, 0, 96);

	return 0;
}
/* data->pass should be prepopulated with a null terminated password */
data->pass should be prepopulated with a null terminated password
data - > pass should be prepopulated with a null terminated password
int gen_profile(struct profile *data) {
	if(cs_rand(data->salt, 32) != 0) {
		return -1;
	}
	data->nonce = 0;
	data->server_accounts = NULL;
	uint8_t scrypt_out[96];
	if(scrypt(data->pass, strlen(data->pass), data->salt, 32,
		(uint64_t)1 << 16, 8, 1, 96, scrypt_out) != 0) {
		return -1;
	}
	memcpy(data->pw_check, &scrypt_out[ 0], 32);
	memcpy(data->symm_key, &scrypt_out[32], 32);
	memcpy(data->hmac_key, &scrypt_out[64], 32);
	memset(scrypt_out, 0, 96);
	return 0;
}
int gen_profile ( struct profile * data ) { if ( cs_rand ( data -> salt , 32 ) != 0 ) { return -1 ; } data -> nonce = 0 ; data -> server_accounts = NULL ; uint8_t scrypt_out [ 96 ] ; if ( scrypt ( data -> pass , strlen ( data -> pass ) , data -> salt , 32 , ( uint64_t ) 1 << 16 , 8 , 1 , 96 , scrypt_out ) != 0 ) { return -1 ; } memcpy ( data -> pw_check , & scrypt_out [ 0 ] , 32 ) ; memcpy ( data -> symm_key , & scrypt_out [ 32 ] , 32 ) ; memcpy ( data -> hmac_key , & scrypt_out [ 64 ] , 32 ) ; memset ( scrypt_out , 0 , 96 ) ; return 0 ; }
data->pass should be prepopulated with a null terminated password
data - > pass should be prepopulated with a null terminated password