Skip to content

Commit ecd7d90

Browse files
committed
Merge pull request PhearNet#13 from LucasJones/master
Fix compiler error
2 parents ebb8c04 + 1505af5 commit ecd7d90

File tree

11 files changed

+28
-25
lines changed

11 files changed

+28
-25
lines changed

crypto/c_groestl.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ static void OutputTransformation(hashState *ctx) {
204204

205205
/* initialise context */
206206
static void Init(hashState* ctx) {
207-
int i = 0;
207+
uint32_t i = 0;
208208
/* allocate memory for state and data buffer */
209209

210210
for(;i<(SIZE512/sizeof(uint32_t));i++)

crypto/c_groestl.h

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#ifndef __hash_h
2-
#define __hash_h
1+
#pragma once
32
/*
43
#include "crypto_uint8.h"
54
#include "crypto_uint32.h"
@@ -11,6 +10,7 @@ typedef crypto_uint32 uint32_t;
1110
typedef crypto_uint64 uint64_t;
1211
*/
1312
#include <stdint.h>
13+
#include "hash.h"
1414

1515
/* some sizes (number of bytes) */
1616
#define ROWS 8
@@ -33,8 +33,6 @@ typedef crypto_uint64 uint64_t;
3333

3434

3535
/* NIST API begin */
36-
typedef unsigned char BitSequence;
37-
typedef unsigned long long DataLength;
3836
typedef struct {
3937
uint32_t chaining[SIZE512/sizeof(uint32_t)]; /* actual state */
4038
uint32_t block_counter1,
@@ -56,5 +54,3 @@ int crypto_hash(unsigned char *out,
5654
const unsigned char *in,
5755
unsigned long long len);
5856
*/
59-
60-
#endif /* __hash_h */

crypto/c_jh.h

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
Last Modified: January 16, 2011
1414
*/
1515
#pragma once
16+
#include "hash.h"
1617

17-
typedef unsigned char BitSequence;
18-
typedef unsigned long long DataLength;
1918
typedef enum {SUCCESS = 0, FAIL = 1, BAD_HASHLEN = 2} HashReturn;
2019

2120
HashReturn jh_hash(int hashbitlen, const BitSequence *data, DataLength databitlen, BitSequence *hashval);

crypto/c_skein.c

+6-6
Original file line numberDiff line numberDiff line change
@@ -1934,8 +1934,8 @@ hashState;
19341934

19351935
/* "incremental" hashing API */
19361936
static SkeinHashReturn Init (hashState *state, int hashbitlen);
1937-
static SkeinHashReturn Update(hashState *state, const SkeinBitSequence *data, SkeinDataLength databitlen);
1938-
static SkeinHashReturn Final (hashState *state, SkeinBitSequence *hashval);
1937+
static SkeinHashReturn Update(hashState *state, const BitSequence *data, DataLength databitlen);
1938+
static SkeinHashReturn Final (hashState *state, BitSequence *hashval);
19391939

19401940
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
19411941
/* select the context size and init the context */
@@ -1963,7 +1963,7 @@ static SkeinHashReturn Init(hashState *state, int hashbitlen)
19631963

19641964
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
19651965
/* process data to be hashed */
1966-
static SkeinHashReturn Update(hashState *state, const SkeinBitSequence *data, SkeinDataLength databitlen)
1966+
static SkeinHashReturn Update(hashState *state, const BitSequence *data, DataLength databitlen)
19671967
{
19681968
/* only the final Update() call is allowed do partial bytes, else assert an error */
19691969
Skein_Assert((state->u.h.T[1] & SKEIN_T1_FLAG_BIT_PAD) == 0 || databitlen == 0, SKEIN_FAIL);
@@ -2008,7 +2008,7 @@ static SkeinHashReturn Update(hashState *state, const SkeinBitSequence *data, Sk
20082008

20092009
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
20102010
/* finalize hash computation and output the result (hashbitlen bits) */
2011-
static SkeinHashReturn Final(hashState *state, SkeinBitSequence *hashval)
2011+
static SkeinHashReturn Final(hashState *state, BitSequence *hashval)
20122012
{
20132013
Skein_Assert(state->statebits % 256 == 0 && (state->statebits-256) < 1024,FAIL);
20142014
switch ((state->statebits >> 8) & 3)
@@ -2022,8 +2022,8 @@ static SkeinHashReturn Final(hashState *state, SkeinBitSequence *hashval)
20222022

20232023
/*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
20242024
/* all-in-one hash function */
2025-
SkeinHashReturn c_skein_hash(int hashbitlen, const SkeinBitSequence *data, /* all-in-one call */
2026-
SkeinDataLength databitlen,SkeinBitSequence *hashval)
2025+
SkeinHashReturn c_skein_hash(int hashbitlen, const BitSequence *data, /* all-in-one call */
2026+
DataLength databitlen,BitSequence *hashval)
20272027
{
20282028
hashState state;
20292029
SkeinHashReturn r = Init(&state,hashbitlen);

crypto/c_skein.h

+3-5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
**
2929
***************************************************************************/
3030
#include "skein_port.h" /* get platform-specific definitions */
31+
#include "hash.h"
3132

3233
typedef enum
3334
{
@@ -37,11 +38,8 @@ typedef enum
3738
}
3839
SkeinHashReturn;
3940

40-
typedef size_t SkeinDataLength; /* bit count type */
41-
typedef u08b_t SkeinBitSequence; /* bit stream type */
42-
4341
/* "all-in-one" call */
44-
SkeinHashReturn c_skein_hash(int hashbitlen, const SkeinBitSequence *data,
45-
SkeinDataLength databitlen, SkeinBitSequence *hashval);
42+
SkeinHashReturn c_skein_hash(int hashbitlen, const BitSequence *data,
43+
DataLength databitlen, BitSequence *hashval);
4644

4745
#endif /* ifndef _SKEIN_H_ */

crypto/hash.h

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#pragma once
2+
3+
typedef unsigned char BitSequence;
4+
typedef unsigned long long DataLength;

cryptonight.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ void cryptonight_hash(const char* input, char* output, uint32_t len) {
111111
uint8_t aes_key[AES_KEY_SIZE];
112112
OAES_CTX* aes_ctx;
113113

114-
hash_process(&state.hs, input, len);
114+
hash_process(&state.hs, (const uint8_t*) input, len);
115115
memcpy(text, state.init, INIT_SIZE_BYTE);
116116
memcpy(aes_key, state.hs.b, AES_KEY_SIZE);
117117
aes_ctx = oaes_alloc();

hefty1.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ void hefty1_hash(const char* input, char* output, uint32_t len)
4646

4747
memset(output, 0, 32);
4848

49-
char* hash[4] = { &hash32_2, &hash64_3, &hash64_4, &hash64_5 };
49+
char* hash[4] = { hash32_2, hash64_3, hash64_4, hash64_5 };
5050

5151
uint32_t i;
5252
uint32_t j;

qubit.c

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#include "qubit.h"
22

3+
#include <string.h>
4+
#include <stdlib.h>
5+
36
#include "sha3/sph_cubehash.h"
47
#include "sha3/sph_luffa.h"
58
#include "sha3/sph_shavite.h"

sha3/sph_hefty1.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
} \
6363

6464
/* Nothing up my sleeve constants */
65-
const static uint32_t K[64] = {
65+
static const uint32_t K[64] = {
6666
0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL,
6767
0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL,
6868
0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL,
@@ -82,7 +82,7 @@ const static uint32_t K[64] = {
8282
};
8383

8484
/* Initial hash values */
85-
const static uint32_t H[HEFTY1_STATE_WORDS] = {
85+
static const uint32_t H[HEFTY1_STATE_WORDS] = {
8686
0x6a09e667UL,
8787
0xbb67ae85UL,
8888
0x3c6ef372UL,
@@ -375,4 +375,4 @@ unsigned char* HEFTY1(const unsigned char *buf, size_t len, unsigned char *diges
375375
HEFTY1_Final(digest, &ctx);
376376

377377
return digest;
378-
}
378+
}

shavite3.c

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
#include "shavite3.h"
22

3+
#include <string.h>
4+
#include <stdlib.h>
5+
36
#include "sha3/sph_shavite.h"
47

58
void shavite3_hash(const char* input, char* output, uint32_t len)

0 commit comments

Comments
 (0)