| beecrypt.h | | beecrypt.h | |
| | | | |
| skipping to change at line 150 | | skipping to change at line 150 | |
| * | | * | |
| * int (*cleanup)(randomGeneratorParam* param); | | * int (*cleanup)(randomGeneratorParam* param); | |
| * | | * | |
| * This function will cleanup after the use of a generator | | * This function will cleanup after the use of a generator | |
| * Return value is 0 on success, or -1 on failure. | | * Return value is 0 on success, or -1 on failure. | |
| */ | | */ | |
| | | | |
| typedef struct | | typedef struct | |
| { | | { | |
| const char* name; | | const char* name; | |
|
| const int paramsize; | | const unsigned int paramsize; | |
| const randomGeneratorSetup setup; | | const randomGeneratorSetup setup; | |
| const randomGeneratorSeed seed; | | const randomGeneratorSeed seed; | |
| const randomGeneratorNext next; | | const randomGeneratorNext next; | |
| const randomGeneratorCleanup cleanup; | | const randomGeneratorCleanup cleanup; | |
| } randomGenerator; | | } randomGenerator; | |
| | | | |
| /* | | /* | |
| * You can use the following functions to find random generators implemente
d by | | * You can use the following functions to find random generators implemente
d by | |
| * the library: | | * the library: | |
| * | | * | |
| | | | |
| skipping to change at line 259 | | skipping to change at line 259 | |
| * Return value is 0 on success, or -1 on failure. | | * Return value is 0 on success, or -1 on failure. | |
| * NOTE: data must be at least have a bytesize of 'digestsize' as described | | * NOTE: data must be at least have a bytesize of 'digestsize' as described | |
| * in the hashFunction struct. | | * in the hashFunction struct. | |
| * NOTE: for safety reasons, after calling digest, each specific implementa
tion | | * NOTE: for safety reasons, after calling digest, each specific implementa
tion | |
| * MUST reset itself so that previous values in the parameters are erased. | | * MUST reset itself so that previous values in the parameters are erased. | |
| */ | | */ | |
| | | | |
| typedef struct | | typedef struct | |
| { | | { | |
| const char* name; | | const char* name; | |
|
| const int paramsize; /* i | | const unsigned int paramsize; /* in bytes | |
| n bytes */ | | */ | |
| const int digestsize; /* i | | const unsigned int digestsize; /* in bytes | |
| n bytes */ | | */ | |
| const hashFunctionReset reset; | | const hashFunctionReset reset; | |
| const hashFunctionUpdate update; | | const hashFunctionUpdate update; | |
| const hashFunctionDigest digest; | | const hashFunctionDigest digest; | |
| } hashFunction; | | } hashFunction; | |
| | | | |
| /* | | /* | |
| * You can use the following functions to find hash functions implemented b
y | | * You can use the following functions to find hash functions implemented b
y | |
| * the library: | | * the library: | |
| * | | * | |
| * hashFunctionCount returns the number of hash functions available. | | * hashFunctionCount returns the number of hash functions available. | |
| | | | |
| skipping to change at line 391 | | skipping to change at line 391 | |
| * Return value is 0 on success, or -1 on failure. | | * Return value is 0 on success, or -1 on failure. | |
| * NOTE: data must be at least have a bytesize of 'digestsize' as described | | * NOTE: data must be at least have a bytesize of 'digestsize' as described | |
| * in the keyedHashFunction struct. | | * in the keyedHashFunction struct. | |
| * NOTE: for safety reasons, after calling digest, each specific implementa
tion | | * NOTE: for safety reasons, after calling digest, each specific implementa
tion | |
| * MUST reset itself so that previous values in the parameters are erased. | | * MUST reset itself so that previous values in the parameters are erased. | |
| */ | | */ | |
| | | | |
| typedef struct | | typedef struct | |
| { | | { | |
| const char* name; | | const char* name; | |
|
| const int paramsize; | | const unsigned int paramsize; /* i | |
| /* in bytes */ | | n bytes */ | |
| const int digestsize; | | const unsigned int digestsize; /* i | |
| /* in bytes */ | | n bytes */ | |
| const int keybitsmin; | | const unsigned int keybitsmin; /* i | |
| /* in bits */ | | n bits */ | |
| const int keybitsmax; | | const unsigned int keybitsmax; /* i | |
| /* in bits */ | | n bits */ | |
| const int keybitsinc; | | const unsigned int keybitsinc; /* i | |
| /* in bits */ | | n bits */ | |
| const keyedHashFunctionSetup setup; | | const keyedHashFunctionSetup setup; | |
| const keyedHashFunctionReset reset; | | const keyedHashFunctionReset reset; | |
| const keyedHashFunctionUpdate update; | | const keyedHashFunctionUpdate update; | |
| const keyedHashFunctionDigest digest; | | const keyedHashFunctionDigest digest; | |
| } keyedHashFunction; | | } keyedHashFunction; | |
| | | | |
| /* | | /* | |
| * You can use the following functions to find keyed hash functions impleme
nted | | * You can use the following functions to find keyed hash functions impleme
nted | |
| * by the library: | | * by the library: | |
| * | | * | |
| | | | |
| skipping to change at line 493 | | skipping to change at line 493 | |
| } cipherOperation; | | } cipherOperation; | |
| | | | |
| typedef enum | | typedef enum | |
| { | | { | |
| ECB, | | ECB, | |
| CBC | | CBC | |
| } cipherMode; | | } cipherMode; | |
| | | | |
| typedef void blockCipherParam; | | typedef void blockCipherParam; | |
| | | | |
|
| typedef int (*blockModeEncrypt)(blockCipherParam*, int, uint32*, const uint | | typedef int (*blockModeEncrypt)(blockCipherParam*, int, uint32*, const uint | |
| 32*, const uint32*); | | 32*); | |
| typedef int (*blockModeDecrypt)(blockCipherParam*, int, uint32*, const uint | | typedef int (*blockModeDecrypt)(blockCipherParam*, int, uint32*, const uint | |
| 32*, const uint32*); | | 32*); | |
| | | | |
| typedef struct | | typedef struct | |
| { | | { | |
| const blockModeEncrypt encrypt; | | const blockModeEncrypt encrypt; | |
| const blockModeDecrypt decrypt; | | const blockModeDecrypt decrypt; | |
| } blockMode; | | } blockMode; | |
| | | | |
| typedef int (*blockCipherSetup )(blockCipherParam*, const uint32*, int, ci
pherOperation); | | typedef int (*blockCipherSetup )(blockCipherParam*, const uint32*, int, ci
pherOperation); | |
|
| typedef int (*blockCipherEncrypt)(blockCipherParam*, uint32 *); | | typedef int (*blockCipherSetIV )(blockCipherParam*, const uint32*); | |
| typedef int (*blockCipherDecrypt)(blockCipherParam*, uint32 *); | | typedef int (*blockCipherEncrypt)(blockCipherParam*, uint32*, const uint32* | |
| | | ); | |
| | | typedef int (*blockCipherDecrypt)(blockCipherParam*, uint32*, const uint32* | |
| | | ); | |
| | | | |
| /* | | /* | |
| * The struct 'blockCipher' holds information and pointers to code specific | | * The struct 'blockCipher' holds information and pointers to code specific | |
| * to each blockcipher. Specific block ciphers MAY be written to be | | * to each blockcipher. Specific block ciphers MAY be written to be | |
| * multithread-safe. | | * multithread-safe. | |
| * | | * | |
| * The struct field 'keybitsmin' contains the minimum number of bits a key | | * The struct field 'keybitsmin' contains the minimum number of bits a key | |
| * must contains, 'keybitsmax' the maximum number of bits a key may contain
, | | * must contains, 'keybitsmax' the maximum number of bits a key may contain
, | |
| * 'keybitsinc', the increment in bits that may be used between min and max
. | | * 'keybitsinc', the increment in bits that may be used between min and max
. | |
| * | | * | |
| | | | |
| skipping to change at line 543 | | skipping to change at line 544 | |
| * | | * | |
| * This function will decrypt one block of data (with bit size equal to | | * This function will decrypt one block of data (with bit size equal to | |
| * 'blockbits') | | * 'blockbits') | |
| * Return value is 0 on success, or -1 on failure. | | * Return value is 0 on success, or -1 on failure. | |
| * NOTE: this is raw decryption, without padding, etc. | | * NOTE: this is raw decryption, without padding, etc. | |
| */ | | */ | |
| | | | |
| typedef struct | | typedef struct | |
| { | | { | |
| const char* name; | | const char* name; | |
|
| const int paramsize; /* i | | const unsigned int paramsize; /* in bytes | |
| n bytes */ | | */ | |
| const int keybitsmin; /* i | | const unsigned int blocksize; /* in bytes | |
| n bits */ | | */ | |
| const int keybitsmax; /* i | | const unsigned int keybitsmin; /* in bits * | |
| n bits */ | | / | |
| const int keybitsinc; /* i | | const unsigned int keybitsmax; /* in bits * | |
| n bits */ | | / | |
| const int blockbits; /* i | | const unsigned int keybitsinc; /* in bits * | |
| n bits */ | | / | |
| const blockCipherSetup setup; | | const blockCipherSetup setup; | |
|
| | | const blockCipherSetIV setiv; | |
| const blockCipherEncrypt encrypt; | | const blockCipherEncrypt encrypt; | |
| const blockCipherDecrypt decrypt; | | const blockCipherDecrypt decrypt; | |
| const blockMode* mode; | | const blockMode* mode; | |
| } blockCipher; | | } blockCipher; | |
| | | | |
| /* | | /* | |
| * You can use the following functions to find blockciphers implemented by | | * You can use the following functions to find blockciphers implemented by | |
| * the library: | | * the library: | |
| * | | * | |
| * blockCipherCount returns the number of blockciphers available. | | * blockCipherCount returns the number of blockciphers available. | |
| | | | |
End of changes. 7 change blocks. |
| 31 lines changed or deleted | | 35 lines changed or added | |
|
| blowfish.h | | blowfish.h | |
| | | | |
| skipping to change at line 39 | | skipping to change at line 39 | |
| #include "beecrypt.h" | | #include "beecrypt.h" | |
| #include "blowfishopt.h" | | #include "blowfishopt.h" | |
| | | | |
| #define BLOWFISHROUNDS 16 | | #define BLOWFISHROUNDS 16 | |
| #define BLOWFISHPSIZE (BLOWFISHROUNDS+2) | | #define BLOWFISHPSIZE (BLOWFISHROUNDS+2) | |
| | | | |
| typedef struct | | typedef struct | |
| { | | { | |
| uint32 p[BLOWFISHPSIZE]; | | uint32 p[BLOWFISHPSIZE]; | |
| uint32 s[1024]; | | uint32 s[1024]; | |
|
| | | uint32 fdback[2]; | |
| } blowfishParam; | | } blowfishParam; | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| extern "C" { | | extern "C" { | |
| #endif | | #endif | |
| | | | |
| extern const BEEDLLAPI blockCipher blowfish; | | extern const BEEDLLAPI blockCipher blowfish; | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
| int blowfishSetup (blowfishParam*, const uint32*, int, cipherOperation); | | int blowfishSetup (blowfishParam*, const uint32*, int, cipherOperation); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| int blowfishEncrypt(blowfishParam*, uint32*); | | int blowfishSetIV (blowfishParam*, const uint32*); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| int blowfishDecrypt(blowfishParam*, uint32*); | | int blowfishEncrypt(blowfishParam*, uint32*, const uint32*); | |
| | | BEEDLLAPI | |
| | | int blowfishDecrypt(blowfishParam*, uint32*, const uint32*); | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
| int blowfishECBEncrypt(blowfishParam*, int, uint32*, const uint32*); | | int blowfishECBEncrypt(blowfishParam*, int, uint32*, const uint32*); | |
| BEEDLLAPI | | BEEDLLAPI | |
| int blowfishECBDecrypt(blowfishParam*, int, uint32*, const uint32*); | | int blowfishECBDecrypt(blowfishParam*, int, uint32*, const uint32*); | |
| | | | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| int blowfishCBCEncrypt(blowfishParam*, int, uint32*, const uint32*, const u
int32*); | | int blowfishCBCEncrypt(blowfishParam*, int, uint32*, const uint32*); | |
| BEEDLLAPI | | BEEDLLAPI | |
|
| int blowfishCBCDecrypt(blowfishParam*, int, uint32*, const uint32*, const u
int32*); | | int blowfishCBCDecrypt(blowfishParam*, int, uint32*, const uint32*); | |
| | | | |
| #ifdef __cplusplus | | #ifdef __cplusplus | |
| } | | } | |
| #endif | | #endif | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 5 change blocks. |
| 4 lines changed or deleted | | 7 lines changed or added | |
|