diff --git a/platform-darwin/MasterPassword-macOS.xcodeproj/project.pbxproj b/platform-darwin/MasterPassword-macOS.xcodeproj/project.pbxproj index 240fd2a9..2b952657 100644 --- a/platform-darwin/MasterPassword-macOS.xcodeproj/project.pbxproj +++ b/platform-darwin/MasterPassword-macOS.xcodeproj/project.pbxproj @@ -439,8 +439,8 @@ DA3B8455190FC89700246EEA /* MPFixable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPFixable.h; sourceTree = ""; }; DA3BCFCC19BD09E0006B2681 /* SourceCodePro-Regular.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SourceCodePro-Regular.otf"; sourceTree = ""; }; DA456CA21F5307B700D54152 /* blf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = blf.h; sourceTree = ""; }; - DA4571171F552C9500D54152 /* bcrypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bcrypt.h; sourceTree = ""; }; - DA4571181F552C9500D54152 /* blowfish.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = blowfish.h; sourceTree = ""; }; + DA4571171F552C9500D54152 /* bcrypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bcrypt.c; sourceTree = ""; }; + DA4571181F552C9500D54152 /* blowfish.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = blowfish.c; sourceTree = ""; }; DA45711E1F572F3200D54152 /* PearlCryptUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PearlCryptUtils.m; sourceTree = ""; }; DA45711F1F572F3200D54152 /* PearlCryptUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PearlCryptUtils.h; sourceTree = ""; }; DA4DAE911A7D8117003E5423 /* MPAlgorithmV3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPAlgorithmV3.h; sourceTree = ""; }; @@ -1212,9 +1212,9 @@ DA1C7AB71F1A8F6E009A3551 /* cli */ = { isa = PBXGroup; children = ( - DA4571171F552C9500D54152 /* bcrypt.h */, + DA4571171F552C9500D54152 /* bcrypt.c */, DA456CA21F5307B700D54152 /* blf.h */, - DA4571181F552C9500D54152 /* blowfish.h */, + DA4571181F552C9500D54152 /* blowfish.c */, DA1C7AB81F1A8F6E009A3551 /* mpw-bench.c */, DAAF16631F5897EA0013B8AE /* mpw-cli-util.c */, DAAF16641F5897EA0013B8AE /* mpw-cli-util.h */, diff --git a/platform-independent/c/cli/src/bcrypt.h b/platform-independent/c/cli/src/bcrypt.c similarity index 97% rename from platform-independent/c/cli/src/bcrypt.h rename to platform-independent/c/cli/src/bcrypt.c index 093d60ac..f0baf238 100644 --- a/platform-independent/c/cli/src/bcrypt.h +++ b/platform-independent/c/cli/src/bcrypt.c @@ -40,7 +40,7 @@ #include #include "blf.h" -#include "blowfish.h" +#include "blowfish.c" #include "mpw-util.h" /* This implementation is adaptable to current computing power. @@ -72,7 +72,11 @@ bcrypt_initsalt(int log_rounds, uint8_t *salt, size_t saltbuflen) { return -1; } - arc4random_buf( csalt, sizeof( csalt ) ); + // Switching to PRNG rand() for portability. Do not use in production code. + //arc4random_buf( csalt, sizeof( csalt ) ); + srand( time() ); + for (int s = 0; s < sizeof( csalt ); ++s) + csalt[s] = (uint8_t)rand(); if (log_rounds < 4) log_rounds = 4; diff --git a/platform-independent/c/cli/src/blf.h b/platform-independent/c/cli/src/blf.h index 6ec59ca6..3f13d23b 100644 --- a/platform-independent/c/cli/src/blf.h +++ b/platform-independent/c/cli/src/blf.h @@ -62,14 +62,14 @@ typedef struct BlowfishContext { void Blowfish_encipher(blf_ctx *, uint32_t *, uint32_t *); void Blowfish_decipher(blf_ctx *, uint32_t *, uint32_t *); void Blowfish_initstate(blf_ctx *); -void Blowfish_expand0state(blf_ctx *, const uint8_t *, u_int16_t); -void Blowfish_expandstate(blf_ctx *, const uint8_t *, u_int16_t, const uint8_t *, u_int16_t); +void Blowfish_expand0state(blf_ctx *, const uint8_t *, uint16_t); +void Blowfish_expandstate(blf_ctx *, const uint8_t *, uint16_t, const uint8_t *, uint16_t); /* Standard Blowfish */ -void blf_key(blf_ctx *, const uint8_t *, u_int16_t); -void blf_enc(blf_ctx *, uint32_t *, u_int16_t); -void blf_dec(blf_ctx *, uint32_t *, u_int16_t); +void blf_key(blf_ctx *, const uint8_t *, uint16_t); +void blf_enc(blf_ctx *, uint32_t *, uint16_t); +void blf_dec(blf_ctx *, uint32_t *, uint16_t); void blf_ecb_encrypt(blf_ctx *, uint8_t *, uint32_t); void blf_ecb_decrypt(blf_ctx *, uint8_t *, uint32_t); @@ -78,6 +78,6 @@ void blf_cbc_encrypt(blf_ctx *, uint8_t *, uint8_t *, uint32_t); void blf_cbc_decrypt(blf_ctx *, uint8_t *, uint8_t *, uint32_t); /* Converts uint8_t to uint32_t */ -uint32_t Blowfish_stream2word(const uint8_t *, u_int16_t, u_int16_t *); +uint32_t Blowfish_stream2word(const uint8_t *, uint16_t, uint16_t *); #endif diff --git a/platform-independent/c/cli/src/blowfish.h b/platform-independent/c/cli/src/blowfish.c similarity index 100% rename from platform-independent/c/cli/src/blowfish.h rename to platform-independent/c/cli/src/blowfish.c diff --git a/platform-independent/c/cli/src/mpw-bench.c b/platform-independent/c/cli/src/mpw-bench.c index a88c97ea..a3e81d60 100644 --- a/platform-independent/c/cli/src/mpw-bench.c +++ b/platform-independent/c/cli/src/mpw-bench.c @@ -31,7 +31,7 @@ #include #include -#include "bcrypt.h" +#include "bcrypt.c" #include "mpw-algorithm.h" #include "mpw-util.h" diff --git a/public/site b/public/site index ebd2c741..c0bba20f 160000 --- a/public/site +++ b/public/site @@ -1 +1 @@ -Subproject commit ebd2c741fd11171eefa081792f9b14d6b2bac356 +Subproject commit c0bba20f1cf21a0c555a04042acd6f25c817641f