2
0

More standard way to separate algorithm versions.

This commit is contained in:
Maarten Billemont 2019-09-27 22:38:32 -04:00
parent ff9a5eaf04
commit a2b1f22b53
12 changed files with 269 additions and 75 deletions

View File

@ -158,6 +158,10 @@
DA32D07C19D7D784004F3F0E /* background.png in Resources */ = {isa = PBXBuildFile; fileRef = DA32D07919D7D784004F3F0E /* background.png */; };
DA3509FE15F101A500C14A8E /* PearlQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = DA3509FC15F101A500C14A8E /* PearlQueue.h */; };
DA3509FF15F101A500C14A8E /* PearlQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = DA3509FD15F101A500C14A8E /* PearlQueue.m */; };
DA35148A233EF93400BCF504 /* mpw-algorithm_v0.c in Sources */ = {isa = PBXBuildFile; fileRef = 93D390A99850139D0FF0211E /* mpw-algorithm_v0.c */; };
DA35148B233EF93400BCF504 /* mpw-algorithm_v1.c in Sources */ = {isa = PBXBuildFile; fileRef = 93D396F918E6470DB846C17F /* mpw-algorithm_v1.c */; };
DA35148C233EF93400BCF504 /* mpw-algorithm_v2.c in Sources */ = {isa = PBXBuildFile; fileRef = 93D390A3B351FEF1B9EDAB56 /* mpw-algorithm_v2.c */; };
DA35148D233EF93400BCF504 /* mpw-algorithm_v3.c in Sources */ = {isa = PBXBuildFile; fileRef = 93D39D4E713564B7654341B0 /* mpw-algorithm_v3.c */; };
DA3BCFCB19BD09D5006B2681 /* SourceCodePro-Regular.otf in Resources */ = {isa = PBXBuildFile; fileRef = DA3BCFCA19BD09D5006B2681 /* SourceCodePro-Regular.otf */; };
DA4522441902355C008F650A /* icon_book.png in Resources */ = {isa = PBXBuildFile; fileRef = DABD370C1711E29500CF925C /* icon_book.png */; };
DA4522451902355C008F650A /* icon_book@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DABD370D1711E29500CF925C /* icon_book@2x.png */; };
@ -732,6 +736,10 @@
DA3509FC15F101A500C14A8E /* PearlQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PearlQueue.h; sourceTree = "<group>"; };
DA3509FD15F101A500C14A8E /* PearlQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PearlQueue.m; sourceTree = "<group>"; };
DA3B844D190FC5DF00246EEA /* Crashlytics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Crashlytics.framework; path = ../../../External/iOS/Crashlytics.framework; sourceTree = "<group>"; };
DA351486233EF8FE00BCF504 /* mpw-algorithm_v2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "mpw-algorithm_v2.h"; sourceTree = "<group>"; };
DA351487233EF8FE00BCF504 /* mpw-algorithm_v1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "mpw-algorithm_v1.h"; sourceTree = "<group>"; };
DA351488233EF8FE00BCF504 /* mpw-algorithm_v3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "mpw-algorithm_v3.h"; sourceTree = "<group>"; };
DA351489233EF8FE00BCF504 /* mpw-algorithm_v0.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "mpw-algorithm_v0.h"; sourceTree = "<group>"; };
DA3BCFCA19BD09D5006B2681 /* SourceCodePro-Regular.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SourceCodePro-Regular.otf"; sourceTree = "<group>"; };
DA45711B1F572F1E00D54152 /* PearlCryptUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PearlCryptUtils.m; sourceTree = "<group>"; };
DA45711C1F572F1E00D54152 /* PearlCryptUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PearlCryptUtils.h; sourceTree = "<group>"; };
@ -1770,9 +1778,13 @@
DA5B0B3E1F36469400B663F0 /* base64.c */,
DA5B0B3F1F36469400B663F0 /* base64.h */,
93D390A99850139D0FF0211E /* mpw-algorithm_v0.c */,
DA351489233EF8FE00BCF504 /* mpw-algorithm_v0.h */,
93D396F918E6470DB846C17F /* mpw-algorithm_v1.c */,
DA351487233EF8FE00BCF504 /* mpw-algorithm_v1.h */,
93D390A3B351FEF1B9EDAB56 /* mpw-algorithm_v2.c */,
DA351486233EF8FE00BCF504 /* mpw-algorithm_v2.h */,
93D39D4E713564B7654341B0 /* mpw-algorithm_v3.c */,
DA351488233EF8FE00BCF504 /* mpw-algorithm_v3.h */,
93D3969393A3A46BD27D7078 /* mpw-algorithm.c */,
93D3990D850D76A94C6B7A4D /* mpw-algorithm.h */,
DAB7AE981F3DDEE000C856B1 /* mpw-marshal-util.c */,
@ -1949,11 +1961,11 @@
isa = PBXGroup;
children = (
93D39A2239FFFE6BEC83E191 /* core */,
DABD3B9F1711E2DB00CF925C /* Source */,
DACA23B41705DF7D002C6C22 /* Resources */,
DACA22121705DDC5002C6C22 /* External */,
DA5BFA47147E415C00F98B1E /* Frameworks */,
DA5BFA45147E415C00F98B1E /* Products */,
DACA23B41705DF7D002C6C22 /* Resources */,
DABD3B9F1711E2DB00CF925C /* Source */,
);
sourceTree = "<group>";
};
@ -4008,6 +4020,7 @@
93D396D8B67DA6522CDBA142 /* MPCoachmarkViewController.m in Sources */,
DAADBFE01A68763B00F7A756 /* mpw-algorithm.c in Sources */,
DA0CC54E1EB6AD0E009A8ED9 /* MasterPassword.xcdatamodeld in Sources */,
DA35148D233EF93400BCF504 /* mpw-algorithm_v3.c in Sources */,
DAB07C9D1F7725C500CC6D43 /* aes.c in Sources */,
93D39EAA4D064193074D3021 /* MPFixable.m in Sources */,
93D394982CBD25D46692DD7C /* MPWebViewController.m in Sources */,
@ -4021,6 +4034,9 @@
93D395B715D15F2B56F2A2EE /* mpw-types.c in Sources */,
93D39943D01E70DAC3B0DF76 /* mpw-util.c in Sources */,
DA5B0B401F36469400B663F0 /* base64.c in Sources */,
DA35148B233EF93400BCF504 /* mpw-algorithm_v1.c in Sources */,
DA35148A233EF93400BCF504 /* mpw-algorithm_v0.c in Sources */,
DA35148C233EF93400BCF504 /* mpw-algorithm_v2.c in Sources */,
93D39577FD8BB0945DB2F0A3 /* MPAlgorithmV3.m in Sources */,
93D39E5F7F6D7F5C0FAD090F /* MPTypes.m in Sources */,
DA0CC58C1EB6B030009A8ED9 /* MPGeneratedSiteEntity+CoreDataClass.m in Sources */,

View File

@ -28,8 +28,6 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
@ -39,8 +37,8 @@
ReferencedContainer = "container:MasterPassword-iOS.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"

View File

@ -68,6 +68,22 @@
DA3509FE15F101A500C14A8E /* PearlQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = DA3509FC15F101A500C14A8E /* PearlQueue.h */; };
DA3509FF15F101A500C14A8E /* PearlQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = DA3509FD15F101A500C14A8E /* PearlQueue.m */; };
DA3B844F190FC60900246EEA /* Crashlytics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA3B844A190FC5A900246EEA /* Crashlytics.framework */; };
DA35148E233EF93E00BCF504 /* mpw-algorithm_v0.c in Sources */ = {isa = PBXBuildFile; fileRef = DA831A271A6E1146000AC234 /* mpw-algorithm_v0.c */; };
DA35148F233EF93E00BCF504 /* mpw-algorithm_v1.c in Sources */ = {isa = PBXBuildFile; fileRef = DA831A281A6E1146000AC234 /* mpw-algorithm_v1.c */; };
DA351490233EF93E00BCF504 /* mpw-algorithm_v2.c in Sources */ = {isa = PBXBuildFile; fileRef = DA831A291A6E1146000AC234 /* mpw-algorithm_v2.c */; };
DA351491233EF93E00BCF504 /* mpw-algorithm_v3.c in Sources */ = {isa = PBXBuildFile; fileRef = DA831A2A1A6E1146000AC234 /* mpw-algorithm_v3.c */; };
DA351492233EF94300BCF504 /* mpw-algorithm_v0.c in Sources */ = {isa = PBXBuildFile; fileRef = DA831A271A6E1146000AC234 /* mpw-algorithm_v0.c */; };
DA351493233EF94300BCF504 /* mpw-algorithm_v1.c in Sources */ = {isa = PBXBuildFile; fileRef = DA831A281A6E1146000AC234 /* mpw-algorithm_v1.c */; };
DA351494233EF94300BCF504 /* mpw-algorithm_v2.c in Sources */ = {isa = PBXBuildFile; fileRef = DA831A291A6E1146000AC234 /* mpw-algorithm_v2.c */; };
DA351495233EF94300BCF504 /* mpw-algorithm_v3.c in Sources */ = {isa = PBXBuildFile; fileRef = DA831A2A1A6E1146000AC234 /* mpw-algorithm_v3.c */; };
DA351496233EF94300BCF504 /* mpw-algorithm_v0.c in Sources */ = {isa = PBXBuildFile; fileRef = DA831A271A6E1146000AC234 /* mpw-algorithm_v0.c */; };
DA351497233EF94300BCF504 /* mpw-algorithm_v1.c in Sources */ = {isa = PBXBuildFile; fileRef = DA831A281A6E1146000AC234 /* mpw-algorithm_v1.c */; };
DA351498233EF94300BCF504 /* mpw-algorithm_v2.c in Sources */ = {isa = PBXBuildFile; fileRef = DA831A291A6E1146000AC234 /* mpw-algorithm_v2.c */; };
DA351499233EF94300BCF504 /* mpw-algorithm_v3.c in Sources */ = {isa = PBXBuildFile; fileRef = DA831A2A1A6E1146000AC234 /* mpw-algorithm_v3.c */; };
DA35149A233EF94500BCF504 /* mpw-algorithm_v0.c in Sources */ = {isa = PBXBuildFile; fileRef = DA831A271A6E1146000AC234 /* mpw-algorithm_v0.c */; };
DA35149B233EF94500BCF504 /* mpw-algorithm_v1.c in Sources */ = {isa = PBXBuildFile; fileRef = DA831A281A6E1146000AC234 /* mpw-algorithm_v1.c */; };
DA35149C233EF94500BCF504 /* mpw-algorithm_v2.c in Sources */ = {isa = PBXBuildFile; fileRef = DA831A291A6E1146000AC234 /* mpw-algorithm_v2.c */; };
DA35149D233EF94500BCF504 /* mpw-algorithm_v3.c in Sources */ = {isa = PBXBuildFile; fileRef = DA831A2A1A6E1146000AC234 /* mpw-algorithm_v3.c */; };
DA3B8452190FC86F00246EEA /* NSManagedObject+Pearl.m in Sources */ = {isa = PBXBuildFile; fileRef = DA3B8450190FC86F00246EEA /* NSManagedObject+Pearl.m */; };
DA3B8453190FC86F00246EEA /* NSManagedObject+Pearl.h in Headers */ = {isa = PBXBuildFile; fileRef = DA3B8451190FC86F00246EEA /* NSManagedObject+Pearl.h */; };
DA3B8456190FC89700246EEA /* MPFixable.m in Sources */ = {isa = PBXBuildFile; fileRef = DA3B8454190FC89700246EEA /* MPFixable.m */; };
@ -433,6 +449,10 @@
DA3509FC15F101A500C14A8E /* PearlQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PearlQueue.h; sourceTree = "<group>"; };
DA3509FD15F101A500C14A8E /* PearlQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PearlQueue.m; sourceTree = "<group>"; };
DA3B844A190FC5A900246EEA /* Crashlytics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Crashlytics.framework; sourceTree = "<group>"; };
DA351482233EF8E800BCF504 /* mpw-algorithm_v3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "mpw-algorithm_v3.h"; sourceTree = "<group>"; };
DA351483233EF8E800BCF504 /* mpw-algorithm_v0.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "mpw-algorithm_v0.h"; sourceTree = "<group>"; };
DA351484233EF8E800BCF504 /* mpw-algorithm_v2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "mpw-algorithm_v2.h"; sourceTree = "<group>"; };
DA351485233EF8E800BCF504 /* mpw-algorithm_v1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "mpw-algorithm_v1.h"; sourceTree = "<group>"; };
DA3B8450190FC86F00246EEA /* NSManagedObject+Pearl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSManagedObject+Pearl.m"; sourceTree = "<group>"; };
DA3B8451190FC86F00246EEA /* NSManagedObject+Pearl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSManagedObject+Pearl.h"; sourceTree = "<group>"; };
DA3B8454190FC89700246EEA /* MPFixable.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPFixable.m; sourceTree = "<group>"; };
@ -1805,9 +1825,13 @@
DA5B0B391F36467300B663F0 /* base64.h */,
DA1C7AB71F1A8F6E009A3551 /* cli */,
DA831A271A6E1146000AC234 /* mpw-algorithm_v0.c */,
DA351483233EF8E800BCF504 /* mpw-algorithm_v0.h */,
DA831A281A6E1146000AC234 /* mpw-algorithm_v1.c */,
DA351485233EF8E800BCF504 /* mpw-algorithm_v1.h */,
DA831A291A6E1146000AC234 /* mpw-algorithm_v2.c */,
DA351484233EF8E800BCF504 /* mpw-algorithm_v2.h */,
DA831A2A1A6E1146000AC234 /* mpw-algorithm_v3.c */,
DA351482233EF8E800BCF504 /* mpw-algorithm_v3.h */,
DA6773BB1A4746AF004F356A /* mpw-algorithm.c */,
DA6773BC1A4746AF004F356A /* mpw-algorithm.h */,
DA7471A01F2B71A9005F3468 /* mpw-marshal-util.c */,
@ -2691,11 +2715,15 @@
DA1C7AAA1F1A8F24009A3551 /* mpw-marshal.c in Sources */,
DA1C7AAB1F1A8F24009A3551 /* mpw-types.c in Sources */,
DA5B0B3D1F36467900B663F0 /* base64.c in Sources */,
DA351493233EF94300BCF504 /* mpw-algorithm_v1.c in Sources */,
DAB07CA31F77261400CC6D43 /* aes.c in Sources */,
DAAF16661F5CA3240013B8AE /* mpw-cli-util.c in Sources */,
DA1C7AAC1F1A8F24009A3551 /* mpw-util.c in Sources */,
DA351495233EF94300BCF504 /* mpw-algorithm_v3.c in Sources */,
DA351492233EF94300BCF504 /* mpw-algorithm_v0.c in Sources */,
DA1C7AC31F1A8FBA009A3551 /* mpw-cli.c in Sources */,
DA7471A31F2B71AE005F3468 /* mpw-marshal-util.c in Sources */,
DA351494233EF94300BCF504 /* mpw-algorithm_v2.c in Sources */,
DA1C7AAD1F1A8F24009A3551 /* mpw-algorithm.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -2705,10 +2733,14 @@
buildActionMask = 2147483647;
files = (
DA5B0B3C1F36467900B663F0 /* base64.c in Sources */,
DA351499233EF94300BCF504 /* mpw-algorithm_v3.c in Sources */,
DA351497233EF94300BCF504 /* mpw-algorithm_v1.c in Sources */,
DA351496233EF94300BCF504 /* mpw-algorithm_v0.c in Sources */,
DA1C7ACA1F1A8FD8009A3551 /* mpw-types.c in Sources */,
DA1C7ACB1F1A8FD8009A3551 /* mpw-util.c in Sources */,
DAB07CA61F77262400CC6D43 /* aes.c in Sources */,
DA1C7AD71F1A8FE6009A3551 /* mpw-bench.c in Sources */,
DA351498233EF94300BCF504 /* mpw-algorithm_v2.c in Sources */,
DA1C7ACD1F1A8FD8009A3551 /* mpw-algorithm.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -2722,6 +2754,7 @@
DA2686201EBFD7A40001E37E /* MPSiteEntity+CoreDataProperties.m in Sources */,
DA5E5CF71724A667003798D8 /* MPAlgorithmV0.m in Sources */,
DAA449D51EEC4B6B00E7BDD5 /* mpw-marshal.c in Sources */,
DA351491233EF93E00BCF504 /* mpw-algorithm_v3.c in Sources */,
DA26861E1EBFD7A40001E37E /* MPGeneratedSiteEntity+CoreDataProperties.m in Sources */,
DA5E5CF81724A667003798D8 /* MPAlgorithmV1.m in Sources */,
DA2686231EBFD7A40001E37E /* MPStoredSiteEntity+CoreDataClass.m in Sources */,
@ -2733,14 +2766,17 @@
DA5180CE19FF307E00A587E9 /* MPAppDelegate_Store.m in Sources */,
DA5E5CFA1724A667003798D8 /* MPAppDelegate_Shared.m in Sources */,
DA5E5CFC1724A667003798D8 /* MPConfig.m in Sources */,
DA351490233EF93E00BCF504 /* mpw-algorithm_v2.c in Sources */,
DA5B0B3A1F36467300B663F0 /* base64.c in Sources */,
DA26861F1EBFD7A40001E37E /* MPSiteEntity+CoreDataClass.m in Sources */,
DA35148E233EF93E00BCF504 /* mpw-algorithm_v0.c in Sources */,
DA3B8456190FC89700246EEA /* MPFixable.m in Sources */,
DA5E5D001724A667003798D8 /* MPEntities.m in Sources */,
DA2686261EBFD7A40001E37E /* MPUserEntity+CoreDataProperties.m in Sources */,
DA5E5D011724A667003798D8 /* MPKey.m in Sources */,
DA5E5D031724A667003798D8 /* MPMacAppDelegate.m in Sources */,
DA5E5D041724A667003798D8 /* MPMacConfig.m in Sources */,
DA35148F233EF93E00BCF504 /* mpw-algorithm_v1.c in Sources */,
DA5E5D0C1724A667003798D8 /* main.m in Sources */,
93D39C5789EFA607CF788082 /* MPSiteModel.m in Sources */,
DA5180CA19FF2F9200A587E9 /* MPAlgorithmV2.m in Sources */,
@ -2766,13 +2802,17 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
DA35149A233EF94500BCF504 /* mpw-algorithm_v0.c in Sources */,
DA1C7AD81F1A8FF4009A3551 /* mpw-tests-util.c in Sources */,
DA35149B233EF94500BCF504 /* mpw-algorithm_v1.c in Sources */,
DA6774451A474A3B004F356A /* mpw-types.c in Sources */,
DAB07CA51F77261C00CC6D43 /* aes.c in Sources */,
DA6774461A474A3B004F356A /* mpw-util.c in Sources */,
DA35149C233EF94500BCF504 /* mpw-algorithm_v2.c in Sources */,
DA1C7AD91F1A8FF4009A3551 /* mpw-tests.c in Sources */,
DA5B0B3B1F36467800B663F0 /* base64.c in Sources */,
DA6774431A474A3B004F356A /* mpw-algorithm.c in Sources */,
DA35149D233EF94500BCF504 /* mpw-algorithm_v3.c in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -17,10 +17,15 @@
//==============================================================================
#include "mpw-algorithm.h"
#include "mpw-algorithm_v0.c"
#include "mpw-algorithm_v1.c"
#include "mpw-algorithm_v2.c"
#include "mpw-algorithm_v3.c"
#include "mpw-algorithm_v0.h"
#include "mpw-algorithm_v1.h"
#include "mpw-algorithm_v2.h"
#include "mpw-algorithm_v3.h"
#include "mpw-util.h"
MP_LIBS_BEGIN
#include <string.h>
MP_LIBS_END
const MPMasterKey mpw_master_key(const char *fullName, const char *masterPassword, const MPAlgorithmVersion algorithmVersion) {

View File

@ -16,6 +16,7 @@
// LICENSE file. Alternatively, see <http://www.gnu.org/licenses/>.
//==============================================================================
#include "mpw-algorithm_v0.h"
#include "mpw-util.h"
#include "base64.h"
@ -31,7 +32,7 @@ MP_LIBS_END
#define MP_otp_window 5 * 60 /* s */
// Algorithm version helpers.
static const char *mpw_type_template_v0(MPResultType type, uint16_t templateIndex) {
const char *mpw_type_template_v0(MPResultType type, uint16_t templateIndex) {
size_t count = 0;
const char **templates = mpw_type_templates( type, &count );
@ -40,7 +41,7 @@ static const char *mpw_type_template_v0(MPResultType type, uint16_t templateInde
return template;
}
static const char mpw_class_character_v0(char characterClass, uint16_t classIndex) {
const char mpw_class_character_v0(char characterClass, uint16_t classIndex) {
const char *classCharacters = mpw_class_characters( characterClass );
if (!classCharacters)
@ -50,7 +51,7 @@ static const char mpw_class_character_v0(char characterClass, uint16_t classInde
}
// Algorithm version overrides.
static MPMasterKey mpw_master_key_v0(
MPMasterKey mpw_master_key_v0(
const char *fullName, const char *masterPassword) {
const char *keyScope = mpw_purpose_scope( MPKeyPurposeAuthentication );
@ -84,7 +85,7 @@ static MPMasterKey mpw_master_key_v0(
return masterKey;
}
static MPSiteKey mpw_site_key_v0(
MPSiteKey mpw_site_key_v0(
MPMasterKey masterKey, const char *siteName, MPCounterValue siteCounter,
MPKeyPurpose keyPurpose, const char *keyContext) {
@ -128,7 +129,7 @@ static MPSiteKey mpw_site_key_v0(
return siteKey;
}
static const char *mpw_site_template_password_v0(
const char *mpw_site_template_password_v0(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *resultParam) {
const char *_siteKey = (const char *)siteKey;
@ -158,7 +159,7 @@ static const char *mpw_site_template_password_v0(
return sitePassword;
}
static const char *mpw_site_crypted_password_v0(
const char *mpw_site_crypted_password_v0(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *cipherText) {
if (!cipherText) {
@ -183,12 +184,13 @@ static const char *mpw_site_crypted_password_v0(
mpw_free( &plainBytes, bufSize );
if (!plainText)
err( "AES decryption error: %s", strerror( errno ) );
trc( "decrypted -> plainText: %zu bytes = %s = %s", strlen( plainText ), plainText, mpw_hex( plainText, strlen( plainText ) ) );
else
trc( "decrypted -> plainText: %zu bytes = %s = %s", strlen( plainText ), plainText, mpw_hex( plainText, strlen( plainText ) ) );
return plainText;
}
static const char *mpw_site_derived_password_v0(
const char *mpw_site_derived_password_v0(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *resultParam) {
switch (resultType) {
@ -233,7 +235,7 @@ static const char *mpw_site_derived_password_v0(
}
}
static const char *mpw_site_state_v0(
const char *mpw_site_state_v0(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *plainText) {
// Encrypt

View File

@ -0,0 +1,42 @@
//==============================================================================
// This file is part of Master Password.
// Copyright (c) 2011-2017, Maarten Billemont.
//
// Master Password is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Master Password is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You can find a copy of the GNU General Public License in the
// LICENSE file. Alternatively, see <http://www.gnu.org/licenses/>.
//==============================================================================
#ifndef _MPW_ALGORITHM_V0_H
#define _MPW_ALGORITHM_V0_H
#include "mpw-algorithm.h"
const char *mpw_type_template_v0(
MPResultType type, uint16_t templateIndex);
const char mpw_class_character_v0(
char characterClass, uint16_t classIndex);
MPMasterKey mpw_master_key_v0(
const char *fullName, const char *masterPassword);
MPSiteKey mpw_site_key_v0(
MPMasterKey masterKey, const char *siteName, MPCounterValue siteCounter,
MPKeyPurpose keyPurpose, const char *keyContext);
const char *mpw_site_template_password_v0(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *resultParam);
const char *mpw_site_crypted_password_v0(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *cipherText);
const char *mpw_site_derived_password_v0(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *resultParam);
const char *mpw_site_state_v0(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *plainText);
#endif // _MPW_ALGORITHM_V0_H

View File

@ -16,6 +16,7 @@
// LICENSE file. Alternatively, see <http://www.gnu.org/licenses/>.
//==============================================================================
#include "mpw-algorithm_v1.h"
#include "mpw-util.h"
MP_LIBS_BEGIN
@ -27,34 +28,21 @@ MP_LIBS_END
#define MP_p 2U
#define MP_otp_window 5 * 60 /* s */
// Inherited functions.
MPMasterKey mpw_master_key_v0(
const char *fullName, const char *masterPassword);
MPSiteKey mpw_site_key_v0(
MPMasterKey masterKey, const char *siteName, MPCounterValue siteCounter,
MPKeyPurpose keyPurpose, const char *keyContext);
const char *mpw_site_crypted_password_v0(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *cipherText);
const char *mpw_site_derived_password_v0(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *resultParam);
const char *mpw_site_state_v0(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *state);
// Algorithm version overrides.
static MPMasterKey mpw_master_key_v1(
MPMasterKey mpw_master_key_v1(
const char *fullName, const char *masterPassword) {
return mpw_master_key_v0( fullName, masterPassword );
}
static MPSiteKey mpw_site_key_v1(
MPSiteKey mpw_site_key_v1(
MPMasterKey masterKey, const char *siteName, MPCounterValue siteCounter,
MPKeyPurpose keyPurpose, const char *keyContext) {
return mpw_site_key_v0( masterKey, siteName, siteCounter, keyPurpose, keyContext );
}
static const char *mpw_site_template_password_v1(
const char *mpw_site_template_password_v1(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *resultParam) {
// Determine the template.
@ -81,19 +69,19 @@ static const char *mpw_site_template_password_v1(
return sitePassword;
}
static const char *mpw_site_crypted_password_v1(
const char *mpw_site_crypted_password_v1(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *cipherText) {
return mpw_site_crypted_password_v0( masterKey, siteKey, resultType, cipherText );
}
static const char *mpw_site_derived_password_v1(
const char *mpw_site_derived_password_v1(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *resultParam) {
return mpw_site_derived_password_v0( masterKey, siteKey, resultType, resultParam );
}
static const char *mpw_site_state_v1(
const char *mpw_site_state_v1(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *state) {
return mpw_site_state_v0( masterKey, siteKey, resultType, state );

View File

@ -0,0 +1,42 @@
//==============================================================================
// This file is part of Master Password.
// Copyright (c) 2011-2017, Maarten Billemont.
//
// Master Password is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Master Password is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You can find a copy of the GNU General Public License in the
// LICENSE file. Alternatively, see <http://www.gnu.org/licenses/>.
//==============================================================================
#ifndef _MPW_ALGORITHM_V1_H
#define _MPW_ALGORITHM_V1_H
#include "mpw-algorithm_v0.h"
const char *mpw_type_template_v1(
MPResultType type, uint16_t templateIndex);
const char mpw_class_character_v1(
char characterClass, uint16_t classIndex);
MPMasterKey mpw_master_key_v1(
const char *fullName, const char *masterPassword);
MPSiteKey mpw_site_key_v1(
MPMasterKey masterKey, const char *siteName, MPCounterValue siteCounter,
MPKeyPurpose keyPurpose, const char *keyContext);
const char *mpw_site_template_password_v1(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *resultParam);
const char *mpw_site_crypted_password_v1(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *cipherText);
const char *mpw_site_derived_password_v1(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *resultParam);
const char *mpw_site_state_v1(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *plainText);
#endif // _MPW_ALGORITHM_V1_H

View File

@ -16,6 +16,7 @@
// LICENSE file. Alternatively, see <http://www.gnu.org/licenses/>.
//==============================================================================
#include "mpw-algorithm_v2.h"
#include "mpw-util.h"
MP_LIBS_BEGIN
@ -29,26 +30,14 @@ MP_LIBS_END
#define MP_p 2U
#define MP_otp_window 5 * 60 /* s */
// Inherited functions.
MPMasterKey mpw_master_key_v1(
const char *fullName, const char *masterPassword);
const char *mpw_site_template_password_v1(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *resultParam);
const char *mpw_site_crypted_password_v1(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *cipherText);
const char *mpw_site_derived_password_v1(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *resultParam);
const char *mpw_site_state_v1(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *state);
// Algorithm version overrides.
static MPMasterKey mpw_master_key_v2(
MPMasterKey mpw_master_key_v2(
const char *fullName, const char *masterPassword) {
return mpw_master_key_v1( fullName, masterPassword );
}
static MPSiteKey mpw_site_key_v2(
MPSiteKey mpw_site_key_v2(
MPMasterKey masterKey, const char *siteName, MPCounterValue siteCounter,
MPKeyPurpose keyPurpose, const char *keyContext) {
@ -92,25 +81,25 @@ static MPSiteKey mpw_site_key_v2(
return siteKey;
}
static const char *mpw_site_template_password_v2(
const char *mpw_site_template_password_v2(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *resultParam) {
return mpw_site_template_password_v1( masterKey, siteKey, resultType, resultParam );
}
static const char *mpw_site_crypted_password_v2(
const char *mpw_site_crypted_password_v2(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *cipherText) {
return mpw_site_crypted_password_v1( masterKey, siteKey, resultType, cipherText );
}
static const char *mpw_site_derived_password_v2(
const char *mpw_site_derived_password_v2(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *resultParam) {
return mpw_site_derived_password_v1( masterKey, siteKey, resultType, resultParam );
}
static const char *mpw_site_state_v2(
const char *mpw_site_state_v2(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *state) {
return mpw_site_state_v1( masterKey, siteKey, resultType, state );

View File

@ -0,0 +1,42 @@
//==============================================================================
// This file is part of Master Password.
// Copyright (c) 2011-2017, Maarten Billemont.
//
// Master Password is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Master Password is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You can find a copy of the GNU General Public License in the
// LICENSE file. Alternatively, see <http://www.gnu.org/licenses/>.
//==============================================================================
#ifndef _MPW_ALGORITHM_V2_H
#define _MPW_ALGORITHM_V2_H
#include "mpw-algorithm_v1.h"
const char *mpw_type_template_v2(
MPResultType type, uint16_t templateIndex);
const char mpw_class_character_v2(
char characterClass, uint16_t classIndex);
MPMasterKey mpw_master_key_v2(
const char *fullName, const char *masterPassword);
MPSiteKey mpw_site_key_v2(
MPMasterKey masterKey, const char *siteName, MPCounterValue siteCounter,
MPKeyPurpose keyPurpose, const char *keyContext);
const char *mpw_site_template_password_v2(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *resultParam);
const char *mpw_site_crypted_password_v2(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *cipherText);
const char *mpw_site_derived_password_v2(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *resultParam);
const char *mpw_site_state_v2(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *plainText);
#endif // _MPW_ALGORITHM_V2_H

View File

@ -16,6 +16,7 @@
// LICENSE file. Alternatively, see <http://www.gnu.org/licenses/>.
//==============================================================================
#include "mpw-algorithm_v3.h"
#include "mpw-util.h"
MP_LIBS_BEGIN
@ -28,21 +29,8 @@ MP_LIBS_END
#define MP_p 2U
#define MP_otp_window 5 * 60 /* s */
// Inherited functions.
MPSiteKey mpw_site_key_v2(
MPMasterKey masterKey, const char *siteName, MPCounterValue siteCounter,
MPKeyPurpose keyPurpose, const char *keyContext);
const char *mpw_site_template_password_v2(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *resultParam);
const char *mpw_site_crypted_password_v2(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *cipherText);
const char *mpw_site_derived_password_v2(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *resultParam);
const char *mpw_site_state_v2(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *state);
// Algorithm version overrides.
static MPMasterKey mpw_master_key_v3(
MPMasterKey mpw_master_key_v3(
const char *fullName, const char *masterPassword) {
const char *keyScope = mpw_purpose_scope( MPKeyPurposeAuthentication );
@ -76,32 +64,32 @@ static MPMasterKey mpw_master_key_v3(
return masterKey;
}
static MPSiteKey mpw_site_key_v3(
MPSiteKey mpw_site_key_v3(
MPMasterKey masterKey, const char *siteName, MPCounterValue siteCounter,
MPKeyPurpose keyPurpose, const char *keyContext) {
return mpw_site_key_v2( masterKey, siteName, siteCounter, keyPurpose, keyContext );
}
static const char *mpw_site_template_password_v3(
const char *mpw_site_template_password_v3(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *resultParam) {
return mpw_site_template_password_v2( masterKey, siteKey, resultType, resultParam );
}
static const char *mpw_site_crypted_password_v3(
const char *mpw_site_crypted_password_v3(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *cipherText) {
return mpw_site_crypted_password_v2( masterKey, siteKey, resultType, cipherText );
}
static const char *mpw_site_derived_password_v3(
const char *mpw_site_derived_password_v3(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *resultParam) {
return mpw_site_derived_password_v2( masterKey, siteKey, resultType, resultParam );
}
static const char *mpw_site_state_v3(
const char *mpw_site_state_v3(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *state) {
return mpw_site_state_v2( masterKey, siteKey, resultType, state );

View File

@ -0,0 +1,42 @@
//==============================================================================
// This file is part of Master Password.
// Copyright (c) 2011-2017, Maarten Billemont.
//
// Master Password is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Master Password is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You can find a copy of the GNU General Public License in the
// LICENSE file. Alternatively, see <http://www.gnu.org/licenses/>.
//==============================================================================
#ifndef _MPW_ALGORITHM_V3_H
#define _MPW_ALGORITHM_V3_H
#include "mpw-algorithm_v2.h"
const char *mpw_type_template_v3(
MPResultType type, uint16_t templateIndex);
const char mpw_class_character_v3(
char characterClass, uint16_t classIndex);
MPMasterKey mpw_master_key_v3(
const char *fullName, const char *masterPassword);
MPSiteKey mpw_site_key_v3(
MPMasterKey masterKey, const char *siteName, MPCounterValue siteCounter,
MPKeyPurpose keyPurpose, const char *keyContext);
const char *mpw_site_template_password_v3(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *resultParam);
const char *mpw_site_crypted_password_v3(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *cipherText);
const char *mpw_site_derived_password_v3(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *resultParam);
const char *mpw_site_state_v3(
MPMasterKey masterKey, MPSiteKey siteKey, MPResultType resultType, const char *plainText);
#endif // _MPW_ALGORITHM_V3_H