Portability fixes for Blowfish's code.
This commit is contained in:
		@@ -439,8 +439,8 @@
 | 
			
		||||
		DA3B8455190FC89700246EEA /* MPFixable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPFixable.h; sourceTree = "<group>"; };
 | 
			
		||||
		DA3BCFCC19BD09E0006B2681 /* SourceCodePro-Regular.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "SourceCodePro-Regular.otf"; sourceTree = "<group>"; };
 | 
			
		||||
		DA456CA21F5307B700D54152 /* blf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = blf.h; sourceTree = "<group>"; };
 | 
			
		||||
		DA4571171F552C9500D54152 /* bcrypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bcrypt.h; sourceTree = "<group>"; };
 | 
			
		||||
		DA4571181F552C9500D54152 /* blowfish.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = blowfish.h; sourceTree = "<group>"; };
 | 
			
		||||
		DA4571171F552C9500D54152 /* bcrypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bcrypt.c; sourceTree = "<group>"; };
 | 
			
		||||
		DA4571181F552C9500D54152 /* blowfish.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = blowfish.c; sourceTree = "<group>"; };
 | 
			
		||||
		DA45711E1F572F3200D54152 /* PearlCryptUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PearlCryptUtils.m; sourceTree = "<group>"; };
 | 
			
		||||
		DA45711F1F572F3200D54152 /* PearlCryptUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PearlCryptUtils.h; sourceTree = "<group>"; };
 | 
			
		||||
		DA4DAE911A7D8117003E5423 /* MPAlgorithmV3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPAlgorithmV3.h; sourceTree = "<group>"; };
 | 
			
		||||
@@ -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 */,
 | 
			
		||||
 
 | 
			
		||||
@@ -40,7 +40,7 @@
 | 
			
		||||
#include <time.h>
 | 
			
		||||
 | 
			
		||||
#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;
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -31,7 +31,7 @@
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <sys/time.h>
 | 
			
		||||
 | 
			
		||||
#include "bcrypt.h"
 | 
			
		||||
#include "bcrypt.c"
 | 
			
		||||
 | 
			
		||||
#include "mpw-algorithm.h"
 | 
			
		||||
#include "mpw-util.h"
 | 
			
		||||
 
 | 
			
		||||
 Submodule public/site updated: ebd2c741fd...c0bba20f1c
									
								
							
		Reference in New Issue
	
	Block a user