2
0

Prefix versions with V to fix a Swift enum naming import issue.

This commit is contained in:
Maarten Billemont 2019-10-10 11:48:35 -04:00
parent 2af71fbc34
commit aec5e371b8
7 changed files with 37 additions and 37 deletions

View File

@ -50,7 +50,7 @@ static NSOperationQueue *_mpwQueue = nil;
- (MPAlgorithmVersion)version { - (MPAlgorithmVersion)version {
return MPAlgorithmVersion0; return MPAlgorithmVersionV0;
} }
- (NSString *)description { - (NSString *)description {

View File

@ -23,7 +23,7 @@
- (MPAlgorithmVersion)version { - (MPAlgorithmVersion)version {
return MPAlgorithmVersion1; return MPAlgorithmVersionV1;
} }
- (BOOL)tryMigrateSite:(MPSiteEntity *)site explicit:(BOOL)explicit { - (BOOL)tryMigrateSite:(MPSiteEntity *)site explicit:(BOOL)explicit {

View File

@ -23,7 +23,7 @@
- (MPAlgorithmVersion)version { - (MPAlgorithmVersion)version {
return MPAlgorithmVersion2; return MPAlgorithmVersionV2;
} }
- (BOOL)tryMigrateSite:(MPSiteEntity *)site explicit:(BOOL)explicit { - (BOOL)tryMigrateSite:(MPSiteEntity *)site explicit:(BOOL)explicit {

View File

@ -23,7 +23,7 @@
- (MPAlgorithmVersion)version { - (MPAlgorithmVersion)version {
return MPAlgorithmVersion3; return MPAlgorithmVersionV3;
} }
- (BOOL)tryMigrateSite:(MPSiteEntity *)site explicit:(BOOL)explicit { - (BOOL)tryMigrateSite:(MPSiteEntity *)site explicit:(BOOL)explicit {

View File

@ -136,7 +136,7 @@
return MPAlgorithmForVersion( return MPAlgorithmForVersion(
MIN( MPAlgorithmVersionCurrent, MIN( MPAlgorithmVersionCurrent,
MAX( MPAlgorithmVersion0, (MPAlgorithmVersion)[self.version_ unsignedIntegerValue] ) ) ); MAX( MPAlgorithmVersionV0, (MPAlgorithmVersion)[self.version_ unsignedIntegerValue] ) ) );
} }
- (void)setAlgorithm:(id<MPAlgorithm>)algorithm { - (void)setAlgorithm:(id<MPAlgorithm>)algorithm {
@ -368,7 +368,7 @@
return MPAlgorithmForVersion( return MPAlgorithmForVersion(
MIN( MPAlgorithmVersionCurrent, MIN( MPAlgorithmVersionCurrent,
MAX( MPAlgorithmVersion0, (MPAlgorithmVersion)[self.version_ unsignedIntegerValue] ) ) ); MAX( MPAlgorithmVersionV0, (MPAlgorithmVersion)[self.version_ unsignedIntegerValue] ) ) );
} }
- (void)setAlgorithm:(id<MPAlgorithm>)version { - (void)setAlgorithm:(id<MPAlgorithm>)version {

View File

@ -47,13 +47,13 @@ const MPMasterKey mpw_master_key(const char *fullName, const char *masterPasswor
} }
switch (algorithmVersion) { switch (algorithmVersion) {
case MPAlgorithmVersion0: case MPAlgorithmVersionV0:
return mpw_master_key_v0( fullName, masterPassword ); return mpw_master_key_v0( fullName, masterPassword );
case MPAlgorithmVersion1: case MPAlgorithmVersionV1:
return mpw_master_key_v1( fullName, masterPassword ); return mpw_master_key_v1( fullName, masterPassword );
case MPAlgorithmVersion2: case MPAlgorithmVersionV2:
return mpw_master_key_v2( fullName, masterPassword ); return mpw_master_key_v2( fullName, masterPassword );
case MPAlgorithmVersion3: case MPAlgorithmVersionV3:
return mpw_master_key_v3( fullName, masterPassword ); return mpw_master_key_v3( fullName, masterPassword );
default: default:
err( "Unsupported version: %d", algorithmVersion ); err( "Unsupported version: %d", algorithmVersion );
@ -83,13 +83,13 @@ const MPSiteKey mpw_site_key(
} }
switch (algorithmVersion) { switch (algorithmVersion) {
case MPAlgorithmVersion0: case MPAlgorithmVersionV0:
return mpw_site_key_v0( masterKey, siteName, siteCounter, keyPurpose, keyContext ); return mpw_site_key_v0( masterKey, siteName, siteCounter, keyPurpose, keyContext );
case MPAlgorithmVersion1: case MPAlgorithmVersionV1:
return mpw_site_key_v1( masterKey, siteName, siteCounter, keyPurpose, keyContext ); return mpw_site_key_v1( masterKey, siteName, siteCounter, keyPurpose, keyContext );
case MPAlgorithmVersion2: case MPAlgorithmVersionV2:
return mpw_site_key_v2( masterKey, siteName, siteCounter, keyPurpose, keyContext ); return mpw_site_key_v2( masterKey, siteName, siteCounter, keyPurpose, keyContext );
case MPAlgorithmVersion3: case MPAlgorithmVersionV3:
return mpw_site_key_v3( masterKey, siteName, siteCounter, keyPurpose, keyContext ); return mpw_site_key_v3( masterKey, siteName, siteCounter, keyPurpose, keyContext );
default: default:
err( "Unsupported version: %d", algorithmVersion ); err( "Unsupported version: %d", algorithmVersion );
@ -125,13 +125,13 @@ const char *mpw_site_result(
char *sitePassword = NULL; char *sitePassword = NULL;
if (resultType & MPResultTypeClassTemplate) { if (resultType & MPResultTypeClassTemplate) {
switch (algorithmVersion) { switch (algorithmVersion) {
case MPAlgorithmVersion0: case MPAlgorithmVersionV0:
return mpw_site_template_password_v0( masterKey, siteKey, resultType, resultParam ); return mpw_site_template_password_v0( masterKey, siteKey, resultType, resultParam );
case MPAlgorithmVersion1: case MPAlgorithmVersionV1:
return mpw_site_template_password_v1( masterKey, siteKey, resultType, resultParam ); return mpw_site_template_password_v1( masterKey, siteKey, resultType, resultParam );
case MPAlgorithmVersion2: case MPAlgorithmVersionV2:
return mpw_site_template_password_v2( masterKey, siteKey, resultType, resultParam ); return mpw_site_template_password_v2( masterKey, siteKey, resultType, resultParam );
case MPAlgorithmVersion3: case MPAlgorithmVersionV3:
return mpw_site_template_password_v3( masterKey, siteKey, resultType, resultParam ); return mpw_site_template_password_v3( masterKey, siteKey, resultType, resultParam );
default: default:
err( "Unsupported version: %d", algorithmVersion ); err( "Unsupported version: %d", algorithmVersion );
@ -140,13 +140,13 @@ const char *mpw_site_result(
} }
else if (resultType & MPResultTypeClassStateful) { else if (resultType & MPResultTypeClassStateful) {
switch (algorithmVersion) { switch (algorithmVersion) {
case MPAlgorithmVersion0: case MPAlgorithmVersionV0:
return mpw_site_crypted_password_v0( masterKey, siteKey, resultType, resultParam ); return mpw_site_crypted_password_v0( masterKey, siteKey, resultType, resultParam );
case MPAlgorithmVersion1: case MPAlgorithmVersionV1:
return mpw_site_crypted_password_v1( masterKey, siteKey, resultType, resultParam ); return mpw_site_crypted_password_v1( masterKey, siteKey, resultType, resultParam );
case MPAlgorithmVersion2: case MPAlgorithmVersionV2:
return mpw_site_crypted_password_v2( masterKey, siteKey, resultType, resultParam ); return mpw_site_crypted_password_v2( masterKey, siteKey, resultType, resultParam );
case MPAlgorithmVersion3: case MPAlgorithmVersionV3:
return mpw_site_crypted_password_v3( masterKey, siteKey, resultType, resultParam ); return mpw_site_crypted_password_v3( masterKey, siteKey, resultType, resultParam );
default: default:
err( "Unsupported version: %d", algorithmVersion ); err( "Unsupported version: %d", algorithmVersion );
@ -155,13 +155,13 @@ const char *mpw_site_result(
} }
else if (resultType & MPResultTypeClassDerive) { else if (resultType & MPResultTypeClassDerive) {
switch (algorithmVersion) { switch (algorithmVersion) {
case MPAlgorithmVersion0: case MPAlgorithmVersionV0:
return mpw_site_derived_password_v0( masterKey, siteKey, resultType, resultParam ); return mpw_site_derived_password_v0( masterKey, siteKey, resultType, resultParam );
case MPAlgorithmVersion1: case MPAlgorithmVersionV1:
return mpw_site_derived_password_v1( masterKey, siteKey, resultType, resultParam ); return mpw_site_derived_password_v1( masterKey, siteKey, resultType, resultParam );
case MPAlgorithmVersion2: case MPAlgorithmVersionV2:
return mpw_site_derived_password_v2( masterKey, siteKey, resultType, resultParam ); return mpw_site_derived_password_v2( masterKey, siteKey, resultType, resultParam );
case MPAlgorithmVersion3: case MPAlgorithmVersionV3:
return mpw_site_derived_password_v3( masterKey, siteKey, resultType, resultParam ); return mpw_site_derived_password_v3( masterKey, siteKey, resultType, resultParam );
default: default:
err( "Unsupported version: %d", algorithmVersion ); err( "Unsupported version: %d", algorithmVersion );
@ -205,13 +205,13 @@ const char *mpw_site_state(
} }
switch (algorithmVersion) { switch (algorithmVersion) {
case MPAlgorithmVersion0: case MPAlgorithmVersionV0:
return mpw_site_state_v0( masterKey, siteKey, resultType, resultParam ); return mpw_site_state_v0( masterKey, siteKey, resultType, resultParam );
case MPAlgorithmVersion1: case MPAlgorithmVersionV1:
return mpw_site_state_v1( masterKey, siteKey, resultType, resultParam ); return mpw_site_state_v1( masterKey, siteKey, resultType, resultParam );
case MPAlgorithmVersion2: case MPAlgorithmVersionV2:
return mpw_site_state_v2( masterKey, siteKey, resultType, resultParam ); return mpw_site_state_v2( masterKey, siteKey, resultType, resultParam );
case MPAlgorithmVersion3: case MPAlgorithmVersionV3:
return mpw_site_state_v3( masterKey, siteKey, resultType, resultParam ); return mpw_site_state_v3( masterKey, siteKey, resultType, resultParam );
default: default:
err( "Unsupported version: %d", algorithmVersion ); err( "Unsupported version: %d", algorithmVersion );

View File

@ -23,17 +23,17 @@
typedef mpw_enum( unsigned int, MPAlgorithmVersion ) { typedef mpw_enum( unsigned int, MPAlgorithmVersion ) {
/** V0 did math with chars whose signedness was platform-dependent. */ /** V0 did math with chars whose signedness was platform-dependent. */
MPAlgorithmVersion0, MPAlgorithmVersionV0,
/** V1 miscounted the byte-length of multi-byte site names. */ /** V1 miscounted the byte-length of multi-byte site names. */
MPAlgorithmVersion1, MPAlgorithmVersionV1,
/** V2 miscounted the byte-length of multi-byte user names. */ /** V2 miscounted the byte-length of multi-byte user names. */
MPAlgorithmVersion2, MPAlgorithmVersionV2,
/** V3 is the current version. */ /** V3 is the current version. */
MPAlgorithmVersion3, MPAlgorithmVersionV3,
MPAlgorithmVersionCurrent = MPAlgorithmVersion3, MPAlgorithmVersionCurrent = MPAlgorithmVersionV3,
MPAlgorithmVersionFirst = MPAlgorithmVersion0, MPAlgorithmVersionFirst = MPAlgorithmVersionV0,
MPAlgorithmVersionLast = MPAlgorithmVersion3, MPAlgorithmVersionLast = MPAlgorithmVersionV3,
}; };
/** Derive the master key for a user based on their name and master password. /** Derive the master key for a user based on their name and master password.