aes.h   aes.h 
skipping to change at line 29 skipping to change at line 29
/*!\file aes.h /*!\file aes.h
* \brief AES block cipher, as specified by NIST FIPS 197. * \brief AES block cipher, as specified by NIST FIPS 197.
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup BC_m BC_aes_m * \ingroup BC_m BC_aes_m
*/ */
#ifndef _AES_H #ifndef _AES_H
#define _AES_H #define _AES_H
#include "beecrypt.h" #include "beecrypt/beecrypt.h"
#include "aesopt.h" #include "beecrypt/aesopt.h"
/*!\brief Holds all the parameters necessary for the AES cipher. /*!\brief Holds all the parameters necessary for the AES cipher.
* \ingroup BC_aes_m * \ingroup BC_aes_m
*/ */
typedef struct typedef struct
{ {
/*!\var k /*!\var k
* \brief Holds the key expansion. * \brief Holds the key expansion.
*/ */
uint32_t k[64]; uint32_t k[64];
 End of changes. 1 change blocks. 
2 lines changed or deleted 2 lines changed or added


 aesopt.h   aesopt.h 
skipping to change at line 29 skipping to change at line 29
/*!\file aesopt.h /*!\file aesopt.h
* \brief AES block cipher, assembler-optimized routines, headers. * \brief AES block cipher, assembler-optimized routines, headers.
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup BC_aes_m * \ingroup BC_aes_m
*/ */
#ifndef _AESOPT_H #ifndef _AESOPT_H
#define _AESOPT_H #define _AESOPT_H
#include "beecrypt.h" #include "beecrypt/beecrypt.h"
#include "aes.h" #include "beecrypt/aes.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#if WIN32 #if WIN32
# if defined(_MSC_VER) && defined(_M_IX86) # if defined(_MSC_VER) && defined(_M_IX86)
/* this space intentionally left blank */ /* this space intentionally left blank */
# elif __INTEL__ && __MWERKS__ # elif __INTEL__ && __MWERKS__
# endif # endif
skipping to change at line 56 skipping to change at line 56
# define ASM_AESENCRYPT # define ASM_AESENCRYPT
# define ASM_AESENCRYPTECB # define ASM_AESENCRYPTECB
# define ASM_AESDECRYPT # define ASM_AESDECRYPT
# define ASM_AESDECRYPTECB # define ASM_AESDECRYPTECB
# endif # endif
# endif # endif
#endif #endif
#if defined(__INTEL_COMPILER) #if defined(__INTEL_COMPILER)
# if defined(OPTIMIZE_I586) || defined(OPTIMIZE_I686) # if defined(OPTIMIZE_I586) || defined(OPTIMIZE_I686)
# if defined(OPTIMIZE_MMX)
# define ASM_AESENCRYPT # define ASM_AESENCRYPT
# define ASM_AESENCRYPTECB # define ASM_AESENCRYPTECB
# define ASM_AESDECRYPT # define ASM_AESDECRYPT
# define ASM_AESDECRYPTECB # define ASM_AESDECRYPTECB
# endif # endif
# endif
#endif #endif
#if defined(__SUNPRO_C) || defined(__SUNPRO_CC) #if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
/* this space intentionally left blank */ /* this space intentionally left blank */
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
 End of changes. 3 change blocks. 
2 lines changed or deleted 4 lines changed or added


 base64.h   base64.h 
skipping to change at line 28 skipping to change at line 28
*/ */
/*!\file base64.h /*!\file base64.h
* \brief Base64 encoding and decoding, headers. * \brief Base64 encoding and decoding, headers.
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
*/ */
#ifndef _BASE64_H #ifndef _BASE64_H
#define _BASE64_H #define _BASE64_H
#include "beecrypt.h" #include "beecrypt/beecrypt.h"
/*!\ /*!\
* Decode white space character set (default). * Decode white space character set (default).
*/ */
extern const char* b64decode_whitespace; extern const char* b64decode_whitespace;
#define B64DECODE_WHITESPACE " \f\n\r\t\v" #define B64DECODE_WHITESPACE " \f\n\r\t\v"
/*!\ /*!\
* Encode 72 characters per line (default). * Encode 72 characters per line (default).
*/ */
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 beecrypt.h   beecrypt.h 
skipping to change at line 33 skipping to change at line 33
* These API functions provide an abstract way for using most of * These API functions provide an abstract way for using most of
* the various algorithms implemented by the library. * the various algorithms implemented by the library.
* *
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup ES_m PRNG_m HASH_m HMAC_m BC_m * \ingroup ES_m PRNG_m HASH_m HMAC_m BC_m
*/ */
#ifndef _BEECRYPT_H #ifndef _BEECRYPT_H
#define _BEECRYPT_H #define _BEECRYPT_H
#include "beecrypt.api.h" #include "beecrypt/api.h"
#include "memchunk.h" #include "beecrypt/memchunk.h"
#include "mpnumber.h" #include "beecrypt/mpnumber.h"
/* /*
* Entropy Sources * Entropy Sources
*/ */
/*!\typedef entropyNext /*!\typedef entropyNext
* \brief Prototype definition for an entropy-generating function. * \brief Prototype definition for an entropy-generating function.
* \ingroup ES_m * \ingroup ES_m
*/ */
typedef int (*entropyNext)(byte*, size_t); typedef int (*entropyNext)(byte*, size_t);
/*!\brief This struct holds information and pointers to code specific to ea ch /*!\brief This struct holds information and pointers to code specific to ea ch
* source of entropy. * source of entropy.
* \ingroup ES_m * \ingroup ES_m
*/ */
typedef struct #ifdef __cplusplus
struct BEECRYPTAPI entropySource
#else
struct _entropySource
#endif
{ {
/*!\var name /*!\var name
* \brief The entropy source's name. * \brief The entropy source's name.
*/ */
const char* name; const char* name;
/*!\var next /*!\var next
* \brief Points to the function which produces the entropy. * \brief Points to the function which produces the entropy.
*/ */
const entropyNext next; const entropyNext next;
} entropySource; };
#ifndef __cplusplus
typedef struct _entropySource entropySource;
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/*!\fn int entropySourceCount() /*!\fn int entropySourceCount()
* \brief This function returns the number of entropy sources implemented b y * \brief This function returns the number of entropy sources implemented b y
* the library. * the library.
* \return The number of implemented entropy sources. * \return The number of implemented entropy sources.
*/ */
skipping to change at line 152 skipping to change at line 160
* provided they each use their own randomGeneratorParam parameters, a chun k * provided they each use their own randomGeneratorParam parameters, a chun k
* of memory which must be at least as large as indicated by the paramsize * of memory which must be at least as large as indicated by the paramsize
* field. * field.
* *
*/ */
/*!\brief This struct holds information and pointers to code specific to ea ch /*!\brief This struct holds information and pointers to code specific to ea ch
* pseudo-random number generator. * pseudo-random number generator.
* \ingroup PRNG_m * \ingroup PRNG_m
*/ */
typedef struct #ifdef __cplusplus
struct BEECRYPTAPI randomGenerator
#else
struct _randomGenerator
#endif
{ {
/*!\var name /*!\var name
* \brief The random generator's name. * \brief The random generator's name.
*/ */
const char* name; const char* name;
/*!\var paramsize /*!\var paramsize
* \brief The size of the random generator's parameters. * \brief The size of the random generator's parameters.
* \note The implementor should set this by using sizeof(<struct hol ding * \note The implementor should set this by using sizeof(<struct hol ding
* random generator's parameters>). * random generator's parameters>).
*/ */
skipping to change at line 180 skipping to change at line 192
*/ */
const randomGeneratorSeed seed; const randomGeneratorSeed seed;
/*!\var seed /*!\var seed
* \brief Points to the function which generates the random data. * \brief Points to the function which generates the random data.
*/ */
const randomGeneratorNext next; const randomGeneratorNext next;
/*!\var seed /*!\var seed
* \brief Points to the cleanup function. * \brief Points to the cleanup function.
*/ */
const randomGeneratorCleanup cleanup; const randomGeneratorCleanup cleanup;
} randomGenerator; };
#ifndef __cplusplus
typedef struct _randomGenerator randomGenerator;
#endif
/* /*
* 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:
* *
* randomGeneratorCount returns the number of generators available. * randomGeneratorCount returns the number of generators available.
* *
* randomGeneratorGet returns the random generator with a given index (star ting * randomGeneratorGet returns the random generator with a given index (star ting
* at zero, up to randomGeneratorCount() - 1), or NULL if the index was out of * at zero, up to randomGeneratorCount() - 1), or NULL if the index was out of
* bounds. * bounds.
skipping to change at line 218 skipping to change at line 234
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* /*
* The struct 'randomGeneratorContext' is used to contain both the function al * The struct 'randomGeneratorContext' is used to contain both the function al
* part (the randomGenerator), and its parameters. * part (the randomGenerator), and its parameters.
*/ */
typedef struct #ifdef __cplusplus
struct BEECRYPTAPI randomGeneratorContext
#else
struct _randomGeneratorContext
#endif
{ {
const randomGenerator* rng; const randomGenerator* rng;
randomGeneratorParam* param; randomGeneratorParam* param;
} randomGeneratorContext;
#ifdef __cplusplus
randomGeneratorContext();
randomGeneratorContext(const randomGenerator*);
~randomGeneratorContext();
#endif
};
#ifndef __cplusplus
typedef struct _randomGeneratorContext randomGeneratorContext;
#endif
/* /*
* The following functions can be used to initialize and free a * The following functions can be used to initialize and free a
* randomGeneratorContext. Initializing will allocate a buffer of the size * randomGeneratorContext. Initializing will allocate a buffer of the size
* required by the randomGenerator, freeing will deallocate that buffer. * required by the randomGenerator, freeing will deallocate that buffer.
*/ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
BEECRYPTAPI BEECRYPTAPI
int randomGeneratorContextInit(randomGeneratorContext*, const randomGenerat or*); int randomGeneratorContextInit(randomGeneratorContext*, const randomGenerat or*);
BEECRYPTAPI BEECRYPTAPI
int randomGeneratorContextFree(randomGeneratorContext*); int randomGeneratorContextFree(randomGeneratorContext*);
BEECRYPTAPI BEECRYPTAPI
int randomGeneratorContextNext(randomGeneratorContext*, byte*, size_t); int randomGeneratorContextNext(randomGeneratorContext*, byte*, size_t);
BEECRYPTAPI
int randomGeneratorContextSeed(randomGeneratorContext*, const byte*, size_t
);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* /*
* Hash Functions * Hash Functions
*/ */
/*!typedef void hashFunctionParam /*!typedef void hashFunctionParam
skipping to change at line 268 skipping to change at line 300
/* /*
* The struct 'hashFunction' holds information and pointers to code specifi c * The struct 'hashFunction' holds information and pointers to code specifi c
* to each hash function. Specific hash functions MAY be written to be * to each hash function. Specific hash functions MAY be written to be
* multithread-safe. * multithread-safe.
* *
* NOTE: data MUST have a size (in bytes) of at least 'digestsize' as descr ibed * NOTE: data MUST have a size (in bytes) of at least 'digestsize' as descr ibed
* 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.
*/ */
#ifdef __cplusplus
typedef struct struct BEECRYPTAPI hashFunction
#else
struct _hashFunction
#endif
{ {
const char* name; const char* name;
const size_t paramsize; /* in bytes */ const size_t paramsize; /* in bytes */
const size_t blocksize; /* in bytes */ const size_t blocksize; /* in bytes */
const size_t digestsize; /* in bytes */ const size_t digestsize; /* in bytes */
const hashFunctionReset reset; const hashFunctionReset reset;
const hashFunctionUpdate update; const hashFunctionUpdate update;
const hashFunctionDigest digest; const hashFunctionDigest digest;
} hashFunction; };
#ifndef __cplusplus
typedef struct _hashFunction hashFunction;
#endif
/* /*
* 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.
* *
* hashFunctionGet returns the hash function with a given index (starting * hashFunctionGet returns the hash function with a given index (starting
* at zero, up to hashFunctionCount() - 1), or NULL if the index was out of * at zero, up to hashFunctionCount() - 1), or NULL if the index was out of
* bounds. * bounds.
skipping to change at line 315 skipping to change at line 354
const hashFunction* hashFunctionDefault(void); const hashFunction* hashFunctionDefault(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* /*
* The struct 'hashFunctionContext' is used to contain both the functional * The struct 'hashFunctionContext' is used to contain both the functional
* part (the hashFunction), and its parameters. * part (the hashFunction), and its parameters.
*/ */
#ifdef __cplusplus
typedef struct struct BEECRYPTAPI hashFunctionContext
#else
struct _hashFunctionContext
#endif
{ {
const hashFunction* algo; const hashFunction* algo;
hashFunctionParam* param; hashFunctionParam* param;
} hashFunctionContext;
#ifdef __cplusplus
hashFunctionContext();
hashFunctionContext(const hashFunction*);
~hashFunctionContext();
#endif
};
#ifndef __cplusplus
typedef struct _hashFunctionContext hashFunctionContext;
#endif
/* /*
* The following functions can be used to initialize and free a * The following functions can be used to initialize and free a
* hashFunctionContext. Initializing will allocate a buffer of the size * hashFunctionContext. Initializing will allocate a buffer of the size
* required by the hashFunction, freeing will deallocate that buffer. * required by the hashFunction, freeing will deallocate that buffer.
*/ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
skipping to change at line 383 skipping to change at line 435
* *
* 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 .
* *
* 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.
*/ */
#ifdef __cplusplus
typedef struct struct BEECRYPTAPI keyedHashFunction
#else
struct _keyedHashFunction
#endif
{ {
const char* name; const char* name;
const size_t paramsize; /* i n bytes */ const size_t paramsize; /* i n bytes */
const size_t blocksize; /* i n bytes */ const size_t blocksize; /* i n bytes */
const size_t digestsize; /* i n bytes */ const size_t digestsize; /* i n bytes */
const size_t keybitsmin; /* i n bits */ const size_t keybitsmin; /* i n bits */
const size_t keybitsmax; /* i n bits */ const size_t keybitsmax; /* i n bits */
const size_t keybitsinc; /* i n bits */ const size_t keybitsinc; /* i 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; };
#ifndef __cplusplus
typedef struct _keyedHashFunction keyedHashFunction;
#endif
/* /*
* 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:
* *
* keyedHashFunctionCount returns the number of keyed hash functions availa ble. * keyedHashFunctionCount returns the number of keyed hash functions availa ble.
* *
* keyedHashFunctionGet returns the keyed hash function with a given index * keyedHashFunctionGet returns the keyed hash function with a given index
* (starting at zero, up to keyedHashFunctionCount() - 1), or NULL if the i ndex * (starting at zero, up to keyedHashFunctionCount() - 1), or NULL if the i ndex
* was out of bounds. * was out of bounds.
skipping to change at line 434 skipping to change at line 493
const keyedHashFunction* keyedHashFunctionDefault(void); const keyedHashFunction* keyedHashFunctionDefault(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/* /*
* The struct 'keyedHashFunctionContext' is used to contain both the functi onal * The struct 'keyedHashFunctionContext' is used to contain both the functi onal
* part (the keyedHashFunction), and its parameters. * part (the keyedHashFunction), and its parameters.
*/ */
#ifdef __cplusplus
typedef struct struct BEECRYPTAPI keyedHashFunctionContext
#else
struct _keyedHashFunctionContext
#endif
{ {
const keyedHashFunction* algo; const keyedHashFunction* algo;
keyedHashFunctionParam* param; keyedHashFunctionParam* param;
} keyedHashFunctionContext;
#ifdef __cplusplus
keyedHashFunctionContext();
keyedHashFunctionContext(const keyedHashFunction*);
~keyedHashFunctionContext();
#endif
};
#ifndef __cplusplus
typedef struct _keyedHashFunctionContext keyedHashFunctionContext;
#endif
/* /*
* The following functions can be used to initialize and free a * The following functions can be used to initialize and free a
* keyedHashFunctionContext. Initializing will allocate a buffer of the siz e * keyedHashFunctionContext. Initializing will allocate a buffer of the siz e
* required by the keyedHashFunction, freeing will deallocate that buffer. * required by the keyedHashFunction, freeing will deallocate that buffer.
*/ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
skipping to change at line 558 skipping to change at line 630
const blockCipherModcrypt encrypt; const blockCipherModcrypt encrypt;
const blockCipherModcrypt decrypt; const blockCipherModcrypt decrypt;
} blockCipherMode; } blockCipherMode;
/*!\brief Holds information and pointers to code specific to each cipher. /*!\brief Holds information and pointers to code specific to each cipher.
* *
* Specific block ciphers \e may be written to be multithread-safe. * Specific block ciphers \e may be written to be multithread-safe.
* *
* \ingroup BC_m * \ingroup BC_m
*/ */
typedef struct #ifdef __cplusplus
struct BEECRYPTAPI blockCipher
#else
struct _blockCipher
#endif
{ {
/*!\var name /*!\var name
* \brief The blockcipher's name. * \brief The blockcipher's name.
*/ */
const char* name; const char* name;
/*!\var paramsize /*!\var paramsize
* \brief The size of the parameters required by this cipher, in byt es. * \brief The size of the parameters required by this cipher, in byt es.
*/ */
const size_t paramsize; const size_t paramsize;
/*!\var blocksize /*!\var blocksize
skipping to change at line 606 skipping to change at line 682
const blockCipherRaw raw; const blockCipherRaw raw;
/*!\var ecb /*!\var ecb
* \brief The cipher's ECB functions. * \brief The cipher's ECB functions.
*/ */
const blockCipherMode ecb; const blockCipherMode ecb;
const blockCipherMode cbc; const blockCipherMode cbc;
/*!\var getfb /*!\var getfb
* \brief Pointer to the cipher's feedback-returning function. * \brief Pointer to the cipher's feedback-returning function.
*/ */
const blockCipherFeedback getfb; const blockCipherFeedback getfb;
} blockCipher; };
#ifndef __cplusplus
typedef struct _blockCipher blockCipher;
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/*!\fn int blockCipherCount() /*!\fn int blockCipherCount()
* \brief This function returns the number of blockciphers implemented * \brief This function returns the number of blockciphers implemented
* by the library. * by the library.
* \return The number of implemented blockciphers. * \return The number of implemented blockciphers.
*/ */
skipping to change at line 655 skipping to change at line 735
const blockCipher* blockCipherDefault(void); const blockCipher* blockCipherDefault(void);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
/*!\brief Holds a pointer to a blockcipher as well as its parameters. /*!\brief Holds a pointer to a blockcipher as well as its parameters.
* \warning A context can be used by only one thread at the same time. * \warning A context can be used by only one thread at the same time.
* \ingroup BC_m * \ingroup BC_m
*/ */
typedef struct #ifdef __cplusplus
struct BEECRYPTAPI blockCipherContext
#else
struct _blockCipherContext
#endif
{ {
/*!\var algo /*!\var algo
* \brief Pointer to a blockCipher. * \brief Pointer to a blockCipher.
*/ */
const blockCipher* algo; const blockCipher* algo;
/*!\var param /*!\var param
* \brief Pointer to the parameters used by algo. * \brief Pointer to the parameters used by algo.
*/ */
blockCipherParam* param; blockCipherParam* param;
/*!\var op /*!\var op
*/ */
cipherOperation op; cipherOperation op;
} blockCipherContext;
#ifdef __cplusplus
blockCipherContext();
blockCipherContext(const blockCipher*);
~blockCipherContext();
#endif
};
#ifndef __cplusplus
typedef struct _blockCipherContext blockCipherContext;
#endif
/* /*
* The following functions can be used to initialize and free a * The following functions can be used to initialize and free a
* blockCipherContext. Initializing will allocate a buffer of the size * blockCipherContext. Initializing will allocate a buffer of the size
* required by the blockCipher, freeing will deallocate that buffer. * required by the blockCipher, freeing will deallocate that buffer.
*/ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
 End of changes. 21 change blocks. 
25 lines changed or deleted 120 lines changed or added


 blockmode.h   blockmode.h 
skipping to change at line 30 skipping to change at line 30
/*!\file blockmode.h /*!\file blockmode.h
* \brief Blockcipher operation modes. * \brief Blockcipher operation modes.
* \todo Additional modes, such as CFB and OFB. * \todo Additional modes, such as CFB and OFB.
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup BC_m * \ingroup BC_m
*/ */
#ifndef _BLOCKMODE_H #ifndef _BLOCKMODE_H
#define _BLOCKMODE_H #define _BLOCKMODE_H
#include "beecrypt.h" #include "beecrypt/beecrypt.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/*!\fn int blockEncryptECB(const blockCipher* bc, blockCipherParam* bp, uin t32_t* dst, const uint32_t* src, unsigned int nblocks) /*!\fn int blockEncryptECB(const blockCipher* bc, blockCipherParam* bp, uin t32_t* dst, const uint32_t* src, unsigned int nblocks)
* \brief This function encrypts a number of data blocks in Electronic Code * \brief This function encrypts a number of data blocks in Electronic Code
* Book mode. * Book mode.
* \param bc The blockcipher. * \param bc The blockcipher.
* \param bp The cipher's parameter block. * \param bp The cipher's parameter block.
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 blockpad.h   blockpad.h 
skipping to change at line 29 skipping to change at line 29
/*!\file blockpad.h /*!\file blockpad.h
* \brief Blockcipher padding algorithms. * \brief Blockcipher padding algorithms.
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup BC_m * \ingroup BC_m
*/ */
#ifndef _BLOCKPAD_H #ifndef _BLOCKPAD_H
#define _BLOCKPAD_H #define _BLOCKPAD_H
#include "beecrypt.h" #include "beecrypt/beecrypt.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
BEECRYPTAPI BEECRYPTAPI
memchunk* pkcs5Pad (size_t, memchunk*); memchunk* pkcs5Pad (size_t, memchunk*);
BEECRYPTAPI BEECRYPTAPI
memchunk* pkcs5Unpad(size_t, memchunk*); memchunk* pkcs5Unpad(size_t, memchunk*);
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 blowfish.h   blowfish.h 
skipping to change at line 37 skipping to change at line 37
* *
* Also see http://www.counterpane.com/blowfish.html * Also see http://www.counterpane.com/blowfish.html
* *
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup BC_m BC_blowfish_m * \ingroup BC_m BC_blowfish_m
*/ */
#ifndef _BLOWFISH_H #ifndef _BLOWFISH_H
#define _BLOWFISH_H #define _BLOWFISH_H
#include "beecrypt.h" #include "beecrypt/beecrypt.h"
#include "blowfishopt.h" #include "beecrypt/blowfishopt.h"
#define BLOWFISHROUNDS 16 #define BLOWFISHROUNDS 16
#define BLOWFISHPSIZE (BLOWFISHROUNDS+2) #define BLOWFISHPSIZE (BLOWFISHROUNDS+2)
/*!\brief Holds all the parameters necessary for the Blowfish cipher. /*!\brief Holds all the parameters necessary for the Blowfish cipher.
* \ingroup BC_blowfish_m * \ingroup BC_blowfish_m
*/ */
typedef struct typedef struct
{ {
/*!\var p /*!\var p
 End of changes. 1 change blocks. 
2 lines changed or deleted 2 lines changed or added


 blowfishopt.h   blowfishopt.h 
skipping to change at line 29 skipping to change at line 29
/*!\file blowfishopt.h /*!\file blowfishopt.h
* \brief Blowfish block cipher, assembler-optimized routines, headers. * \brief Blowfish block cipher, assembler-optimized routines, headers.
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup BC_blowfish_m * \ingroup BC_blowfish_m
*/ */
#ifndef _BLOWFISHOPT_H #ifndef _BLOWFISHOPT_H
#define _BLOWFISHOPT_H #define _BLOWFISHOPT_H
#include "beecrypt.h" #include "beecrypt/beecrypt.h"
#include "blowfish.h" #include "beecrypt/blowfish.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#if WIN32 #if WIN32
# if defined(_MSC_VER) && defined(_M_IX86) # if defined(_MSC_VER) && defined(_M_IX86)
# define ASM_BLOWFISHENCRYPT # define ASM_BLOWFISHENCRYPT
# define ASM_BLOWFISHDECRYPT # define ASM_BLOWFISHDECRYPT
# elif __INTEL__ && __MWERKS__ # elif __INTEL__ && __MWERKS__
 End of changes. 1 change blocks. 
2 lines changed or deleted 2 lines changed or added


 dhaes.h   dhaes.h 
skipping to change at line 36 skipping to change at line 36
* Michel Abdalla, Mihir Bellare, Phillip Rogaway * Michel Abdalla, Mihir Bellare, Phillip Rogaway
* September 1998 * September 1998
* *
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup DL_m DL_dh_m * \ingroup DL_m DL_dh_m
*/ */
#ifndef _DHAES_H #ifndef _DHAES_H
#define _DHAES_H #define _DHAES_H
#include "beecrypt.h" #include "beecrypt/beecrypt.h"
#include "dldp.h" #include "beecrypt/dldp.h"
typedef struct typedef struct
{ {
const dldp_p* param; const dldp_p* param;
const hashFunction* hash; const hashFunction* hash;
const blockCipher* cipher; const blockCipher* cipher;
const keyedHashFunction* mac; const keyedHashFunction* mac;
size_t cipherkeybits; size_t cipherkeybits;
size_t mackeybits; size_t mackeybits;
} dhaes_pParameters; } dhaes_pParameters;
 End of changes. 1 change blocks. 
2 lines changed or deleted 2 lines changed or added


 dldp.h   dldp.h 
skipping to change at line 29 skipping to change at line 29
/*!\file dldp.h /*!\file dldp.h
* \brief Discrete Logarithm domain parameters, headers. * \brief Discrete Logarithm domain parameters, headers.
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup DL_m * \ingroup DL_m
*/ */
#ifndef _DLDP_H #ifndef _DLDP_H
#define _DLDP_H #define _DLDP_H
#include "mpbarrett.h" #include "beecrypt/mpbarrett.h"
/* /*
* Discrete Logarithm Domain Parameters - Prime * Discrete Logarithm Domain Parameters - Prime
* *
* Standard definition where p = qr+1; in case where p=2q+1, r=2 * Standard definition where p = qr+1; in case where p=2q+1, r=2
* *
* In IEEE P1363 naming is p = rk+1 * In IEEE P1363 naming is p = rk+1
* *
* Hence, IEEE prime r = q and cofactor k = r * Hence, IEEE prime r = q and cofactor k = r
* *
skipping to change at line 53 skipping to change at line 53
* g is either a generator of a subgroup of order q, or a generator of orde r * g is either a generator of a subgroup of order q, or a generator of orde r
* n = (p-1) * n = (p-1)
*/ */
/*!\brief Discrete Logarithm Domain Parameters over a prime field. /*!\brief Discrete Logarithm Domain Parameters over a prime field.
* *
* For the variables in this structure /f$p=qr+1/f$; if /f$p=2q+1 then r=2/ f$. * For the variables in this structure /f$p=qr+1/f$; if /f$p=2q+1 then r=2/ f$.
* *
* \ingroup DL_m * \ingroup DL_m
*/ */
typedef struct #ifdef __cplusplus
struct BEECRYPTAPI dldp_p
#else
struct _dldp_p
#endif
{ {
/*!\var p /*!\var p
* \brief The prime. * \brief The prime.
* *
*/ */
mpbarrett p; mpbarrett p;
/*!\var q /*!\var q
* \brief The cofactor. * \brief The cofactor.
* *
* \f$q\f$ is a prime divisor of \f$p-1\f$. * \f$q\f$ is a prime divisor of \f$p-1\f$.
skipping to change at line 83 skipping to change at line 87
* *
* \f$g\f$ is either a generator of \f$\mathds{Z}^{*}_p\f$, or a gen erator * \f$g\f$ is either a generator of \f$\mathds{Z}^{*}_p\f$, or a gen erator
* of a cyclic subgroup \f$G\f$ of \f$\mathds{Z}^{*}_p\f$ of order \ f$q\f$. * of a cyclic subgroup \f$G\f$ of \f$\mathds{Z}^{*}_p\f$ of order \ f$q\f$.
*/ */
mpnumber g; mpnumber g;
/*!\var n /*!\var n
* *
* \f$n=p-1=qr\f$ * \f$n=p-1=qr\f$
*/ */
mpbarrett n; mpbarrett n;
} dldp_p; #ifdef __cplusplus
dldp_p();
dldp_p(const dldp_p&);
~dldp_p();
#endif
};
#ifndef __cplusplus
typedef struct _dldp_p dldp_p;
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* /*
* Functions for setting up and copying * Functions for setting up and copying
*/ */
BEECRYPTAPI BEECRYPTAPI
skipping to change at line 105 skipping to change at line 118
BEECRYPTAPI BEECRYPTAPI
int dldp_pFree(dldp_p*); int dldp_pFree(dldp_p*);
BEECRYPTAPI BEECRYPTAPI
int dldp_pCopy(dldp_p*, const dldp_p*); int dldp_pCopy(dldp_p*, const dldp_p*);
/* /*
* Functions for generating keys * Functions for generating keys
*/ */
BEECRYPTAPI BEECRYPTAPI
int dldp_pPrivate(const dldp_p*, randomGeneratorContext*, mpnumber*); int dldp_pPrivate (const dldp_p*, randomGeneratorContext*, mpnumber*);
BEECRYPTAPI BEECRYPTAPI
int dldp_pPublic (const dldp_p*, const mpnumber*, mpnumber*); int dldp_pPrivate_s(const dldp_p*, randomGeneratorContext*, mpnumber*, size _t);
BEECRYPTAPI BEECRYPTAPI
int dldp_pPair (const dldp_p*, randomGeneratorContext*, mpnumber*, mpnumb int dldp_pPublic (const dldp_p*, const mpnumber*, mpnumber*);
er*); BEECRYPTAPI
int dldp_pPair (const dldp_p*, randomGeneratorContext*, mpnumber*, mpnu
mber*);
BEECRYPTAPI
int dldp_pPair_s (const dldp_p*, randomGeneratorContext*, mpnumber*, mpnu
mber*, size_t);
/* /*
* Function for comparing domain parameters * Function for comparing domain parameters
*/ */
BEECRYPTAPI BEECRYPTAPI
int dldp_pEqual (const dldp_p*, const dldp_p*); int dldp_pEqual (const dldp_p*, const dldp_p*);
/* /*
* Functions for generating and validating dldp_pgoq variant domain paramet ers * Functions for generating and validating dldp_pgoq variant domain paramet ers
*/ */
 End of changes. 6 change blocks. 
7 lines changed or deleted 26 lines changed or added


 dlkp.h   dlkp.h 
skipping to change at line 29 skipping to change at line 29
/*!\file dlkp.h /*!\file dlkp.h
* \brief Discrete Logarithm keypair, headers. * \brief Discrete Logarithm keypair, headers.
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup DL_m * \ingroup DL_m
*/ */
#ifndef _DLKP_H #ifndef _DLKP_H
#define _DLKP_H #define _DLKP_H
#include "dlpk.h" #include "beecrypt/dlpk.h"
/*!\ingroup DL_m /*!\ingroup DL_m
*/ */
typedef struct #ifdef __cplusplus
struct BEECRYPTAPI dlkp_p
#else
struct _dlkp_p
#endif
{ {
dldp_p param; dldp_p param;
mpnumber y; mpnumber y;
mpnumber x; mpnumber x;
} dlkp_p;
#ifdef __cplusplus
dlkp_p();
dlkp_p(const dlkp_p&);
~dlkp_p();
#endif
};
#ifndef __cplusplus
typedef struct _dlkp_p dlkp_p;
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
BEECRYPTAPI BEECRYPTAPI
int dlkp_pPair(dlkp_p*, randomGeneratorContext*, const dldp_p*); int dlkp_pPair(dlkp_p*, randomGeneratorContext*, const dldp_p*);
BEECRYPTAPI BEECRYPTAPI
int dlkp_pInit(dlkp_p*); int dlkp_pInit(dlkp_p*);
BEECRYPTAPI BEECRYPTAPI
 End of changes. 3 change blocks. 
3 lines changed or deleted 17 lines changed or added


 dlpk.h   dlpk.h 
skipping to change at line 29 skipping to change at line 29
/*!\file dlpk.h /*!\file dlpk.h
* \brief Discrete Logarithm public key, headers. * \brief Discrete Logarithm public key, headers.
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup DL_m * \ingroup DL_m
*/ */
#ifndef _DLPK_H #ifndef _DLPK_H
#define _DLPK_H #define _DLPK_H
#include "dldp.h" #include "beecrypt/dldp.h"
/*!\ingroup DL_m /*!\ingroup DL_m
*/ */
typedef struct #ifdef __cplusplus
struct BEECRYPTAPI dlpk_p
#else
struct _dlpk_p
#endif
{ {
dldp_p param; dldp_p param;
mpnumber y; mpnumber y;
} dlpk_p; #ifdef __cplusplus
dlpk_p();
dlpk_p(const dlpk_p&);
~dlpk_p();
#endif
};
#ifndef __cplusplus
typedef struct _dlpk_p dlpk_p;
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
BEECRYPTAPI BEECRYPTAPI
int dlpk_pInit(dlpk_p*); int dlpk_pInit(dlpk_p*);
BEECRYPTAPI BEECRYPTAPI
int dlpk_pFree(dlpk_p*); int dlpk_pFree(dlpk_p*);
BEECRYPTAPI BEECRYPTAPI
 End of changes. 3 change blocks. 
3 lines changed or deleted 16 lines changed or added


 dlsvdp-dh.h   dlsvdp-dh.h 
skipping to change at line 29 skipping to change at line 29
/*!\file dlsvdp-dh.h /*!\file dlsvdp-dh.h
* \brief Diffie-Hellman algorithm, headers. * \brief Diffie-Hellman algorithm, headers.
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup DL_m DL_dh_m * \ingroup DL_m DL_dh_m
*/ */
#ifndef _DLSVDP_DH_H #ifndef _DLSVDP_DH_H
#define _DLSVDP_DH_H #define _DLSVDP_DH_H
#include "dldp.h" #include "beecrypt/dldp.h"
#include "beecrypt/dlkp.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
typedef dldp_p dhparam;
typedef dlkp_p dhkp;
BEECRYPTAPI BEECRYPTAPI
int dlsvdp_pDHSecret(const dldp_p*, const mpnumber*, const mpnumber*, mpnum ber*); int dlsvdp_pDHSecret(const dhparam*, const mpnumber*, const mpnumber*, mpnu mber*);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
 End of changes. 3 change blocks. 
2 lines changed or deleted 6 lines changed or added


 dsa.h   dsa.h 
skipping to change at line 35 skipping to change at line 35
* \f$\mathds{Z}^{*}_p\f$ with order \f$q\f$. The private and public key * \f$\mathds{Z}^{*}_p\f$ with order \f$q\f$. The private and public key
* values are \f$x\f$ and \f$y\f$ respectively. * values are \f$x\f$ and \f$y\f$ respectively.
* *
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup DL_dsa_m * \ingroup DL_dsa_m
*/ */
#ifndef _DSA_H #ifndef _DSA_H
#define _DSA_H #define _DSA_H
#include "dlkp.h" #include "beecrypt/dlkp.h"
typedef dldp_p dsaparam; typedef dldp_p dsaparam;
typedef dlpk_p dsapub; typedef dlpk_p dsapub;
typedef dlkp_p dsakp; typedef dlkp_p dsakp;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/*!\fn int dsasign(const mpbarrett* p, const mpbarrett* q, const mpnumber* g, randomGeneratorContext* rgc, const mpnumber* hm, const mpnumber* x, mpnu mber* r, mpnumber* s) /*!\fn int dsasign(const mpbarrett* p, const mpbarrett* q, const mpnumber* g, randomGeneratorContext* rgc, const mpnumber* hm, const mpnumber* x, mpnu mber* r, mpnumber* s)
skipping to change at line 91 skipping to change at line 91
* \param hm The digest to be verified. * \param hm The digest to be verified.
* \param y The public key value. * \param y The public key value.
* \param r The signature's \e r value. * \param r The signature's \e r value.
* \param s The signature's \e s value. * \param s The signature's \e s value.
* \retval 1 on success. * \retval 1 on success.
* \retval 0 on failure. * \retval 0 on failure.
*/ */
BEECRYPTAPI BEECRYPTAPI
int dsavrfy(const mpbarrett* p, const mpbarrett* q, const mpnumber* g, cons t mpnumber* hm, const mpnumber* y, const mpnumber* r, const mpnumber* s); int dsavrfy(const mpbarrett* p, const mpbarrett* q, const mpnumber* g, cons t mpnumber* hm, const mpnumber* y, const mpnumber* r, const mpnumber* s);
/*!\fn int dsaparamMake(dsaparam* dp, randomGeneratorContext* rgc, size_t p
size)
* \brief This function generates a set of DSA parameters.
*
* This function calls dldp_pgoqMake with appropriate parameters, i.e.
* qsize = 160 bits and cofactor = 1.
*
* \param dp The parameters to be generated.
* \param rgc The random generator context.
* \param psize The size of prime parameter p; psize must be >= 512 and <=
1024, and be a multiple of 64.
* \retval 0 on success.
* \retval -1 on failure.
*/
BEECRYPTAPI
int dsaparamMake(dsaparam*, randomGeneratorContext*, size_t);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
 End of changes. 2 change blocks. 
1 lines changed or deleted 18 lines changed or added


 elgamal.h   elgamal.h 
skipping to change at line 41 skipping to change at line 41
* \todo Explore the possibility of using simultaneous multiple exponentiat ion, * \todo Explore the possibility of using simultaneous multiple exponentiat ion,
* as described in HAC, 14.87 (iii). * as described in HAC, 14.87 (iii).
* *
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup DL_m DL_elgamal_m * \ingroup DL_m DL_elgamal_m
*/ */
#ifndef _ELGAMAL_H #ifndef _ELGAMAL_H
#define _ELGAMAL_H #define _ELGAMAL_H
#include "mpbarrett.h" #include "beecrypt/mpbarrett.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/*!\fn int elgv1sign(const mpbarrett* p, const mpbarrett* n, const mpnumber * g, /*!\fn int elgv1sign(const mpbarrett* p, const mpbarrett* n, const mpnumber * g,
randomGeneratorContext* rgc, const mpnumber* hm, const mpnumber* x, mpnumbe r* r, randomGeneratorContext* rgc, const mpnumber* hm, const mpnumber* x, mpnumbe r* r,
mpnumber* s) mpnumber* s)
* \brief This function performs raw ElGamal signing, variant 1. * \brief This function performs raw ElGamal signing, variant 1.
* *
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 endianness.h   endianness.h 
skipping to change at line 29 skipping to change at line 29
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
*/ */
#ifndef _ENDIANNESS_H #ifndef _ENDIANNESS_H
#define _ENDIANNESS_H #define _ENDIANNESS_H
#include "beecrypt.h" #include "beecrypt/beecrypt.h"
#ifdef __cplusplus #ifdef __cplusplus
inline int16_t swap16(int16_t n) inline int16_t swap16(int16_t n)
{ {
return ( ((n & 0xff) << 8) | return ( ((n & 0xff) << 8) |
((n & 0xff00) >> 8) ); ((n & 0xff00) >> 8) );
} }
inline uint16_t swapu16(uint16_t n) inline uint16_t swapu16(uint16_t n)
{ {
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 entropy.h   entropy.h 
skipping to change at line 29 skipping to change at line 29
/*!\file entropy.h /*!\file entropy.h
* \brief Entropy sources, headers. * \brief Entropy sources, headers.
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup ES_m ES_audio_m ES_dsp_m ES_random_m ES_urandom_m ES_tty_m * \ingroup ES_m ES_audio_m ES_dsp_m ES_random_m ES_urandom_m ES_tty_m
*/ */
#ifndef _ENTROPY_H #ifndef _ENTROPY_H
#define _ENTROPY_H #define _ENTROPY_H
#include "beecrypt.h" #include "beecrypt/beecrypt.h"
#if WIN32 #if WIN32
#include <Windows.h> #include <Windows.h>
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#if WIN32 #if WIN32
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 fips186.h   fips186.h 
skipping to change at line 29 skipping to change at line 29
/*!\file fips186.h /*!\file fips186.h
* \brief FIPS-186 pseudo-random number generator, headers. * \brief FIPS-186 pseudo-random number generator, headers.
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup PRNG_m PRNG_fips186_m * \ingroup PRNG_m PRNG_fips186_m
*/ */
#ifndef _FIPS186_H #ifndef _FIPS186_H
#define _FIPS186_H #define _FIPS186_H
#include "beecrypt.h" #include "beecrypt/beecrypt.h"
#ifdef _REENTRANT #ifdef _REENTRANT
# if WIN32 # if WIN32
# include <windows.h> # include <windows.h>
# include <winbase.h> # include <winbase.h>
# endif # endif
#endif #endif
#include "beecrypt.h" #include "beecrypt.h"
#include "sha1.h" #include "sha1.h"
skipping to change at line 54 skipping to change at line 54
# define FIPS186_STATE_SIZE 16 # define FIPS186_STATE_SIZE 16
#else #else
# error # error
#endif #endif
/*!\ingroup PRNG_fips186_m /*!\ingroup PRNG_fips186_m
*/ */
typedef struct typedef struct
{ {
#ifdef _REENTRANT #ifdef _REENTRANT
# if WIN32 bc_mutex_t lock;
HANDLE lock;
# else
bc_lock_t lock;
# endif
#endif #endif
sha1Param param; sha1Param param;
mpw state[FIPS186_STATE_SIZE]; mpw state[FIPS186_STATE_SIZE];
byte digest[20]; byte digest[20];
unsigned char digestremain; unsigned char digestremain;
} fips186Param; } fips186Param;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
extern BEECRYPTAPI const randomGenerator fips186prng; extern BEECRYPTAPI const randomGenerator fips186prng;
 End of changes. 3 change blocks. 
7 lines changed or deleted 3 lines changed or added


 hmac.h   hmac.h 
skipping to change at line 29 skipping to change at line 29
/*!\file hmac.h /*!\file hmac.h
* \brief HMAC algorithm, headers. * \brief HMAC algorithm, headers.
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup HMAC_m * \ingroup HMAC_m
*/ */
#ifndef _HMAC_H #ifndef _HMAC_H
#define _HMAC_H #define _HMAC_H
#include "beecrypt.h" #include "beecrypt/beecrypt.h"
/*!\ingroup HMAC_m /*!\ingroup HMAC_m
*/ */
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* not used directly as keyed hash function, but instead used as generic me thods */ /* not used directly as keyed hash function, but instead used as generic me thods */
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 hmacmd5.h   hmacmd5.h 
skipping to change at line 29 skipping to change at line 29
/*!\file hmacmd5.h /*!\file hmacmd5.h
* \brief HMAC-MD5 message authentication code, headers. * \brief HMAC-MD5 message authentication code, headers.
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup HMAC_m HMAC_md5_m * \ingroup HMAC_m HMAC_md5_m
*/ */
#ifndef _HMACMD5_H #ifndef _HMACMD5_H
#define _HMACMD5_H #define _HMACMD5_H
#include "hmac.h" #include "beecrypt/hmac.h"
#include "md5.h" #include "beecrypt/md5.h"
/*!\ingroup HMAC_md5_m /*!\ingroup HMAC_md5_m
*/ */
typedef struct typedef struct
{ {
md5Param mparam; md5Param mparam;
byte kxi[64]; byte kxi[64];
byte kxo[64]; byte kxo[64];
} hmacmd5Param; } hmacmd5Param;
 End of changes. 1 change blocks. 
2 lines changed or deleted 2 lines changed or added


 hmacsha1.h   hmacsha1.h 
skipping to change at line 29 skipping to change at line 29
/*!\file hmacsha1.h /*!\file hmacsha1.h
* \brief HMAC-SHA-1 message authentication code, headers. * \brief HMAC-SHA-1 message authentication code, headers.
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup HMAC_m HMAC_sha1_m * \ingroup HMAC_m HMAC_sha1_m
*/ */
#ifndef _HMACSHA1_H #ifndef _HMACSHA1_H
#define _HMACSHA1_H #define _HMACSHA1_H
#include "hmac.h" #include "beecrypt/hmac.h"
#include "sha1.h" #include "beecrypt/sha1.h"
/*!\ingroup HMAC_sha1_m /*!\ingroup HMAC_sha1_m
*/ */
typedef struct typedef struct
{ {
sha1Param sparam; sha1Param sparam;
byte kxi[64]; byte kxi[64];
byte kxo[64]; byte kxo[64];
} hmacsha1Param; } hmacsha1Param;
 End of changes. 1 change blocks. 
2 lines changed or deleted 2 lines changed or added


 hmacsha256.h   hmacsha256.h 
skipping to change at line 29 skipping to change at line 29
/*!\file hmacsha256.h /*!\file hmacsha256.h
* \brief HMAC-SHA-256 message authentication code, headers. * \brief HMAC-SHA-256 message authentication code, headers.
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup HMAC_m HMAC_sha256_m * \ingroup HMAC_m HMAC_sha256_m
*/ */
#ifndef _HMACSHA256_H #ifndef _HMACSHA256_H
#define _HMACSHA256_H #define _HMACSHA256_H
#include "hmac.h" #include "beecrypt/hmac.h"
#include "sha256.h" #include "beecrypt/sha256.h"
/*!\ingroup HMAC_sha256_m /*!\ingroup HMAC_sha256_m
*/ */
typedef struct typedef struct
{ {
sha256Param sparam; sha256Param sparam;
byte kxi[64]; byte kxi[64];
byte kxo[64]; byte kxo[64];
} hmacsha256Param; } hmacsha256Param;
 End of changes. 1 change blocks. 
2 lines changed or deleted 2 lines changed or added


 md5.h   md5.h 
skipping to change at line 29 skipping to change at line 29
/*!\file md5.h /*!\file md5.h
* \brief MD5 hash function. * \brief MD5 hash function.
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup HASH_m HASH_md5_m * \ingroup HASH_m HASH_md5_m
*/ */
#ifndef _MD5_H #ifndef _MD5_H
#define _MD5_H #define _MD5_H
#include "beecrypt.h" #include "beecrypt/beecrypt.h"
/*!\brief Holds all the parameters necessary for the MD5 algorithm. /*!\brief Holds all the parameters necessary for the MD5 algorithm.
* \ingroup HASH_md5_h * \ingroup HASH_md5_h
*/ */
typedef struct typedef struct
{ {
/*!\var h /*!\var h
*/ */
uint32_t h[4]; uint32_t h[4];
/*!\var data /*!\var data
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 memchunk.h   memchunk.h 
skipping to change at line 26 skipping to change at line 26
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
*/ */
/*!\file memchunk.h /*!\file memchunk.h
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
*/ */
#ifndef _MEMCHUNK_H #ifndef _MEMCHUNK_H
#define _MEMCHUNK_H #define _MEMCHUNK_H
#include "beecrypt.api.h" #include "beecrypt/api.h"
typedef struct typedef struct
{ {
size_t size; size_t size;
byte* data; byte* data;
} memchunk; } memchunk;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
BEECRYPTAPI BEECRYPTAPI
memchunk* memchunkAlloc(size_t); memchunk* memchunkAlloc(size_t);
BEECRYPTAPI BEECRYPTAPI
void memchunkWipe(memchunk*);
BEECRYPTAPI
void memchunkFree(memchunk*); void memchunkFree(memchunk*);
BEECRYPTAPI BEECRYPTAPI
memchunk* memchunkResize(memchunk*, size_t); memchunk* memchunkResize(memchunk*, size_t);
BEECRYPTAPI BEECRYPTAPI
memchunk* memchunkClone(const memchunk*); memchunk* memchunkClone(const memchunk*);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
 End of changes. 2 change blocks. 
1 lines changed or deleted 3 lines changed or added


 mp.h   mp.h 
skipping to change at line 44 skipping to change at line 44
* With some smart use of available assembler instructions, it's possible * With some smart use of available assembler instructions, it's possible
* to speed these routines up by a factor of 2 to 4. * to speed these routines up by a factor of 2 to 4.
* *
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup MP_m * \ingroup MP_m
*/ */
#ifndef _MP_H #ifndef _MP_H
#define _MP_H #define _MP_H
#include "beecrypt.api.h" #include "beecrypt/api.h"
#include "mpopt.h" #include "beecrypt/mpopt.h"
#define MP_HWBITS (MP_WBITS >> 1) #define MP_HWBITS (MP_WBITS >> 1)
#define MP_WBYTES (MP_WBITS >> 3) #define MP_WBYTES (MP_WBITS >> 3)
#define MP_WNIBBLES (MP_WBITS >> 2) #define MP_WNIBBLES (MP_WBITS >> 2)
#if (MP_WBITS == 64) #if (MP_WBITS == 64)
# define MP_WORDS_TO_BITS(x) ((x) << 6) # define MP_WORDS_TO_BITS(x) ((x) << 6)
# define MP_WORDS_TO_NIBBLES(x) ((x) << 4) # define MP_WORDS_TO_NIBBLES(x) ((x) << 4)
# define MP_WORDS_TO_BYTES(x) ((x) << 3) # define MP_WORDS_TO_BYTES(x) ((x) << 3)
# define MP_BITS_TO_WORDS(x) ((x) >> 6) # define MP_BITS_TO_WORDS(x) ((x) >> 6)
skipping to change at line 410 skipping to change at line 410
/*!\fn void mpclrlsb(size_t size, mpw* data) /*!\fn void mpclrlsb(size_t size, mpw* data)
* \brief This function clears the least significant bit of a multi-precisi on * \brief This function clears the least significant bit of a multi-precisi on
* integer. * integer.
* \param size The size of the multi-precision integer. * \param size The size of the multi-precision integer.
* \param data The multi-precision integer data. * \param data The multi-precision integer data.
*/ */
BEECRYPTAPI BEECRYPTAPI
void mpclrlsb(size_t size, mpw* data); void mpclrlsb(size_t size, mpw* data);
/*!\fn mpand(size_t size, mpw* xdata, const mpw* ydata)
* \brief This function computes the bit-wise AND of two multi-precision
* integers. Modifies xdata.
* \param size The size of the multi-precision integers.
* \param xdata The multi-precision integer data.
* \param ydata The multi-precision integer data.
*/
BEECRYPTAPI BEECRYPTAPI
void mpand(size_t, mpw*, const mpw*); void mpand(size_t size, mpw* xdata, const mpw* ydata);
/*!\fn void mpor(size_t size, mpw* xdata, const mpw* ydata)
* \brief This function computes the bit-wise OR of two multi-precision
* integers. Modifies xdata.
* \param size The size of the multi-precision integer.
* \param xdata The multi-precision integer data.
* \param ydata The multi-precision integer data.
*/
BEECRYPTAPI BEECRYPTAPI
void mpor(size_t, mpw*, const mpw*); void mpor(size_t size, mpw* xdata, const mpw* ydata);
/*!\fn void mpxor(size_t size, mpw* xdata, const mpw* ydata)
* \brief This function computes the bit-wise XOR of two multi-precision
* integers. Modifies xdata.
* \param size The size of the multi-precision integer.
* \param xdata The multi-precision integer data.
* \param ydata The multi-precision integer data.
*/
BEECRYPTAPI BEECRYPTAPI
void mpxor(size_t, mpw*, const mpw*); void mpxor(size_t size, mpw* xdata, const mpw* ydata);
/*!\fn mpnot(size_t size, mpw* data) /*!\fn mpnot(size_t size, mpw* data)
* \brief This function flips all bits of a multi-precision integer. * \brief This function flips all bits of a multi-precision integer.
* \param size The size of the multi-precision integer. * \param size The size of the multi-precision integer.
* \param data The multi-precision integer data. * \param data The multi-precision integer data.
*/ */
BEECRYPTAPI BEECRYPTAPI
void mpnot(size_t size, mpw* data); void mpnot(size_t size, mpw* data);
/*!\fn void mpsetw(size_t size, mpw* xdata, mpw y) /*!\fn void mpsetw(size_t size, mpw* xdata, mpw y)
skipping to change at line 505 skipping to change at line 526
* \brief This function subtracts two multi-precision integers of equal siz e. * \brief This function subtracts two multi-precision integers of equal siz e.
* The performed operation in pseudocode: x -= y * The performed operation in pseudocode: x -= y
* \param size The size of the multi-precision integers. * \param size The size of the multi-precision integers.
* \param xdata The first multi-precision integer. * \param xdata The first multi-precision integer.
* \param ydata The second multi-precision integer. * \param ydata The second multi-precision integer.
* \return The carry-over value of the operation; this value is either 0 or 1. * \return The carry-over value of the operation; this value is either 0 or 1.
*/ */
BEECRYPTAPI BEECRYPTAPI
int mpsub (size_t size, mpw* xdata, const mpw* ydata); int mpsub (size_t size, mpw* xdata, const mpw* ydata);
/*!\fn int mpaddx(size_t xsize, mpw* xdata, size_t ysize, const mpw* ydata) /*!\fn int mpsubx(size_t xsize, mpw* xdata, size_t ysize, const mpw* ydata)
* \brief This function subtracts two multi-precision integers of different * \brief This function subtracts two multi-precision integers of different
* size. The performed operation in pseudocode: x -= y. * size. The performed operation in pseudocode: x -= y.
* \param xsize The size of the first multi-precision integer. * \param xsize The size of the first multi-precision integer.
* \param xdata The first multi-precision integer. * \param xdata The first multi-precision integer.
* \param ysize The size of the second multi-precision integer. * \param ysize The size of the second multi-precision integer.
* \param ydata The second multi-precision integer. * \param ydata The second multi-precision integer.
* \return The carry-over value of the operation; this value is either 0 or 1. * \return The carry-over value of the operation; this value is either 0 or 1.
*/ */
BEECRYPTAPI BEECRYPTAPI
int mpsubx(size_t xsize, mpw* xdata, size_t ysize, const mpw* ydata); int mpsubx(size_t xsize, mpw* xdata, size_t ysize, const mpw* ydata);
BEECRYPTAPI BEECRYPTAPI
int mpmultwo(size_t size, mpw* data); int mpmultwo(size_t size, mpw* data);
/*!\fn void mpneg(size_t size, mpw* data)
* \brief This function negates a multi-precision integer.
* \param size The size of the multi-precision integer.
* \param data The multi-precision integer data.
*/
BEECRYPTAPI BEECRYPTAPI
void mpneg(size_t size, mpw* data); void mpneg(size_t size, mpw* data);
/*!\fn size_t mpsize(size_t size, const mpw* data)
* \brief This function returns the true size of a multi-precision
* integer, after stripping leading zero words.
* \param size The size of the multi-precision integer.
* \param data The multi-precision integer data.
*/
BEECRYPTAPI BEECRYPTAPI
size_t mpsize(size_t size, const mpw* data); size_t mpsize(size_t size, const mpw* data);
/*!\fn size_t mpbits(size_t size, const mpw* data)
* \brief This function returns the number of significant bits
* in a multi-precision integer.
* \param size The size of the multi-precision integer.
* \param data The multi-precision integer data.
*/
BEECRYPTAPI BEECRYPTAPI
size_t mpbits(size_t size, const mpw* data); size_t mpbits(size_t size, const mpw* data);
BEECRYPTAPI BEECRYPTAPI
size_t mpmszcnt(size_t size, const mpw* data); size_t mpmszcnt(size_t size, const mpw* data);
BEECRYPTAPI BEECRYPTAPI
size_t mplszcnt(size_t size, const mpw* data); size_t mplszcnt(size_t size, const mpw* data);
BEECRYPTAPI BEECRYPTAPI
skipping to change at line 591 skipping to change at line 629
* \retval The carry-over multi-precision word. * \retval The carry-over multi-precision word.
*/ */
BEECRYPTAPI BEECRYPTAPI
mpw mpaddmul (size_t size, mpw* result, const mpw* data, mpw y); mpw mpaddmul (size_t size, mpw* result, const mpw* data, mpw y);
/*!\fn void mpaddsqrtrc(size_t size, mpw* result, const mpw* data) /*!\fn void mpaddsqrtrc(size_t size, mpw* result, const mpw* data)
* \brief This function is used in the calculation of a multi-precision * \brief This function is used in the calculation of a multi-precision
* squaring. * squaring.
*/ */
BEECRYPTAPI BEECRYPTAPI
void mpaddsqrtrc(size_t, mpw*, const mpw*); void mpaddsqrtrc(size_t size, mpw* result, const mpw* data);
/*!\fn void mpmul(mpw* result, size_t xsize, const mpw* xdata, size_t ysize , const mpw* ydata) /*!\fn void mpmul(mpw* result, size_t xsize, const mpw* xdata, size_t ysize , const mpw* ydata)
* \brief This function computes a full multi-precision product. * \brief This function computes a full multi-precision product.
*/ */
BEECRYPTAPI BEECRYPTAPI
void mpmul(mpw*, size_t, const mpw*, size_t, const mpw*); void mpmul(mpw* result, size_t xsize, const mpw* xdata, size_t ysize, const
mpw* ydata);
/*!\fn void mpsqr(mpw* result, size_t size, const mpw* data) /*!\fn void mpsqr(mpw* result, size_t size, const mpw* data)
* \brief This function computes a full multi-precision square. * \brief This function computes a full multi-precision square.
*/ */
BEECRYPTAPI BEECRYPTAPI
void mpsqr(mpw*, size_t, const mpw*); void mpsqr(mpw* result, size_t size, const mpw* data);
BEECRYPTAPI BEECRYPTAPI
void mpgcd_w(size_t, const mpw*, const mpw*, mpw*, mpw*); void mpgcd_w(size_t size, const mpw* xdata, const mpw* ydata, mpw* result,
BEECRYPTAPI mpw* wksp);
int mpextgcd_w(size_t, const mpw*, const mpw*, mpw*, mpw*);
BEECRYPTAPI BEECRYPTAPI
mpw mppndiv(mpw, mpw, mpw); int mpextgcd_w(size_t size, const mpw* xdata, const mpw* ydata, mpw* resul t, mpw* wksp);
BEECRYPTAPI BEECRYPTAPI
void mpnmod(mpw*, size_t, const mpw*, size_t, const mpw*, mpw*); mpw mppndiv(mpw xhi, mpw xlo, mpw y);
BEECRYPTAPI BEECRYPTAPI
void mpmod (mpw*, size_t, const mpw*, size_t, const mpw*, mpw*); void mpmod (mpw* result, size_t xsize, const mpw* xdata, size_t ysize, cons t mpw*ydata, mpw* wksp);
BEECRYPTAPI BEECRYPTAPI
void mpndivmod(mpw*, size_t, const mpw*, size_t, const mpw*, mpw*); void mpndivmod(mpw* result, size_t xsize, const mpw* xdata, size_t ysize, c onst mpw* ydata, mpw* wksp);
/* /*
* Output Routines * Output Routines
*/ */
BEECRYPTAPI BEECRYPTAPI
void mpprint(size_t size, const mpw* data); void mpprint(size_t size, const mpw* data);
BEECRYPTAPI BEECRYPTAPI
void mpprintln(size_t size, const mpw* data); void mpprintln(size_t size, const mpw* data);
skipping to change at line 642 skipping to change at line 679
void mpfprint(FILE* f, size_t size, const mpw* data); void mpfprint(FILE* f, size_t size, const mpw* data);
BEECRYPTAPI BEECRYPTAPI
void mpfprintln(FILE* f, size_t size, const mpw* data); void mpfprintln(FILE* f, size_t size, const mpw* data);
/* /*
* Conversion Routines * Conversion Routines
*/ */
BEECRYPTAPI BEECRYPTAPI
int os2ip(mpw*, size_t, const byte*, size_t); int os2ip(mpw* idata, size_t isize, const byte* osdata, size_t ossize);
BEECRYPTAPI BEECRYPTAPI
int i2osp(byte*, size_t, const mpw*, size_t); int i2osp(byte* osdata, size_t ossize, const mpw* idata, size_t isize);
BEECRYPTAPI BEECRYPTAPI
int hs2ip(mpw*, size_t, const char*, size_t); int hs2ip(mpw* idata, size_t isize, const char* hsdata, size_t hssize);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
 End of changes. 22 change blocks. 
19 lines changed or deleted 58 lines changed or added


 mpbarrett.h   mpbarrett.h 
skipping to change at line 29 skipping to change at line 29
/*!\file mpbarrett.h /*!\file mpbarrett.h
* \brief Multi-precision integer routines using Barrett modular reduction, headers. * \brief Multi-precision integer routines using Barrett modular reduction, headers.
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup MP_m * \ingroup MP_m
*/ */
#ifndef _MPBARRETT_H #ifndef _MPBARRETT_H
#define _MPBARRETT_H #define _MPBARRETT_H
#include "beecrypt.h" #include "beecrypt/beecrypt.h"
#include "mpnumber.h" #include "beecrypt/mpnumber.h"
typedef struct #ifdef __cplusplus
# include <iostream>
#endif
#ifdef __cplusplus
struct BEECRYPTAPI mpbarrett
#else
struct _mpbarrett
#endif
{ {
size_t size; size_t size;
mpw* modl; /* (size) words */ mpw* modl; /* (size) words */
mpw* mu; /* (size+1) words */ mpw* mu; /* (size+1) words */
} mpbarrett;
#ifdef __cplusplus
mpbarrett();
mpbarrett(const mpbarrett&);
~mpbarrett();
const mpbarrett& operator=(const mpbarrett&);
bool operator==(const mpbarrett&);
bool operator!=(const mpbarrett&);
void wipe();
size_t bitlength() const;
#endif
};
#ifndef __cplusplus
typedef struct _mpbarrett mpbarrett;
#else
BEECRYPTAPI
std::ostream& operator<<(std::ostream&, const mpbarrett&);
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
BEECRYPTAPI BEECRYPTAPI
void mpbzero(mpbarrett*); void mpbzero(mpbarrett*);
BEECRYPTAPI BEECRYPTAPI
void mpbinit(mpbarrett*, size_t); void mpbinit(mpbarrett*, size_t);
BEECRYPTAPI BEECRYPTAPI
skipping to change at line 56 skipping to change at line 84
void mpbinit(mpbarrett*, size_t); void mpbinit(mpbarrett*, size_t);
BEECRYPTAPI BEECRYPTAPI
void mpbfree(mpbarrett*); void mpbfree(mpbarrett*);
BEECRYPTAPI BEECRYPTAPI
void mpbcopy(mpbarrett*, const mpbarrett*); void mpbcopy(mpbarrett*, const mpbarrett*);
BEECRYPTAPI BEECRYPTAPI
void mpbwipe(mpbarrett*); void mpbwipe(mpbarrett*);
BEECRYPTAPI BEECRYPTAPI
void mpbset(mpbarrett*, size_t, const mpw*); void mpbset(mpbarrett*, size_t, const mpw*);
BEECRYPTAPI BEECRYPTAPI
void mpbsethex(mpbarrett*, const char*); int mpbsetbin(mpbarrett*, const byte*, size_t);
BEECRYPTAPI
int mpbsethex(mpbarrett*, const char*);
BEECRYPTAPI BEECRYPTAPI
void mpbsubone(const mpbarrett*, mpw*); void mpbsubone(const mpbarrett*, mpw*);
BEECRYPTAPI BEECRYPTAPI
void mpbmu_w(mpbarrett*, mpw*); void mpbmu_w(mpbarrett*, mpw*);
BEECRYPTAPI BEECRYPTAPI
void mpbrnd_w (const mpbarrett*, randomGeneratorContext*, mpw*, mpw*); void mpbrnd_w (const mpbarrett*, randomGeneratorContext*, mpw*, mpw*);
BEECRYPTAPI BEECRYPTAPI
skipping to change at line 118 skipping to change at line 149
BEECRYPTAPI BEECRYPTAPI
void mpbnmulmod(const mpbarrett*, const mpnumber*, const mpnumber*, mpnumbe r*); void mpbnmulmod(const mpbarrett*, const mpnumber*, const mpnumber*, mpnumbe r*);
BEECRYPTAPI BEECRYPTAPI
void mpbnsqrmod(const mpbarrett*, const mpnumber*, mpnumber*); void mpbnsqrmod(const mpbarrett*, const mpnumber*, mpnumber*);
BEECRYPTAPI BEECRYPTAPI
void mpbnpowmod (const mpbarrett*, const mpnumber*, const mpnumber*, mpnu mber*); void mpbnpowmod (const mpbarrett*, const mpnumber*, const mpnumber*, mpnu mber*);
BEECRYPTAPI BEECRYPTAPI
void mpbnpowmodsld(const mpbarrett*, const mpw*, const mpnumber*, mpnumber* ); void mpbnpowmodsld(const mpbarrett*, const mpw*, const mpnumber*, mpnumber* );
BEECRYPTAPI
size_t mpbbits(const mpbarrett*);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
 End of changes. 6 change blocks. 
5 lines changed or deleted 39 lines changed or added


 mpnumber.h   mpnumber.h 
skipping to change at line 29 skipping to change at line 29
/*!\file mpnumber.h /*!\file mpnumber.h
* \brief Multi-precision numbers, headers. * \brief Multi-precision numbers, headers.
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup MP_m * \ingroup MP_m
*/ */
#ifndef _MPNUMBER_H #ifndef _MPNUMBER_H
#define _MPNUMBER_H #define _MPNUMBER_H
#include "mp.h" #include "beecrypt/mp.h"
typedef struct #ifdef __cplusplus
# include <iostream>
#endif
#ifdef __cplusplus
struct BEECRYPTAPI mpnumber
#else
struct _mpnumber
#endif
{ {
size_t size; size_t size;
mpw* data; mpw* data;
} mpnumber;
#ifdef __cplusplus
mpnumber();
mpnumber(unsigned int);
mpnumber(const mpnumber&);
~mpnumber();
const mpnumber& operator=(const mpnumber&);
bool operator==(const mpnumber&);
bool operator!=(const mpnumber&);
void wipe();
size_t bitlength() const;
#endif
};
#ifndef __cplusplus
typedef struct _mpnumber mpnumber;
#else
BEECRYPTAPI
std::ostream& operator<<(std::ostream&, const mpnumber&);
/*
BEECRYPTAPI
std::istream& operator>>(std::istream&, mpnumber&);
*/
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
BEECRYPTAPI BEECRYPTAPI
void mpnzero(mpnumber*); void mpnzero(mpnumber*);
BEECRYPTAPI BEECRYPTAPI
void mpnsize(mpnumber*, size_t); void mpnsize(mpnumber*, size_t);
BEECRYPTAPI BEECRYPTAPI
skipping to change at line 58 skipping to change at line 92
void mpnfree(mpnumber*); void mpnfree(mpnumber*);
BEECRYPTAPI BEECRYPTAPI
void mpncopy(mpnumber*, const mpnumber*); void mpncopy(mpnumber*, const mpnumber*);
BEECRYPTAPI BEECRYPTAPI
void mpnwipe(mpnumber*); void mpnwipe(mpnumber*);
BEECRYPTAPI BEECRYPTAPI
void mpnset (mpnumber*, size_t, const mpw*); void mpnset (mpnumber*, size_t, const mpw*);
BEECRYPTAPI BEECRYPTAPI
void mpnsetw (mpnumber*, mpw); void mpnsetw (mpnumber*, mpw);
BEECRYPTAPI BEECRYPTAPI
void mpnsethex(mpnumber*, const char*); int mpnsetbin(mpnumber*, const byte*, size_t);
BEECRYPTAPI
int mpnsethex(mpnumber*, const char*);
BEECRYPTAPI BEECRYPTAPI
int mpninv(mpnumber*, const mpnumber*, const mpnumber*); int mpninv(mpnumber*, const mpnumber*, const mpnumber*);
/*!\brief Truncate the mpnumber to the specified number of (least significa
nt) bits.
*/
BEECRYPTAPI
size_t mpntrbits(mpnumber*, size_t);
BEECRYPTAPI
size_t mpnbits(const mpnumber*);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
 End of changes. 6 change blocks. 
4 lines changed or deleted 49 lines changed or added


 mpopt.h   mpopt.h 
skipping to change at line 74 skipping to change at line 74
# define ASM_MPADDSQRTRC # define ASM_MPADDSQRTRC
# elif defined(OPTIMIZE_ARM) # elif defined(OPTIMIZE_ARM)
# define ASM_MPSETMUL # define ASM_MPSETMUL
# define ASM_MPADDMUL # define ASM_MPADDMUL
# define ASM_MPADDSQRTRC # define ASM_MPADDSQRTRC
# elif defined(OPTIMIZE_I386) || defined(OPTIMIZE_I486) || defined(OPTIMIZE _I586) || defined(OPTIMIZE_I686) # elif defined(OPTIMIZE_I386) || defined(OPTIMIZE_I486) || defined(OPTIMIZE _I586) || defined(OPTIMIZE_I686)
# define ASM_MPZERO # define ASM_MPZERO
# define ASM_MPFILL # define ASM_MPFILL
# define ASM_MPEVEN # define ASM_MPEVEN
# define ASM_MPODD # define ASM_MPODD
# define ASM_MPADDW
# define ASM_MPSUBW
# define ASM_MPADD # define ASM_MPADD
# define ASM_MPADDW
# define ASM_MPSUB # define ASM_MPSUB
# define ASM_MPSUBW
# define ASM_MPMULTWO # define ASM_MPMULTWO
# define ASM_MPDIVTWO # define ASM_MPDIVTWO
# define ASM_MPSETMUL # define ASM_MPSETMUL
# define ASM_MPADDMUL # define ASM_MPADDMUL
# define ASM_MPADDSQRTRC # define ASM_MPADDSQRTRC
# define ASM_MPPNDIV # define ASM_MPPNDIV
# elif defined(OPTIMIZE_IA64) # elif defined(OPTIMIZE_IA64)
# define ASM_MPZERO # define ASM_MPZERO
# define ASM_MPCOPY # define ASM_MPCOPY
# define ASM_MPADD # define ASM_MPADD
skipping to change at line 100 skipping to change at line 100
# define ASM_MPSETMUL # define ASM_MPSETMUL
# define ASM_MPADDMUL # define ASM_MPADDMUL
# elif defined(OPTIMIZE_M68K) # elif defined(OPTIMIZE_M68K)
# define ASM_MPADD # define ASM_MPADD
# define ASM_MPSUB # define ASM_MPSUB
# define ASM_MPSETMUL # define ASM_MPSETMUL
# define ASM_MPADDMUL # define ASM_MPADDMUL
# define ASM_MPADDSQRTRC # define ASM_MPADDSQRTRC
# elif defined(OPTIMIZE_POWERPC) || defined(OPTIMIZE_POWERPC64) # elif defined(OPTIMIZE_POWERPC) || defined(OPTIMIZE_POWERPC64)
# define ASM_MPSETMUL # define ASM_MPSETMUL
# define ASM_MPADDW
# define ASM_MPSUBW
# define ASM_MPADD # define ASM_MPADD
# define ASM_MPADDW
# define ASM_MPSUB # define ASM_MPSUB
# define ASM_MPSUBW
# define ASM_MPMULTWO # define ASM_MPMULTWO
# define ASM_MPADDMUL # define ASM_MPADDMUL
# define ASM_MPADDSQRTRC # define ASM_MPADDSQRTRC
# elif defined(OPTIMIZE_S390X) # elif defined(OPTIMIZE_S390X)
# define ASM_MPSETMUL # define ASM_MPSETMUL
# define ASM_MPADDMUL # define ASM_MPADDMUL
# elif defined(OPTIMIZE_SPARCV8) # elif defined(OPTIMIZE_SPARCV8)
# define ASM_MPSETMUL # define ASM_MPSETMUL
# define ASM_MPADDMUL # define ASM_MPADDMUL
# define ASM_MPADDSQRTRC # define ASM_MPADDSQRTRC
skipping to change at line 128 skipping to change at line 128
# define ASM_MPSUB # define ASM_MPSUB
# define ASM_MPMULTWO # define ASM_MPMULTWO
# define ASM_MPSETMUL # define ASM_MPSETMUL
# define ASM_MPADDMUL # define ASM_MPADDMUL
# define ASM_MPADDSQRTRC # define ASM_MPADDSQRTRC
# elif defined(OPTIMIZE_X86_64) # elif defined(OPTIMIZE_X86_64)
# define ASM_MPZERO # define ASM_MPZERO
# define ASM_MPFILL # define ASM_MPFILL
# define ASM_MPEVEN # define ASM_MPEVEN
# define ASM_MPODD # define ASM_MPODD
# define ASM_MPADD
# define ASM_MPADDW
# define ASM_MPSUB
# define ASM_MPSUBW
# define ASM_MPDIVTWO
# define ASM_MPMULTWO
# define ASM_MPSETMUL # define ASM_MPSETMUL
# define ASM_MPADDMUL # define ASM_MPADDMUL
# define ASM_MPADDSQRTRC
# endif # endif
#endif #endif
#if defined(__IBMC__) #if defined(__IBMC__)
# if defined(OPTIMIZE_POWERPC) || defined(OPTIMIZE_POWERPC64) # if defined(OPTIMIZE_POWERPC) || defined(OPTIMIZE_POWERPC64)
# define ASM_MPSETMUL # define ASM_MPSETMUL
# define ASM_MPADDW # define ASM_MPADDW
# define ASM_MPSUBW # define ASM_MPSUBW
# define ASM_MPADD # define ASM_MPADD
# define ASM_MPSUB # define ASM_MPSUB
 End of changes. 8 change blocks. 
4 lines changed or deleted 11 lines changed or added


 mpprime.h   mpprime.h 
skipping to change at line 29 skipping to change at line 29
/*!\file mpprime.h /*!\file mpprime.h
* \brief Multi-precision primes, headers. * \brief Multi-precision primes, headers.
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup MP_m * \ingroup MP_m
*/ */
#ifndef _MPPRIME_H #ifndef _MPPRIME_H
#define _MPPRIME_H #define _MPPRIME_H
#include "mpbarrett.h" #include "beecrypt/mpbarrett.h"
#define SMALL_PRIMES_PRODUCT_MAX 32 #define SMALL_PRIMES_PRODUCT_MAX 32
extern mpw* mpspprod[SMALL_PRIMES_PRODUCT_MAX]; extern mpw* mpspprod[SMALL_PRIMES_PRODUCT_MAX];
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
BEECRYPTAPI BEECRYPTAPI
int mpptrials (size_t); int mpptrials (size_t);
BEECRYPTAPI BEECRYPTAPI
int mppmilrab_w (const mpbarrett*, randomGeneratorContext*, int, mpw*); int mppmilrab_w (const mpbarrett*, randomGeneratorContext*, int, mpw*);
BEECRYPTAPI BEECRYPTAPI
void mpprnd_w (mpbarrett*, randomGeneratorContext*, size_t, int, const int mpprnd_w (mpbarrett*, randomGeneratorContext*, size_t, int, const
mpnumber*, mpw*); mpnumber*, mpw*);
BEECRYPTAPI
int mpprndr_w (mpbarrett*, randomGeneratorContext*, size_t, int, const
mpnumber*, const mpnumber*, const mpnumber*, mpw*);
BEECRYPTAPI BEECRYPTAPI
void mpprndsafe_w (mpbarrett*, randomGeneratorContext*, size_t, int, mpw*) ; void mpprndsafe_w (mpbarrett*, randomGeneratorContext*, size_t, int, mpw*) ;
BEECRYPTAPI BEECRYPTAPI
void mpprndcon_w (mpbarrett*, randomGeneratorContext*, size_t, int, const mpnumber*, const mpnumber*, const mpnumber*, mpnumber*, mpw*); void mpprndcon_w (mpbarrett*, randomGeneratorContext*, size_t, int, const mpnumber*, const mpnumber*, const mpnumber*, mpnumber*, mpw*);
BEECRYPTAPI BEECRYPTAPI
void mpprndconone_w(mpbarrett*, randomGeneratorContext*, size_t, int, const mpbarrett*, const mpnumber*, mpnumber*, int, mpw*); void mpprndconone_w(mpbarrett*, randomGeneratorContext*, size_t, int, const mpbarrett*, const mpnumber*, mpnumber*, int, mpw*);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
 End of changes. 2 change blocks. 
3 lines changed or deleted 6 lines changed or added


 mtprng.h   mtprng.h 
skipping to change at line 29 skipping to change at line 29
/*!\file mtprng.h /*!\file mtprng.h
* \brief Mersenne Twister pseudo-random number generator, headers. * \brief Mersenne Twister pseudo-random number generator, headers.
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup PRNG_m * \ingroup PRNG_m
*/ */
#ifndef _MTPRNG_H #ifndef _MTPRNG_H
#define _MTPRNG_H #define _MTPRNG_H
#include "beecrypt.h" #include "beecrypt/beecrypt.h"
#ifdef _REENTRANT #ifdef _REENTRANT
# if WIN32 # if WIN32
# include <windows.h> # include <windows.h>
# include <winbase.h> # include <winbase.h>
# endif # endif
#endif #endif
#define N 624 #define N 624
#define M 397 #define M 397
#define K 0x9908B0DFU #define K 0x9908B0DFU
/* /*
*/ */
typedef struct typedef struct
{ {
#ifdef _REENTRANT #ifdef _REENTRANT
# if WIN32 bc_mutex_t lock;
HANDLE lock;
# else
bc_lock_t lock;
# endif
#endif #endif
uint32_t state[N+1]; uint32_t state[N+1];
uint32_t left; uint32_t left;
uint32_t* nextw; uint32_t* nextw;
} mtprngParam; } mtprngParam;
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
 End of changes. 2 change blocks. 
6 lines changed or deleted 2 lines changed or added


 rsa.h   rsa.h 
skipping to change at line 29 skipping to change at line 29
/*!\file rsa.h /*!\file rsa.h
* \brief RSA algorithm. * \brief RSA algorithm.
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup IF_m IF_rsa_m * \ingroup IF_m IF_rsa_m
*/ */
#ifndef _RSA_H #ifndef _RSA_H
#define _RSA_H #define _RSA_H
#include "rsakp.h" #include "beecrypt/rsakp.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/*!\fn int rsapub(const rsapk* pk, const mpnumber* m, mpnumber* c) /*!\fn int rsapub(const mpbarrett* n, const mpnumber* e, const mpnumber* m, mpnumber* c)
* \brief This function performs a raw RSA public key operation. * \brief This function performs a raw RSA public key operation.
* *
* This function can be used for encryption and verifying. * This function can be used for encryption and verifying.
* *
* It performs the following operation: * It performs the following operation:
* \li \f$c=m^{e}\ \textrm{mod}\ n\f$ * \li \f$c=m^{e}\ \textrm{mod}\ n\f$
* *
* \param pk The RSA public key. * \param n The RSA modulus.
* \param e The RSA public exponent.
* \param m The message. * \param m The message.
* \param c The ciphertext. * \param c The ciphertext.
* \retval 0 on success. * \retval 0 on success.
* \retval -1 on failure. * \retval -1 on failure.
*/ */
BEECRYPTAPI BEECRYPTAPI
int rsapub (const rsapk* pk, const mpnumber* m, mpnumber* c); int rsapub(const mpbarrett* n, const mpnumber* e,
const mpnumber* m, mpnumber* c);
/*!\fn int rsapri(const rsakp* kp, const mpnumber* c, mpnumber* m) /*!\fn int rsapri(const mpbarrett* n, const mpnumber* d, const mpnumber* c, mpnumber* m)
* \brief This function performs a raw RSA private key operation. * \brief This function performs a raw RSA private key operation.
* *
* This function can be used for decryption and signing. * This function can be used for decryption and signing.
* *
* It performs the operation: * It performs the operation:
* \li \f$m=c^{d}\ \textrm{mod}\ n\f$ * \li \f$m=c^{d}\ \textrm{mod}\ n\f$
* *
* \param kp The RSA keypair. * \param n The RSA modulus.
* \param d The RSA private exponent.
* \param c The ciphertext. * \param c The ciphertext.
* \param m The message. * \param m The message.
* \retval 0 on success. * \retval 0 on success.
* \retval -1 on failure. * \retval -1 on failure.
*/ */
BEECRYPTAPI BEECRYPTAPI
int rsapri (const rsakp* kp, const mpnumber* c, mpnumber* m); int rsapri(const mpbarrett* n, const mpnumber* d,
const mpnumber* c, mpnumber* m);
/*!\fn int rsapricrt(const rsakp* kp, const mpnumber* c, mpnumber* m) /*!\fn int rsapricrt(const mpbarrett* n, const mpbarrett* p, const mpbarret
t* q, const mpnumber* dp, const mpnumber* dq, const mpnumber* qi, const mpn
umber* c, mpnumber* m)
*
* \brief This function performs a raw RSA private key operation, with * \brief This function performs a raw RSA private key operation, with
* application of the Chinese Remainder Theorem. * application of the Chinese Remainder Theorem.
* *
* It performs the operation: * It performs the operation:
* \li \f$j_1=c^{d_1}\ \textrm{mod}\ p\f$ * \li \f$j_1=c^{dp}\ \textrm{mod}\ p\f$
* \li \f$j_2=c^{d_2}\ \textrm{mod}\ q\f$ * \li \f$j_2=c^{dq}\ \textrm{mod}\ q\f$
* \li \f$h=c \cdot (j_1-j_2)\ \textrm{mod}\ p\f$ * \li \f$h=qi \cdot (j_1-j_2)\ \textrm{mod}\ p\f$
* \li \f$m=j_2+hq\f$ * \li \f$m=j_2+hq\f$
* *
* \param kp The RSA keypair. * \param n The RSA modulus.
* \param p The first RSA prime factor.
* \param q The second RSA prime factor.
* \param dp
* \param dq
* \param qi
* \param c The ciphertext. * \param c The ciphertext.
* \param m The message. * \param m The message.
* \retval 0 on success. * \retval 0 on success.
* \retval -1 on failure. * \retval -1 on failure.
*/ */
BEECRYPTAPI BEECRYPTAPI
int rsapricrt(const rsakp* kp, const mpnumber* c, mpnumber* m); int rsapricrt(const mpbarrett* n, const mpbarrett* p, const mpbarrett* q,
const mpnumber* dp, const mpnumber* dq, const mpnumber* qi,
const mpnumber* c, mpnumber* m);
/*!\fn int rsavrfy(const rsapk* pk, const mpnumber* m, const mpnumber* c) /*!\fn int rsavrfy(const mpbarrett* n, const mpnumber* e, const mpnumber* m , const mpnumber* c)
* \brief This function performs a raw RSA verification. * \brief This function performs a raw RSA verification.
* *
* It verifies if ciphertext \a c was encrypted from cleartext \a m * It verifies if ciphertext \a c was encrypted from cleartext \a m
* with the private key matching the given public key \a pk. * with the private key matching the given public key \a (n, e).
* *
* \param pk The public key. * \param n The RSA modulus.
* \param e The RSA public exponent.
* \param m The cleartext message. * \param m The cleartext message.
* \param c The ciphertext message. * \param c The ciphertext message.
* \retval 1 on success. * \retval 1 on success.
* \retval 0 on failure. * \retval 0 on failure.
*/ */
BEECRYPTAPI BEECRYPTAPI
int rsavrfy (const rsapk* pk, const mpnumber* m, const mpnumber* c); int rsavrfy(const mpbarrett* n, const mpnumber* e,
const mpnumber* m, const mpnumber* c);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif #endif
 End of changes. 15 change blocks. 
17 lines changed or deleted 33 lines changed or added


 rsakp.h   rsakp.h 
skipping to change at line 29 skipping to change at line 29
/*!\file rsakp.h /*!\file rsakp.h
* \brief RSA keypair, headers. * \brief RSA keypair, headers.
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup IF_m IF_rsa_m * \ingroup IF_m IF_rsa_m
*/ */
#ifndef _RSAKP_H #ifndef _RSAKP_H
#define _RSAKP_H #define _RSAKP_H
#include "rsapk.h" #include "beecrypt/rsapk.h"
/*!\brief RSA keypair. /*!\brief RSA keypair.
* \ingroup IF_rsa_m * \ingroup IF_rsa_m
*/ */
typedef struct #ifdef __cplusplus
struct BEECRYPTAPI rsakp
#else
struct _rsakp
#endif
{ {
/*!\var n /*!\var n
* \brief The modulus. * \brief The modulus.
* *
* \f$n=pq\f$ * \f$n=pq\f$
*/ */
mpbarrett n; mpbarrett n;
/*!\var e /*!\var e
* \brief The public exponent. * \brief The public exponent.
*/ */
skipping to change at line 58 skipping to change at line 62
*/ */
mpnumber d; mpnumber d;
/*!\var p /*!\var p
* \brief The first prime factor of the modulus. * \brief The first prime factor of the modulus.
*/ */
mpbarrett p; mpbarrett p;
/*!\var q /*!\var q
* \brief The second prime factor of the modulus. * \brief The second prime factor of the modulus.
*/ */
mpbarrett q; mpbarrett q;
/*!\var d1 /*!\var dp
* * \brief the first prime coefficient.
* \f$d_1=d\ \textrm{mod}\ (p-1)\f$ * \f$dp=d\ \textrm{mod}\ (p-1)\f$
*/ */
mpnumber d1; mpnumber dp;
/*!\var d2 /*!\var dq
* * \brief the second prime coefficient.
* \f$d_2=d\ \textrm{mod}\ (q-1)\f$ * \f$dq=d\ \textrm{mod}\ (q-1)\f$
*/ */
mpnumber d2; mpnumber dq;
/*!\var q /*!\var qi
* * \brief the crt coefficient.
* \f$c=q^{-1}\ \textrm{mod}\ p\f$ * \f$qi=q^{-1}\ \textrm{mod}\ p\f$
*/ */
mpnumber c; mpnumber qi;
} rsakp; #ifdef __cplusplus
rsakp();
rsakp(const rsakp&);
~rsakp();
#endif
};
#ifndef __cplusplus
typedef struct _rsakp rsakp;
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
BEECRYPTAPI BEECRYPTAPI
int rsakpMake(rsakp*, randomGeneratorContext*, int); int rsakpMake(rsakp*, randomGeneratorContext*, size_t);
BEECRYPTAPI BEECRYPTAPI
int rsakpInit(rsakp*); int rsakpInit(rsakp*);
BEECRYPTAPI BEECRYPTAPI
int rsakpFree(rsakp*); int rsakpFree(rsakp*);
BEECRYPTAPI BEECRYPTAPI
int rsakpCopy(rsakp*, const rsakp*); int rsakpCopy(rsakp*, const rsakp*);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
 End of changes. 7 change blocks. 
16 lines changed or deleted 29 lines changed or added


 rsapk.h   rsapk.h 
skipping to change at line 29 skipping to change at line 29
/*!\file rsapk.h /*!\file rsapk.h
* \brief RSA public key, headers. * \brief RSA public key, headers.
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup IF_m IF_rsa_m * \ingroup IF_m IF_rsa_m
*/ */
#ifndef _RSAPK_H #ifndef _RSAPK_H
#define _RSAPK_H #define _RSAPK_H
#include "mpbarrett.h" #include "beecrypt/mpbarrett.h"
typedef struct #ifdef __cplusplus
struct BEECRYPTAPI rsapk
#else
struct _rsapk
#endif
{ {
mpbarrett n; mpbarrett n;
mpnumber e; mpnumber e;
} rsapk; #ifdef __cplusplus
rsapk();
rsapk(const rsapk&);
~rsapk();
#endif
};
#ifndef __cplusplus
typedef struct _rsapk rsapk;
#endif
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
BEECRYPTAPI BEECRYPTAPI
int rsapkInit(rsapk*); int rsapkInit(rsapk*);
BEECRYPTAPI BEECRYPTAPI
int rsapkFree(rsapk*); int rsapkFree(rsapk*);
BEECRYPTAPI BEECRYPTAPI
 End of changes. 3 change blocks. 
3 lines changed or deleted 16 lines changed or added


 sha1.h   sha1.h 
skipping to change at line 29 skipping to change at line 29
/*!\file sha1.h /*!\file sha1.h
* \brief SHA-1 hash function, headers. * \brief SHA-1 hash function, headers.
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup HASH_m HASH_sha1_m * \ingroup HASH_m HASH_sha1_m
*/ */
#ifndef _SHA1_H #ifndef _SHA1_H
#define _SHA1_H #define _SHA1_H
#include "beecrypt.h" #include "beecrypt/beecrypt.h"
#include "sha1opt.h" #include "beecrypt/sha1opt.h"
/*!\brief Holds all the parameters necessary for the SHA-1 algorithm. /*!\brief Holds all the parameters necessary for the SHA-1 algorithm.
* \ingroup HASH_sha1_m * \ingroup HASH_sha1_m
*/ */
typedef struct typedef struct
{ {
/*!\var h /*!\var h
*/ */
uint32_t h[5]; uint32_t h[5];
/*!\var data /*!\var data
 End of changes. 1 change blocks. 
2 lines changed or deleted 2 lines changed or added


 sha1opt.h   sha1opt.h 
skipping to change at line 29 skipping to change at line 29
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
*/ */
#ifndef _SHA1OPT_H #ifndef _SHA1OPT_H
#define _SHA1OPT_H #define _SHA1OPT_H
#include "beecrypt.h" #include "beecrypt/beecrypt.h"
#include "sha1.h" #include "beecrypt/sha1.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#if WIN32 #if WIN32
# if defined(_MSC_VER) && defined(_M_IX86) # if defined(_MSC_VER) && defined(_M_IX86)
# define ASM_SHA1PROCESS # define ASM_SHA1PROCESS
# elif __INTEL__ && __MWERKS__ # elif __INTEL__ && __MWERKS__
# define ASM_SHA1PROCESS # define ASM_SHA1PROCESS
 End of changes. 1 change blocks. 
2 lines changed or deleted 2 lines changed or added


 sha256.h   sha256.h 
skipping to change at line 29 skipping to change at line 29
/*!\file sha256.h /*!\file sha256.h
* \brief SHA-256 hash function, headers. * \brief SHA-256 hash function, headers.
* \author Bob Deblier <bob.deblier@pandora.be> * \author Bob Deblier <bob.deblier@pandora.be>
* \ingroup HASH_m HASH_sha256_m * \ingroup HASH_m HASH_sha256_m
*/ */
#ifndef _SHA256_H #ifndef _SHA256_H
#define _SHA256_H #define _SHA256_H
#include "beecrypt.h" #include "beecrypt/beecrypt.h"
/*!\brief Holds all the parameters necessary for the SHA-256 algorithm. /*!\brief Holds all the parameters necessary for the SHA-256 algorithm.
* \ingroup HASH_sha256_m * \ingroup HASH_sha256_m
*/ */
typedef struct typedef struct
{ {
/*!\var h /*!\var h
*/ */
uint32_t h[8]; uint32_t h[8];
/*!\var data /*!\var data
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 timestamp.h   timestamp.h 
skipping to change at line 29 skipping to change at line 29
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 US A
* *
*/ */
#ifndef _TIMESTAMP_H #ifndef _TIMESTAMP_H
#define _TIMESTAMP_H #define _TIMESTAMP_H
#include "beecrypt.h" #include "beecrypt/beecrypt.h"
#if HAVE_LONG_LONG #if HAVE_LONG_LONG
# define ONE_SECOND 1000LL # define ONE_SECOND 1000LL
# define ONE_MINUTE 60000LL # define ONE_MINUTE 60000LL
# define ONE_HOUR 3600000LL # define ONE_HOUR 3600000LL
# define ONE_DAY 86400000LL # define ONE_DAY 86400000LL
# define ONE_WEEK 604800000LL # define ONE_WEEK 604800000LL
# define ONE_YEAR 31536000000LL # define ONE_YEAR 31536000000LL
#else #else
# define ONE_SECOND 1000L # define ONE_SECOND 1000L
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/