Skip to content

Commit

Permalink
Fix redefinition error
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasjones committed May 24, 2014
1 parent adce8dc commit afc2d00
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
12 changes: 6 additions & 6 deletions crypto/c_groestl.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ static void F512(uint32_t *h, const uint32_t *m) {


/* digest up to msglen bytes of input (full blocks only) */
static void Transform(hashState *ctx,
static void Transform(groestlHashState *ctx,
const uint8_t *input,
int msglen) {

Expand All @@ -176,7 +176,7 @@ static void Transform(hashState *ctx,
}

/* given state h, do h <- P(h)+h */
static void OutputTransformation(hashState *ctx) {
static void OutputTransformation(groestlHashState *ctx) {
int j;
uint32_t temp[2*COLS512];
uint32_t y[2*COLS512];
Expand All @@ -203,7 +203,7 @@ static void OutputTransformation(hashState *ctx) {
}

/* initialise context */
static void Init(hashState* ctx) {
static void Init(groestlHashState* ctx) {
int i = 0;
/* allocate memory for state and data buffer */

Expand All @@ -223,7 +223,7 @@ static void Init(hashState* ctx) {
}

/* update state with databitlen bits of input */
static void Update(hashState* ctx,
static void Update(groestlHashState* ctx,
const BitSequence* input,
DataLength databitlen) {
int index = 0;
Expand Down Expand Up @@ -272,7 +272,7 @@ static void Update(hashState* ctx,

/* finalise: process remaining data (including padding), perform
output transformation, and write hash result to 'output' */
static void Final(hashState* ctx,
static void Final(groestlHashState* ctx,
BitSequence* output) {
int i, j = 0, hashbytelen = HASH_BIT_LEN/8;
uint8_t *s = (BitSequence*)ctx->chaining;
Expand Down Expand Up @@ -336,7 +336,7 @@ void groestl(const BitSequence* data,
DataLength databitlen,
BitSequence* hashval) {

hashState context;
groestlHashState context;

/* initialise */
Init(&context);
Expand Down
6 changes: 3 additions & 3 deletions crypto/c_groestl.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ typedef crypto_uint64 uint64_t;
*/
#include <stdint.h>

#include "hash.h"

/* some sizes (number of bytes) */
#define ROWS 8
#define LENGTHFIELDLEN ROWS
Expand All @@ -33,8 +35,6 @@ typedef crypto_uint64 uint64_t;


/* NIST API begin */
typedef unsigned char BitSequence;
typedef unsigned long long DataLength;
typedef struct {
uint32_t chaining[SIZE512/sizeof(uint32_t)]; /* actual state */
uint32_t block_counter1,
Expand All @@ -43,7 +43,7 @@ typedef struct {
int buf_ptr; /* data buffer pointer */
int bits_in_last_byte; /* no. of message bits in last byte of
data buffer */
} hashState;
} groestlHashState;

/*void Init(hashState*);
void Update(hashState*, const BitSequence*, DataLength);
Expand Down
4 changes: 1 addition & 3 deletions crypto/c_jh.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
*/
#pragma once

typedef unsigned char BitSequence;
typedef unsigned long long DataLength;
typedef enum {SUCCESS = 0, FAIL = 1, BAD_HASHLEN = 2} HashReturn;
#include "hash.h"

HashReturn jh_hash(int hashbitlen, const BitSequence *data, DataLength databitlen, BitSequence *hashval);
5 changes: 5 additions & 0 deletions crypto/hash.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#pragma once

typedef unsigned char BitSequence;
typedef unsigned long long DataLength;
typedef enum {SUCCESS = 0, FAIL = 1, BAD_HASHLEN = 2} HashReturn;

0 comments on commit afc2d00

Please sign in to comment.