2
0

WIP performing marshalling of sites in C.

This commit is contained in:
Maarten Billemont
2017-07-15 21:13:49 -04:00
parent 738ad197b2
commit 560cb1a266
25 changed files with 1224 additions and 308 deletions

View File

@@ -65,13 +65,11 @@ int main(int argc, char *const argv[]) {
uint8_t *sitePasswordInfo = malloc( 128 );
iterations = 3000000;
masterKey = mpw_masterKeyForUser( fullName, masterPassword, MPAlgorithmVersionCurrent );
if (!masterKey) {
if (!masterKey)
ftl( "Could not allocate master key: %d\n", errno );
abort();
}
mpw_getTime( &startTime );
for (int i = 1; i <= iterations; ++i) {
free( (void *)mpw_hmac_sha256( masterKey, MP_dkLen, sitePasswordInfo, 128 ) );
free( (void *)mpw_hmac_sha256( masterKey, MPMasterKeySize, sitePasswordInfo, 128 ) );
if (modff(100.f * i / iterations, &percent) == 0)
fprintf( stderr, "\rhmac-sha-256: iteration %d / %d (%.0f%%)..", i, iterations, percent );
@@ -110,10 +108,8 @@ int main(int argc, char *const argv[]) {
mpw_getTime( &startTime );
for (int i = 1; i <= iterations; ++i) {
masterKey = mpw_masterKeyForUser( fullName, masterPassword, MPAlgorithmVersionCurrent );
if (!masterKey) {
if (!masterKey)
ftl( "Could not allocate master key: %d\n", errno );
abort();
}
free( (void *)mpw_passwordForSite(
masterKey, siteName, siteType, siteCounter, siteVariant, siteContext, MPAlgorithmVersionCurrent ) );