Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fixes to allow for inclusion of multiple headers
The typedefs used in header files are protected by
the CRYPTO_TYPES macro so that if one includes more
thann one header files, one does not see multiple
typedef errors.

Changed BYTE and WORD typedefs to ensure that they
are unsigned 8 and 32 bit values.
  • Loading branch information
lcn2 committed May 30, 2017
commit a9a6897982dac209f0ccd8770843dab42c396f3e
8 changes: 6 additions & 2 deletions aes.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@

/*************************** HEADER FILES ***************************/
#include <stddef.h>
#include <stdint.h>

/****************************** MACROS ******************************/
#define AES_BLOCK_SIZE 16 // AES operates on 16 bytes at a time

/**************************** DATA TYPES ****************************/
typedef unsigned char BYTE; // 8-bit byte
typedef unsigned int WORD; // 32-bit word, change to "long" for 16-bit machines
#if !defined(CRYPTO_TYPES)
typedef uint8_t BYTE; // 8-bit byte
typedef uint32_t WORD; // 32-bit word, change to "long" for 16-bit machines
#define CRYPTO_TYPES
#endif

/*********************** FUNCTION DECLARATIONS **********************/
///////////////////
Expand Down
6 changes: 5 additions & 1 deletion arcfour.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@

/*************************** HEADER FILES ***************************/
#include <stddef.h>
#include <stdint.h>

/**************************** DATA TYPES ****************************/
typedef unsigned char BYTE; // 8-bit byte
#if !defined(CRYPTO_TYPES)
typedef uint8_t BYTE; // 8-bit byte
#define CRYPTO_TYPES
#endif

/*********************** FUNCTION DECLARATIONS **********************/
// Input: state - the state used to generate the keystream
Expand Down
6 changes: 5 additions & 1 deletion base64.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@

/*************************** HEADER FILES ***************************/
#include <stddef.h>
#include <stdint.h>

/**************************** DATA TYPES ****************************/
typedef unsigned char BYTE; // 8-bit byte
#if !defined(CRYPTO_TYPES)
typedef uint8_t BYTE; // 8-bit byte
#define CRYPTO_TYPES
#endif

/*********************** FUNCTION DECLARATIONS **********************/
// Returns the size of the output. If called with out = NULL, will just return
Expand Down
8 changes: 6 additions & 2 deletions blowfish.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@

/*************************** HEADER FILES ***************************/
#include <stddef.h>
#include <stdint.h>

/****************************** MACROS ******************************/
#define BLOWFISH_BLOCK_SIZE 8 // Blowfish operates on 8 bytes at a time

/**************************** DATA TYPES ****************************/
typedef unsigned char BYTE; // 8-bit byte
typedef unsigned int WORD; // 32-bit word, change to "long" for 16-bit machines
#if !defined(CRYPTO_TYPES)
typedef uint8_t BYTE; // 8-bit byte
typedef uint32_t WORD; // 32-bit word, change to "long" for 16-bit machines
#define CRYPTO_TYPES
#endif

typedef struct {
WORD p[18];
Expand Down
8 changes: 6 additions & 2 deletions des.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@

/*************************** HEADER FILES ***************************/
#include <stddef.h>
#include <stdint.h>

/****************************** MACROS ******************************/
#define DES_BLOCK_SIZE 8 // DES operates on 8 bytes at a time

/**************************** DATA TYPES ****************************/
typedef unsigned char BYTE; // 8-bit byte
typedef unsigned int WORD; // 32-bit word, change to "long" for 16-bit machines
#if !defined(CRYPTO_TYPES)
typedef uint8_t BYTE; // 8-bit byte
typedef uint32_t WORD; // 32-bit word, change to "long" for 16-bit machines
#define CRYPTO_TYPES
#endif

typedef enum {
DES_ENCRYPT,
Expand Down
6 changes: 5 additions & 1 deletion md2.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,16 @@

/*************************** HEADER FILES ***************************/
#include <stddef.h>
#include <stdint.h>

/****************************** MACROS ******************************/
#define MD2_BLOCK_SIZE 16

/**************************** DATA TYPES ****************************/
typedef unsigned char BYTE; // 8-bit byte
#if !defined(CRYPTO_TYPES)
typedef uint8_t BYTE; // 8-bit byte
#define CRYPTO_TYPES
#endif

typedef struct {
BYTE data[16];
Expand Down
8 changes: 6 additions & 2 deletions md5.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@

/*************************** HEADER FILES ***************************/
#include <stddef.h>
#include <stdint.h>

/****************************** MACROS ******************************/
#define MD5_BLOCK_SIZE 16 // MD5 outputs a 16 byte digest

/**************************** DATA TYPES ****************************/
typedef unsigned char BYTE; // 8-bit byte
typedef unsigned int WORD; // 32-bit word, change to "long" for 16-bit machines
#if !defined(CRYPTO_TYPES)
typedef uint8_t BYTE; // 8-bit byte
typedef uint32_t WORD; // 32-bit word, change to "long" for 16-bit machines
#define CRYPTO_TYPES
#endif

typedef struct {
BYTE data[64];
Expand Down
8 changes: 6 additions & 2 deletions sha1.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@

/*************************** HEADER FILES ***************************/
#include <stddef.h>
#include <stdint.h>

/****************************** MACROS ******************************/
#define SHA1_BLOCK_SIZE 20 // SHA1 outputs a 20 byte digest

/**************************** DATA TYPES ****************************/
typedef unsigned char BYTE; // 8-bit byte
typedef unsigned int WORD; // 32-bit word, change to "long" for 16-bit machines
#if !defined(CRYPTO_TYPES)
typedef uint8_t BYTE; // 8-bit byte
typedef uint32_t WORD; // 32-bit word, change to "long" for 16-bit machines
#define CRYPTO_TYPES
#endif

typedef struct {
BYTE data[64];
Expand Down
8 changes: 6 additions & 2 deletions sha256.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,17 @@

/*************************** HEADER FILES ***************************/
#include <stddef.h>
#include <stdint.h>

/****************************** MACROS ******************************/
#define SHA256_BLOCK_SIZE 32 // SHA256 outputs a 32 byte digest

/**************************** DATA TYPES ****************************/
typedef unsigned char BYTE; // 8-bit byte
typedef unsigned int WORD; // 32-bit word, change to "long" for 16-bit machines
#if !defined(CRYPTO_TYPES)
typedef uint8_t BYTE; // 8-bit byte
typedef uint32_t WORD; // 32-bit word, change to "long" for 16-bit machines
#define CRYPTO_TYPES
#endif

typedef struct {
BYTE data[64];
Expand Down