@@ -381,43 +381,6 @@ keystore_error_t keystore_encrypt_and_store_seed(
381381 return KEYSTORE_OK ;
382382}
383383
384- keystore_error_t keystore_create_and_store_seed (
385- const char * password ,
386- const uint8_t * host_entropy ,
387- size_t host_entropy_size )
388- {
389- if (host_entropy_size != 16 && host_entropy_size != 32 ) {
390- return KEYSTORE_ERR_SEED_SIZE ;
391- }
392- if (KEYSTORE_MAX_SEED_LENGTH != RANDOM_NUM_SIZE ) {
393- Abort ("keystore create: size mismatch" );
394- }
395- uint8_t seed [KEYSTORE_MAX_SEED_LENGTH ];
396- UTIL_CLEANUP_32 (seed );
397- random_32_bytes (seed );
398-
399- // Mix in Host entropy.
400- for (size_t i = 0 ; i < host_entropy_size ; i ++ ) {
401- seed [i ] ^= host_entropy [i ];
402- }
403-
404- // Mix in entropy derived from the user password.
405- uint8_t password_salted_hashed [KEYSTORE_MAX_SEED_LENGTH ] = {0 };
406- UTIL_CLEANUP_32 (password_salted_hashed );
407- if (!salt_hash_data (
408- (const uint8_t * )password ,
409- strlen (password ),
410- "keystore_seed_generation" ,
411- password_salted_hashed )) {
412- return KEYSTORE_ERR_SALT ;
413- }
414-
415- for (size_t i = 0 ; i < host_entropy_size ; i ++ ) {
416- seed [i ] ^= password_salted_hashed [i ];
417- }
418- return keystore_encrypt_and_store_seed (seed , host_entropy_size , password );
419- }
420-
421384// Checks if the retained seed matches the passed seed.
422385static bool _check_retained_seed (const uint8_t * seed , size_t seed_length )
423386{
0 commit comments