Wrap up error handling overhaul.
This commit is contained in:
@@ -61,7 +61,7 @@ static MPMasterKey mpw_masterKeyForUser_v0(const char *fullName, const char *mas
|
||||
mpw_push_int( &masterKeySalt, &masterKeySaltSize, htonl( mpw_utf8_strlen( fullName ) ) );
|
||||
mpw_push_string( &masterKeySalt, &masterKeySaltSize, fullName );
|
||||
if (!masterKeySalt) {
|
||||
ftl( "Could not allocate master key salt: %s\n", strerror( errno ) );
|
||||
err( "Could not allocate master key salt: %s\n", strerror( errno ) );
|
||||
return NULL;
|
||||
}
|
||||
trc( "masterKeySalt ID: %s\n", mpw_id_buf( masterKeySalt, masterKeySaltSize ) );
|
||||
@@ -71,7 +71,7 @@ static MPMasterKey mpw_masterKeyForUser_v0(const char *fullName, const char *mas
|
||||
const uint8_t *masterKey = mpw_scrypt( MPMasterKeySize, masterPassword, masterKeySalt, masterKeySaltSize, MP_N, MP_r, MP_p );
|
||||
mpw_free( masterKeySalt, masterKeySaltSize );
|
||||
if (!masterKey) {
|
||||
ftl( "Could not allocate master key: %s\n", strerror( errno ) );
|
||||
err( "Could not allocate master key: %s\n", strerror( errno ) );
|
||||
return NULL;
|
||||
}
|
||||
trc( "masterKey ID: %s\n", mpw_id_buf( masterKey, MPMasterKeySize ) );
|
||||
@@ -107,7 +107,7 @@ static MPSiteKey mpw_siteKey_v0(
|
||||
mpw_push_string( &siteSalt, &siteSaltSize, keyContext );
|
||||
}
|
||||
if (!siteSalt || !siteSaltSize) {
|
||||
ftl( "Could not allocate site salt: %s\n", strerror( errno ) );
|
||||
err( "Could not allocate site salt: %s\n", strerror( errno ) );
|
||||
mpw_free( siteSalt, siteSaltSize );
|
||||
return NULL;
|
||||
}
|
||||
@@ -116,7 +116,7 @@ static MPSiteKey mpw_siteKey_v0(
|
||||
MPSiteKey siteKey = mpw_hmac_sha256( masterKey, MPMasterKeySize, siteSalt, siteSaltSize );
|
||||
mpw_free( siteSalt, siteSaltSize );
|
||||
if (!siteKey) {
|
||||
ftl( "Could not allocate site key: %s\n", strerror( errno ) );
|
||||
err( "Could not allocate site key: %s\n", strerror( errno ) );
|
||||
return NULL;
|
||||
}
|
||||
trc( "siteKey ID: %s\n", mpw_id_buf( siteKey, MPSiteKeySize ) );
|
||||
@@ -137,7 +137,7 @@ static const char *mpw_sitePassword_v0(
|
||||
if (!template)
|
||||
return NULL;
|
||||
if (strlen( template ) > MPSiteKeySize) {
|
||||
ftl( "Template too long for password seed: %lu", strlen( template ) );
|
||||
err( "Template too long for password seed: %lu\n", strlen( template ) );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user