Browse Source

fixes for MSVC2010 to build

djm34
Jan Berdajs 11 years ago
parent
commit
9ec87cfc1a
  1. 2
      algorithm.c
  2. 23
      driver-opencl.c
  3. 12
      maxcoin.c
  4. 28
      sph/blake.c
  5. 28
      sph/bmw.c
  6. 26
      sph/cubehash.c
  7. 32
      sph/echo.c
  8. 38
      sph/fugue.c
  9. 32
      sph/groestl.c
  10. 56
      sph/hamsi.c
  11. 32
      sph/jh.c
  12. 24
      sph/keccak.c
  13. 30
      sph/luffa.c
  14. 8
      sph/md_helper.c
  15. 10
      sph/panama.c
  16. 4
      sph/sha2.c
  17. 4
      sph/sha2big.c
  18. 48
      sph/shavite.c
  19. 20
      sph/simd.c
  20. 24
      sph/skein.c

2
algorithm.c

@ -25,6 +25,8 @@
#include "marucoin.h" #include "marucoin.h"
#include "maxcoin.h" #include "maxcoin.h"
#include "compat.h"
#include <inttypes.h> #include <inttypes.h>
#include <string.h> #include <string.h>

23
driver-opencl.c

@ -173,7 +173,8 @@ char *set_thread_concurrency(const char *_arg)
{ {
int i, val = 0, device = 0; int i, val = 0, device = 0;
char *nextptr; char *nextptr;
char *arg = strdupa(_arg); char *arg = (char *)alloca(strlen(_arg) + 1);
strcpy(arg, _arg);
nextptr = strtok(arg, ","); nextptr = strtok(arg, ",");
if (nextptr == NULL) if (nextptr == NULL)
@ -230,7 +231,8 @@ char *set_gpu_threads(const char *_arg)
{ {
int i, val = 1, device = 0; int i, val = 1, device = 0;
char *nextptr; char *nextptr;
char *arg = strdupa(_arg); char *arg = (char *)alloca(strlen(_arg) + 1);
strcpy(arg, _arg);
nextptr = strtok(arg, ","); nextptr = strtok(arg, ",");
if (nextptr == NULL) if (nextptr == NULL)
@ -260,7 +262,8 @@ char *set_gpu_engine(const char *_arg)
{ {
int i, val1 = 0, val2 = 0, device = 0; int i, val1 = 0, val2 = 0, device = 0;
char *nextptr; char *nextptr;
char *arg = strdupa(_arg); char *arg = (char *)alloca(strlen(_arg) + 1);
strcpy(arg, _arg);
nextptr = strtok(arg, ","); nextptr = strtok(arg, ",");
if (nextptr == NULL) if (nextptr == NULL)
@ -332,7 +335,8 @@ char *set_gpu_memclock(const char *_arg)
{ {
int i, val = 0, device = 0; int i, val = 0, device = 0;
char *nextptr; char *nextptr;
char *arg = strdupa(_arg); char *arg = (char *)alloca(strlen(_arg) + 1);
strcpy(arg, _arg);
nextptr = strtok(arg, ","); nextptr = strtok(arg, ",");
if (nextptr == NULL) if (nextptr == NULL)
@ -517,7 +521,8 @@ char *set_intensity(const char *_arg)
{ {
int i, device = 0, *tt; int i, device = 0, *tt;
char *nextptr, val = 0; char *nextptr, val = 0;
char *arg = strdupa(_arg); char *arg = (char *)alloca(strlen(_arg) + 1);
strcpy(arg, _arg);
nextptr = strtok(arg, ","); nextptr = strtok(arg, ",");
if (nextptr == NULL) if (nextptr == NULL)
@ -571,7 +576,8 @@ char *set_xintensity(const char *_arg)
{ {
int i, device = 0, val = 0; int i, device = 0, val = 0;
char *nextptr; char *nextptr;
char *arg = strdupa(_arg); char *arg = (char *)alloca(strlen(_arg) + 1);
strcpy(arg, _arg);
nextptr = strtok(arg, ","); nextptr = strtok(arg, ",");
if (nextptr == NULL) if (nextptr == NULL)
@ -613,7 +619,8 @@ char *set_rawintensity(const char *_arg)
{ {
int i, device = 0, val = 0; int i, device = 0, val = 0;
char *nextptr; char *nextptr;
char *arg = strdupa(_arg); char *arg = (char *)alloca(strlen(_arg) + 1);
strcpy(arg, _arg);
nextptr = strtok(arg, ","); nextptr = strtok(arg, ",");
if (nextptr == NULL) if (nextptr == NULL)
@ -1352,7 +1359,7 @@ static int64_t opencl_scanhash(struct thr_info *thr, struct work *work,
} }
if (clState->goffset) if (clState->goffset)
p_global_work_offset = &work->blk.nonce; p_global_work_offset = (size_t *)&work->blk.nonce;
status = clEnqueueNDRangeKernel(clState->commandQueue, clState->kernel, 1, p_global_work_offset, status = clEnqueueNDRangeKernel(clState->commandQueue, clState->kernel, 1, p_global_work_offset,
globalThreads, localThreads, 0, NULL, NULL); globalThreads, localThreads, 0, NULL, NULL);

12
maxcoin.c

@ -59,7 +59,7 @@ struct bin32
void maxcoin1(unsigned char *out, const unsigned char *inraw, unsigned inrawlen) void maxcoin1(unsigned char *out, const unsigned char *inraw, unsigned inrawlen)
{ {
unsigned char temp[136]; unsigned char temp[136];
unsigned round; unsigned round_val;
UINT64 Aba, Abe, Abi, Abo, Abu; UINT64 Aba, Abe, Abi, Abo, Abu;
UINT64 Aga, Age, Agi, Ago, Agu; UINT64 Aga, Age, Agi, Ago, Agu;
@ -107,7 +107,7 @@ void maxcoin1(unsigned char *out, const unsigned char *inraw, unsigned inrawlen)
Aso = 0; Aso = 0;
Asu = 0; Asu = 0;
for( round = 0; round < 24; round += 2 ) for( round_val = 0; round_val < 24; round_val += 2 )
{ {
// prepareTheta // prepareTheta
BCa = Aba^Aga^Aka^Ama^Asa; BCa = Aba^Aga^Aka^Ama^Asa;
@ -116,7 +116,7 @@ void maxcoin1(unsigned char *out, const unsigned char *inraw, unsigned inrawlen)
BCo = Abo^Ago^Ako^Amo^Aso; BCo = Abo^Ago^Ako^Amo^Aso;
BCu = Abu^Agu^Aku^Amu^Asu; BCu = Abu^Agu^Aku^Amu^Asu;
//thetaRhoPiChiIotaPrepareTheta(round , A, E) //thetaRhoPiChiIotaPrepareTheta(round_val , A, E)
Da = BCu^ROL(BCe, 1); Da = BCu^ROL(BCe, 1);
De = BCa^ROL(BCi, 1); De = BCa^ROL(BCi, 1);
Di = BCe^ROL(BCo, 1); Di = BCe^ROL(BCo, 1);
@ -134,7 +134,7 @@ void maxcoin1(unsigned char *out, const unsigned char *inraw, unsigned inrawlen)
Asu ^= Du; Asu ^= Du;
BCu = ROL(Asu, 14); BCu = ROL(Asu, 14);
Eba = BCa ^((~BCe)& BCi ); Eba = BCa ^((~BCe)& BCi );
Eba ^= MaxcoinF_RoundConstants[round]; Eba ^= MaxcoinF_RoundConstants[round_val];
Ebe = BCe ^((~BCi)& BCo ); Ebe = BCe ^((~BCi)& BCo );
Ebi = BCi ^((~BCo)& BCu ); Ebi = BCi ^((~BCo)& BCu );
Ebo = BCo ^((~BCu)& BCa ); Ebo = BCo ^((~BCu)& BCa );
@ -211,7 +211,7 @@ void maxcoin1(unsigned char *out, const unsigned char *inraw, unsigned inrawlen)
BCo = Ebo^Ego^Eko^Emo^Eso; BCo = Ebo^Ego^Eko^Emo^Eso;
BCu = Ebu^Egu^Eku^Emu^Esu; BCu = Ebu^Egu^Eku^Emu^Esu;
//thetaRhoPiChiIotaPrepareTheta(round+1, E, A) //thetaRhoPiChiIotaPrepareTheta(round_val+1, E, A)
Da = BCu^ROL(BCe, 1); Da = BCu^ROL(BCe, 1);
De = BCa^ROL(BCi, 1); De = BCa^ROL(BCi, 1);
Di = BCe^ROL(BCo, 1); Di = BCe^ROL(BCo, 1);
@ -229,7 +229,7 @@ void maxcoin1(unsigned char *out, const unsigned char *inraw, unsigned inrawlen)
Esu ^= Du; Esu ^= Du;
BCu = ROL(Esu, 14); BCu = ROL(Esu, 14);
Aba = BCa ^((~BCe)& BCi ); Aba = BCa ^((~BCe)& BCi );
Aba ^= MaxcoinF_RoundConstants[round+1]; Aba ^= MaxcoinF_RoundConstants[round_val+1];
Abe = BCe ^((~BCi)& BCo ); Abe = BCe ^((~BCi)& BCo );
Abi = BCi ^((~BCo)& BCu ); Abi = BCi ^((~BCo)& BCu );
Abo = BCo ^((~BCu)& BCa ); Abo = BCo ^((~BCu)& BCa );

28
sph/blake.c

@ -879,7 +879,7 @@ blake32_close(sph_blake_small_context *sc,
sph_enc32be_aligned(u.buf + 60, tl); sph_enc32be_aligned(u.buf + 60, tl);
blake32(sc, u.buf, 64); blake32(sc, u.buf, 64);
} }
out = dst; out = (unsigned char *)dst;
for (k = 0; k < out_size_w32; k ++) for (k = 0; k < out_size_w32; k ++)
sph_enc32be(out + (k << 2), sc->H[k]); sph_enc32be(out + (k << 2), sc->H[k]);
} }
@ -984,7 +984,7 @@ blake64_close(sph_blake_big_context *sc,
sph_enc64be_aligned(u.buf + 120, tl); sph_enc64be_aligned(u.buf + 120, tl);
blake64(sc, u.buf, 128); blake64(sc, u.buf, 128);
} }
out = dst; out = (unsigned char *)dst;
for (k = 0; k < out_size_w64; k ++) for (k = 0; k < out_size_w64; k ++)
sph_enc64be(out + (k << 3), sc->H[k]); sph_enc64be(out + (k << 3), sc->H[k]);
} }
@ -995,14 +995,14 @@ blake64_close(sph_blake_big_context *sc,
void void
sph_blake224_init(void *cc) sph_blake224_init(void *cc)
{ {
blake32_init(cc, IV224, salt_zero_small); blake32_init((sph_blake_small_context *)cc, IV224, salt_zero_small);
} }
/* see sph_blake.h */ /* see sph_blake.h */
void void
sph_blake224(void *cc, const void *data, size_t len) sph_blake224(void *cc, const void *data, size_t len)
{ {
blake32(cc, data, len); blake32((sph_blake_small_context *)cc, data, len);
} }
/* see sph_blake.h */ /* see sph_blake.h */
@ -1016,7 +1016,7 @@ sph_blake224_close(void *cc, void *dst)
void void
sph_blake224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_blake224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
blake32_close(cc, ub, n, dst, 7); blake32_close((sph_blake_small_context *)cc, ub, n, dst, 7);
sph_blake224_init(cc); sph_blake224_init(cc);
} }
@ -1024,14 +1024,14 @@ sph_blake224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
void void
sph_blake256_init(void *cc) sph_blake256_init(void *cc)
{ {
blake32_init(cc, IV256, salt_zero_small); blake32_init((sph_blake_small_context *)cc, IV256, salt_zero_small);
} }
/* see sph_blake.h */ /* see sph_blake.h */
void void
sph_blake256(void *cc, const void *data, size_t len) sph_blake256(void *cc, const void *data, size_t len)
{ {
blake32(cc, data, len); blake32((sph_blake_small_context *)cc, data, len);
} }
/* see sph_blake.h */ /* see sph_blake.h */
@ -1045,7 +1045,7 @@ sph_blake256_close(void *cc, void *dst)
void void
sph_blake256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_blake256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
blake32_close(cc, ub, n, dst, 8); blake32_close((sph_blake_small_context *)cc, ub, n, dst, 8);
sph_blake256_init(cc); sph_blake256_init(cc);
} }
@ -1055,14 +1055,14 @@ sph_blake256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
void void
sph_blake384_init(void *cc) sph_blake384_init(void *cc)
{ {
blake64_init(cc, IV384, salt_zero_big); blake64_init((sph_blake_big_context *)cc, IV384, salt_zero_big);
} }
/* see sph_blake.h */ /* see sph_blake.h */
void void
sph_blake384(void *cc, const void *data, size_t len) sph_blake384(void *cc, const void *data, size_t len)
{ {
blake64(cc, data, len); blake64((sph_blake_big_context *)cc, data, len);
} }
/* see sph_blake.h */ /* see sph_blake.h */
@ -1076,7 +1076,7 @@ sph_blake384_close(void *cc, void *dst)
void void
sph_blake384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_blake384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
blake64_close(cc, ub, n, dst, 6); blake64_close((sph_blake_big_context *)cc, ub, n, dst, 6);
sph_blake384_init(cc); sph_blake384_init(cc);
} }
@ -1084,14 +1084,14 @@ sph_blake384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
void void
sph_blake512_init(void *cc) sph_blake512_init(void *cc)
{ {
blake64_init(cc, IV512, salt_zero_big); blake64_init((sph_blake_big_context *)cc, IV512, salt_zero_big);
} }
/* see sph_blake.h */ /* see sph_blake.h */
void void
sph_blake512(void *cc, const void *data, size_t len) sph_blake512(void *cc, const void *data, size_t len)
{ {
blake64(cc, data, len); blake64((sph_blake_big_context *)cc, data, len);
} }
/* see sph_blake.h */ /* see sph_blake.h */
@ -1105,7 +1105,7 @@ sph_blake512_close(void *cc, void *dst)
void void
sph_blake512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_blake512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
blake64_close(cc, ub, n, dst, 8); blake64_close((sph_blake_big_context *)cc, ub, n, dst, 8);
sph_blake512_init(cc); sph_blake512_init(cc);
} }

28
sph/bmw.c

@ -702,7 +702,7 @@ bmw32_close(sph_bmw_small_context *sc, unsigned ub, unsigned n,
for (u = 0; u < 16; u ++) for (u = 0; u < 16; u ++)
sph_enc32le_aligned(buf + 4 * u, h2[u]); sph_enc32le_aligned(buf + 4 * u, h2[u]);
compress_small(buf, final_s, h1); compress_small(buf, final_s, h1);
out = dst; out = (unsigned char *)dst;
for (u = 0, v = 16 - out_size_w32; u < out_size_w32; u ++, v ++) for (u = 0, v = 16 - out_size_w32; u < out_size_w32; u ++, v ++)
sph_enc32le(out + 4 * u, h1[v]); sph_enc32le(out + 4 * u, h1[v]);
} }
@ -829,7 +829,7 @@ bmw64_close(sph_bmw_big_context *sc, unsigned ub, unsigned n,
for (u = 0; u < 16; u ++) for (u = 0; u < 16; u ++)
sph_enc64le_aligned(buf + 8 * u, h2[u]); sph_enc64le_aligned(buf + 8 * u, h2[u]);
compress_big(buf, final_b, h1); compress_big(buf, final_b, h1);
out = dst; out = (unsigned char *)dst;
for (u = 0, v = 16 - out_size_w64; u < out_size_w64; u ++, v ++) for (u = 0, v = 16 - out_size_w64; u < out_size_w64; u ++, v ++)
sph_enc64le(out + 8 * u, h1[v]); sph_enc64le(out + 8 * u, h1[v]);
} }
@ -840,14 +840,14 @@ bmw64_close(sph_bmw_big_context *sc, unsigned ub, unsigned n,
void void
sph_bmw224_init(void *cc) sph_bmw224_init(void *cc)
{ {
bmw32_init(cc, IV224); bmw32_init((sph_bmw_small_context *)cc, IV224);
} }
/* see sph_bmw.h */ /* see sph_bmw.h */
void void
sph_bmw224(void *cc, const void *data, size_t len) sph_bmw224(void *cc, const void *data, size_t len)
{ {
bmw32(cc, data, len); bmw32((sph_bmw_small_context *)cc, data, len);
} }
/* see sph_bmw.h */ /* see sph_bmw.h */
@ -861,7 +861,7 @@ sph_bmw224_close(void *cc, void *dst)
void void
sph_bmw224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_bmw224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
bmw32_close(cc, ub, n, dst, 7); bmw32_close((sph_bmw_small_context *)cc, ub, n, dst, 7);
sph_bmw224_init(cc); sph_bmw224_init(cc);
} }
@ -869,14 +869,14 @@ sph_bmw224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
void void
sph_bmw256_init(void *cc) sph_bmw256_init(void *cc)
{ {
bmw32_init(cc, IV256); bmw32_init((sph_bmw_small_context *)cc, IV256);
} }
/* see sph_bmw.h */ /* see sph_bmw.h */
void void
sph_bmw256(void *cc, const void *data, size_t len) sph_bmw256(void *cc, const void *data, size_t len)
{ {
bmw32(cc, data, len); bmw32((sph_bmw_small_context *)cc, data, len);
} }
/* see sph_bmw.h */ /* see sph_bmw.h */
@ -890,7 +890,7 @@ sph_bmw256_close(void *cc, void *dst)
void void
sph_bmw256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_bmw256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
bmw32_close(cc, ub, n, dst, 8); bmw32_close((sph_bmw_small_context *)cc, ub, n, dst, 8);
sph_bmw256_init(cc); sph_bmw256_init(cc);
} }
@ -900,14 +900,14 @@ sph_bmw256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
void void
sph_bmw384_init(void *cc) sph_bmw384_init(void *cc)
{ {
bmw64_init(cc, IV384); bmw64_init((sph_bmw_big_context *)cc, IV384);
} }
/* see sph_bmw.h */ /* see sph_bmw.h */
void void
sph_bmw384(void *cc, const void *data, size_t len) sph_bmw384(void *cc, const void *data, size_t len)
{ {
bmw64(cc, data, len); bmw64((sph_bmw_big_context *)cc, data, len);
} }
/* see sph_bmw.h */ /* see sph_bmw.h */
@ -921,7 +921,7 @@ sph_bmw384_close(void *cc, void *dst)
void void
sph_bmw384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_bmw384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
bmw64_close(cc, ub, n, dst, 6); bmw64_close((sph_bmw_big_context *)cc, ub, n, dst, 6);
sph_bmw384_init(cc); sph_bmw384_init(cc);
} }
@ -929,14 +929,14 @@ sph_bmw384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
void void
sph_bmw512_init(void *cc) sph_bmw512_init(void *cc)
{ {
bmw64_init(cc, IV512); bmw64_init((sph_bmw_big_context *)cc, IV512);
} }
/* see sph_bmw.h */ /* see sph_bmw.h */
void void
sph_bmw512(void *cc, const void *data, size_t len) sph_bmw512(void *cc, const void *data, size_t len)
{ {
bmw64(cc, data, len); bmw64((sph_bmw_big_context *)cc, data, len);
} }
/* see sph_bmw.h */ /* see sph_bmw.h */
@ -950,7 +950,7 @@ sph_bmw512_close(void *cc, void *dst)
void void
sph_bmw512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_bmw512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
bmw64_close(cc, ub, n, dst, 8); bmw64_close((sph_bmw_big_context *)cc, ub, n, dst, 8);
sph_bmw512_init(cc); sph_bmw512_init(cc);
} }

26
sph/cubehash.c

@ -595,7 +595,7 @@ cubehash_close(sph_cubehash_context *sc, unsigned ub, unsigned n,
xv ^= SPH_C32(1); xv ^= SPH_C32(1);
} }
WRITE_STATE(sc); WRITE_STATE(sc);
out = dst; out = (unsigned char *)dst;
for (z = 0; z < out_size_w32; z ++) for (z = 0; z < out_size_w32; z ++)
sph_enc32le(out + (z << 2), sc->state[z]); sph_enc32le(out + (z << 2), sc->state[z]);
} }
@ -604,14 +604,14 @@ cubehash_close(sph_cubehash_context *sc, unsigned ub, unsigned n,
void void
sph_cubehash224_init(void *cc) sph_cubehash224_init(void *cc)
{ {
cubehash_init(cc, IV224); cubehash_init((sph_cubehash_context *)cc, IV224);
} }
/* see sph_cubehash.h */ /* see sph_cubehash.h */
void void
sph_cubehash224(void *cc, const void *data, size_t len) sph_cubehash224(void *cc, const void *data, size_t len)
{ {
cubehash_core(cc, data, len); cubehash_core((sph_cubehash_context *)cc, data, len);
} }
/* see sph_cubehash.h */ /* see sph_cubehash.h */
@ -625,7 +625,7 @@ sph_cubehash224_close(void *cc, void *dst)
void void
sph_cubehash224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_cubehash224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
cubehash_close(cc, ub, n, dst, 7); cubehash_close((sph_cubehash_context *)cc, ub, n, dst, 7);
sph_cubehash224_init(cc); sph_cubehash224_init(cc);
} }
@ -633,14 +633,14 @@ sph_cubehash224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
void void
sph_cubehash256_init(void *cc) sph_cubehash256_init(void *cc)
{ {
cubehash_init(cc, IV256); cubehash_init((sph_cubehash_context *)cc, IV256);
} }
/* see sph_cubehash.h */ /* see sph_cubehash.h */
void void
sph_cubehash256(void *cc, const void *data, size_t len) sph_cubehash256(void *cc, const void *data, size_t len)
{ {
cubehash_core(cc, data, len); cubehash_core((sph_cubehash_context *)cc, data, len);
} }
/* see sph_cubehash.h */ /* see sph_cubehash.h */
@ -654,7 +654,7 @@ sph_cubehash256_close(void *cc, void *dst)
void void
sph_cubehash256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_cubehash256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
cubehash_close(cc, ub, n, dst, 8); cubehash_close((sph_cubehash_context *)cc, ub, n, dst, 8);
sph_cubehash256_init(cc); sph_cubehash256_init(cc);
} }
@ -662,14 +662,14 @@ sph_cubehash256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
void void
sph_cubehash384_init(void *cc) sph_cubehash384_init(void *cc)
{ {
cubehash_init(cc, IV384); cubehash_init((sph_cubehash_context *)cc, IV384);
} }
/* see sph_cubehash.h */ /* see sph_cubehash.h */
void void
sph_cubehash384(void *cc, const void *data, size_t len) sph_cubehash384(void *cc, const void *data, size_t len)
{ {
cubehash_core(cc, data, len); cubehash_core((sph_cubehash_context *)cc, data, len);
} }
/* see sph_cubehash.h */ /* see sph_cubehash.h */
@ -683,7 +683,7 @@ sph_cubehash384_close(void *cc, void *dst)
void void
sph_cubehash384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_cubehash384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
cubehash_close(cc, ub, n, dst, 12); cubehash_close((sph_cubehash_context *)cc, ub, n, dst, 12);
sph_cubehash384_init(cc); sph_cubehash384_init(cc);
} }
@ -691,14 +691,14 @@ sph_cubehash384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
void void
sph_cubehash512_init(void *cc) sph_cubehash512_init(void *cc)
{ {
cubehash_init(cc, IV512); cubehash_init((sph_cubehash_context *)cc, IV512);
} }
/* see sph_cubehash.h */ /* see sph_cubehash.h */
void void
sph_cubehash512(void *cc, const void *data, size_t len) sph_cubehash512(void *cc, const void *data, size_t len)
{ {
cubehash_core(cc, data, len); cubehash_core((sph_cubehash_context *)cc, data, len);
} }
/* see sph_cubehash.h */ /* see sph_cubehash.h */
@ -712,6 +712,6 @@ sph_cubehash512_close(void *cc, void *dst)
void void
sph_cubehash512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_cubehash512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
cubehash_close(cc, ub, n, dst, 16); cubehash_close((sph_cubehash_context *)cc, ub, n, dst, 16);
sph_cubehash512_init(cc); sph_cubehash512_init(cc);
} }

32
sph/echo.c

@ -915,110 +915,110 @@ echo_big_close(sph_echo_big_context *sc, unsigned ub, unsigned n,
void void
sph_echo224_init(void *cc) sph_echo224_init(void *cc)
{ {
echo_small_init(cc, 224); echo_small_init((sph_echo_small_context *)cc, 224);
} }
/* see sph_echo.h */ /* see sph_echo.h */
void void
sph_echo224(void *cc, const void *data, size_t len) sph_echo224(void *cc, const void *data, size_t len)
{ {
echo_small_core(cc, data, len); echo_small_core((sph_echo_small_context *)cc, (const unsigned char *)data, len);
} }
/* see sph_echo.h */ /* see sph_echo.h */
void void
sph_echo224_close(void *cc, void *dst) sph_echo224_close(void *cc, void *dst)
{ {
echo_small_close(cc, 0, 0, dst, 7); echo_small_close((sph_echo_small_context *)cc, 0, 0, dst, 7);
} }
/* see sph_echo.h */ /* see sph_echo.h */
void void
sph_echo224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_echo224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
echo_small_close(cc, ub, n, dst, 7); echo_small_close((sph_echo_small_context *)cc, ub, n, dst, 7);
} }
/* see sph_echo.h */ /* see sph_echo.h */
void void
sph_echo256_init(void *cc) sph_echo256_init(void *cc)
{ {
echo_small_init(cc, 256); echo_small_init((sph_echo_small_context *)cc, 256);
} }
/* see sph_echo.h */ /* see sph_echo.h */
void void
sph_echo256(void *cc, const void *data, size_t len) sph_echo256(void *cc, const void *data, size_t len)
{ {
echo_small_core(cc, data, len); echo_small_core((sph_echo_small_context *)cc, (unsigned char *)data, len);
} }
/* see sph_echo.h */ /* see sph_echo.h */
void void
sph_echo256_close(void *cc, void *dst) sph_echo256_close(void *cc, void *dst)
{ {
echo_small_close(cc, 0, 0, dst, 8); echo_small_close((sph_echo_small_context *)cc, 0, 0, dst, 8);
} }
/* see sph_echo.h */ /* see sph_echo.h */
void void
sph_echo256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_echo256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
echo_small_close(cc, ub, n, dst, 8); echo_small_close((sph_echo_small_context *)cc, ub, n, dst, 8);
} }
/* see sph_echo.h */ /* see sph_echo.h */
void void
sph_echo384_init(void *cc) sph_echo384_init(void *cc)
{ {
echo_big_init(cc, 384); echo_big_init((sph_echo_big_context *)cc, 384);
} }
/* see sph_echo.h */ /* see sph_echo.h */
void void
sph_echo384(void *cc, const void *data, size_t len) sph_echo384(void *cc, const void *data, size_t len)
{ {
echo_big_core(cc, data, len); echo_big_core((sph_echo_big_context *)cc, (unsigned char *)data, len);
} }
/* see sph_echo.h */ /* see sph_echo.h */
void void
sph_echo384_close(void *cc, void *dst) sph_echo384_close(void *cc, void *dst)
{ {
echo_big_close(cc, 0, 0, dst, 12); echo_big_close((sph_echo_big_context *)cc, 0, 0, dst, 12);
} }
/* see sph_echo.h */ /* see sph_echo.h */
void void
sph_echo384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_echo384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
echo_big_close(cc, ub, n, dst, 12); echo_big_close((sph_echo_big_context *)cc, ub, n, dst, 12);
} }
/* see sph_echo.h */ /* see sph_echo.h */
void void
sph_echo512_init(void *cc) sph_echo512_init(void *cc)
{ {
echo_big_init(cc, 512); echo_big_init((sph_echo_big_context *)cc, 512);
} }
/* see sph_echo.h */ /* see sph_echo.h */
void void
sph_echo512(void *cc, const void *data, size_t len) sph_echo512(void *cc, const void *data, size_t len)
{ {
echo_big_core(cc, data, len); echo_big_core((sph_echo_big_context *)cc, (unsigned char *)data, len);
} }
/* see sph_echo.h */ /* see sph_echo.h */
void void
sph_echo512_close(void *cc, void *dst) sph_echo512_close(void *cc, void *dst)
{ {
echo_big_close(cc, 0, 0, dst, 16); echo_big_close((sph_echo_big_context *)cc, 0, 0, dst, 16);
} }
/* see sph_echo.h */ /* see sph_echo.h */
void void
sph_echo512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_echo512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
echo_big_close(cc, ub, n, dst, 16); echo_big_close((sph_echo_big_context *)cc, ub, n, dst, 16);
} }

38
sph/fugue.c

@ -1046,7 +1046,7 @@ fugue2_close(sph_fugue_context *sc, unsigned ub, unsigned n,
} }
S[4] ^= S[0]; S[4] ^= S[0];
S[15] ^= S[0]; S[15] ^= S[0];
out = dst; out = (unsigned char *)dst;
sph_enc32be(out + 0, S[ 1]); sph_enc32be(out + 0, S[ 1]);
sph_enc32be(out + 4, S[ 2]); sph_enc32be(out + 4, S[ 2]);
sph_enc32be(out + 8, S[ 3]); sph_enc32be(out + 8, S[ 3]);
@ -1093,7 +1093,7 @@ fugue3_close(sph_fugue_context *sc, unsigned ub, unsigned n, void *dst)
S[4] ^= S[0]; S[4] ^= S[0];
S[12] ^= S[0]; S[12] ^= S[0];
S[24] ^= S[0]; S[24] ^= S[0];
out = dst; out = (unsigned char *)dst;
sph_enc32be(out + 0, S[ 1]); sph_enc32be(out + 0, S[ 1]);
sph_enc32be(out + 4, S[ 2]); sph_enc32be(out + 4, S[ 2]);
sph_enc32be(out + 8, S[ 3]); sph_enc32be(out + 8, S[ 3]);
@ -1150,7 +1150,7 @@ fugue4_close(sph_fugue_context *sc, unsigned ub, unsigned n, void *dst)
S[9] ^= S[0]; S[9] ^= S[0];
S[18] ^= S[0]; S[18] ^= S[0];
S[27] ^= S[0]; S[27] ^= S[0];
out = dst; out = (unsigned char *)dst;
sph_enc32be(out + 0, S[ 1]); sph_enc32be(out + 0, S[ 1]);
sph_enc32be(out + 4, S[ 2]); sph_enc32be(out + 4, S[ 2]);
sph_enc32be(out + 8, S[ 3]); sph_enc32be(out + 8, S[ 3]);
@ -1174,110 +1174,110 @@ fugue4_close(sph_fugue_context *sc, unsigned ub, unsigned n, void *dst)
void void
sph_fugue224_init(void *cc) sph_fugue224_init(void *cc)
{ {
fugue_init(cc, 23, IV224, 7); fugue_init((sph_fugue_context *)cc, 23, IV224, 7);
} }
/* see sph_fugue.h */ /* see sph_fugue.h */
void void
sph_fugue224(void *cc, const void *data, size_t len) sph_fugue224(void *cc, const void *data, size_t len)
{ {
fugue2_core(cc, data, len); fugue2_core((sph_fugue_context *)cc, data, len);
} }
/* see sph_fugue.h */ /* see sph_fugue.h */
void void
sph_fugue224_close(void *cc, void *dst) sph_fugue224_close(void *cc, void *dst)
{ {
fugue2_close(cc, 0, 0, dst, 7); fugue2_close((sph_fugue_context *)cc, 0, 0, dst, 7);
} }
/* see sph_fugue.h */ /* see sph_fugue.h */
void void
sph_fugue224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_fugue224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
fugue2_close(cc, ub, n, dst, 7); fugue2_close((sph_fugue_context *)cc, ub, n, dst, 7);
} }
/* see sph_fugue.h */ /* see sph_fugue.h */
void void
sph_fugue256_init(void *cc) sph_fugue256_init(void *cc)
{ {
fugue_init(cc, 22, IV256, 8); fugue_init((sph_fugue_context *)cc, 22, IV256, 8);
} }
/* see sph_fugue.h */ /* see sph_fugue.h */
void void
sph_fugue256(void *cc, const void *data, size_t len) sph_fugue256(void *cc, const void *data, size_t len)
{ {
fugue2_core(cc, data, len); fugue2_core((sph_fugue_context *)cc, data, len);
} }
/* see sph_fugue.h */ /* see sph_fugue.h */
void void
sph_fugue256_close(void *cc, void *dst) sph_fugue256_close(void *cc, void *dst)
{ {
fugue2_close(cc, 0, 0, dst, 8); fugue2_close((sph_fugue_context *)cc, 0, 0, dst, 8);
} }
/* see sph_fugue.h */ /* see sph_fugue.h */
void void
sph_fugue256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_fugue256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
fugue2_close(cc, ub, n, dst, 8); fugue2_close((sph_fugue_context *)cc, ub, n, dst, 8);
} }
/* see sph_fugue.h */ /* see sph_fugue.h */
void void
sph_fugue384_init(void *cc) sph_fugue384_init(void *cc)
{ {
fugue_init(cc, 24, IV384, 12); fugue_init((sph_fugue_context *)cc, 24, IV384, 12);
} }
/* see sph_fugue.h */ /* see sph_fugue.h */
void void
sph_fugue384(void *cc, const void *data, size_t len) sph_fugue384(void *cc, const void *data, size_t len)
{ {
fugue3_core(cc, data, len); fugue3_core((sph_fugue_context *)cc, data, len);
} }
/* see sph_fugue.h */ /* see sph_fugue.h */
void void
sph_fugue384_close(void *cc, void *dst) sph_fugue384_close(void *cc, void *dst)
{ {
fugue3_close(cc, 0, 0, dst); fugue3_close((sph_fugue_context *)cc, 0, 0, dst);
} }
/* see sph_fugue.h */ /* see sph_fugue.h */
void void
sph_fugue384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_fugue384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
fugue3_close(cc, ub, n, dst); fugue3_close((sph_fugue_context *)cc, ub, n, dst);
} }
/* see sph_fugue.h */ /* see sph_fugue.h */
void void
sph_fugue512_init(void *cc) sph_fugue512_init(void *cc)
{ {
fugue_init(cc, 20, IV512, 16); fugue_init((sph_fugue_context *)cc, 20, IV512, 16);
} }
/* see sph_fugue.h */ /* see sph_fugue.h */
void void
sph_fugue512(void *cc, const void *data, size_t len) sph_fugue512(void *cc, const void *data, size_t len)
{ {
fugue4_core(cc, data, len); fugue4_core((sph_fugue_context *)cc, data, len);
} }
/* see sph_fugue.h */ /* see sph_fugue.h */
void void
sph_fugue512_close(void *cc, void *dst) sph_fugue512_close(void *cc, void *dst)
{ {
fugue4_close(cc, 0, 0, dst); fugue4_close((sph_fugue_context *)cc, 0, 0, dst);
} }
/* see sph_fugue.h */ /* see sph_fugue.h */
void void
sph_fugue512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_fugue512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
fugue4_close(cc, ub, n, dst); fugue4_close((sph_fugue_context *)cc, ub, n, dst);
} }

32
sph/groestl.c

@ -3002,110 +3002,110 @@ groestl_big_close(sph_groestl_big_context *sc,
void void
sph_groestl224_init(void *cc) sph_groestl224_init(void *cc)
{ {
groestl_small_init(cc, 224); groestl_small_init((sph_groestl_small_context *)cc, 224);
} }
/* see sph_groestl.h */ /* see sph_groestl.h */
void void
sph_groestl224(void *cc, const void *data, size_t len) sph_groestl224(void *cc, const void *data, size_t len)
{ {
groestl_small_core(cc, data, len); groestl_small_core((sph_groestl_small_context *)cc, data, len);
} }
/* see sph_groestl.h */ /* see sph_groestl.h */
void void
sph_groestl224_close(void *cc, void *dst) sph_groestl224_close(void *cc, void *dst)
{ {
groestl_small_close(cc, 0, 0, dst, 28); groestl_small_close((sph_groestl_small_context *)cc, 0, 0, dst, 28);
} }
/* see sph_groestl.h */ /* see sph_groestl.h */
void void
sph_groestl224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_groestl224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
groestl_small_close(cc, ub, n, dst, 28); groestl_small_close((sph_groestl_small_context *)cc, ub, n, dst, 28);
} }
/* see sph_groestl.h */ /* see sph_groestl.h */
void void
sph_groestl256_init(void *cc) sph_groestl256_init(void *cc)
{ {
groestl_small_init(cc, 256); groestl_small_init((sph_groestl_small_context *)cc, 256);
} }
/* see sph_groestl.h */ /* see sph_groestl.h */
void void
sph_groestl256(void *cc, const void *data, size_t len) sph_groestl256(void *cc, const void *data, size_t len)
{ {
groestl_small_core(cc, data, len); groestl_small_core((sph_groestl_small_context *)cc, data, len);
} }
/* see sph_groestl.h */ /* see sph_groestl.h */
void void
sph_groestl256_close(void *cc, void *dst) sph_groestl256_close(void *cc, void *dst)
{ {
groestl_small_close(cc, 0, 0, dst, 32); groestl_small_close((sph_groestl_small_context *)cc, 0, 0, dst, 32);
} }
/* see sph_groestl.h */ /* see sph_groestl.h */
void void
sph_groestl256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_groestl256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
groestl_small_close(cc, ub, n, dst, 32); groestl_small_close((sph_groestl_small_context *)cc, ub, n, dst, 32);
} }
/* see sph_groestl.h */ /* see sph_groestl.h */
void void
sph_groestl384_init(void *cc) sph_groestl384_init(void *cc)
{ {
groestl_big_init(cc, 384); groestl_big_init((sph_groestl_big_context *)cc, 384);
} }
/* see sph_groestl.h */ /* see sph_groestl.h */
void void
sph_groestl384(void *cc, const void *data, size_t len) sph_groestl384(void *cc, const void *data, size_t len)
{ {
groestl_big_core(cc, data, len); groestl_big_core((sph_groestl_big_context *)cc, data, len);
} }
/* see sph_groestl.h */ /* see sph_groestl.h */
void void
sph_groestl384_close(void *cc, void *dst) sph_groestl384_close(void *cc, void *dst)
{ {
groestl_big_close(cc, 0, 0, dst, 48); groestl_big_close((sph_groestl_big_context *)cc, 0, 0, dst, 48);
} }
/* see sph_groestl.h */ /* see sph_groestl.h */
void void
sph_groestl384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_groestl384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
groestl_big_close(cc, ub, n, dst, 48); groestl_big_close((sph_groestl_big_context *)cc, ub, n, dst, 48);
} }
/* see sph_groestl.h */ /* see sph_groestl.h */
void void
sph_groestl512_init(void *cc) sph_groestl512_init(void *cc)
{ {
groestl_big_init(cc, 512); groestl_big_init((sph_groestl_big_context *)cc, 512);
} }
/* see sph_groestl.h */ /* see sph_groestl.h */
void void
sph_groestl512(void *cc, const void *data, size_t len) sph_groestl512(void *cc, const void *data, size_t len)
{ {
groestl_big_core(cc, data, len); groestl_big_core((sph_groestl_big_context *)cc, data, len);
} }
/* see sph_groestl.h */ /* see sph_groestl.h */
void void
sph_groestl512_close(void *cc, void *dst) sph_groestl512_close(void *cc, void *dst)
{ {
groestl_big_close(cc, 0, 0, dst, 64); groestl_big_close((sph_groestl_big_context *)cc, 0, 0, dst, 64);
} }
/* see sph_groestl.h */ /* see sph_groestl.h */
void void
sph_groestl512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_groestl512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
groestl_big_close(cc, ub, n, dst, 64); groestl_big_close((sph_groestl_big_context *)cc, ub, n, dst, 64);
} }

56
sph/hamsi.c

@ -386,7 +386,7 @@ hamsi_small_core(sph_hamsi_small_context *sc, const void *data, size_t len)
} }
} }
hamsi_small(sc, data, (len >> 2)); hamsi_small(sc, (const unsigned char *)data, (len >> 2));
data = (const unsigned char *)data + (len & ~(size_t)3); data = (const unsigned char *)data + (len & ~(size_t)3);
len &= (size_t)3; len &= (size_t)3;
memcpy(sc->partial, data, len); memcpy(sc->partial, data, len);
@ -416,7 +416,7 @@ hamsi_small_close(sph_hamsi_small_context *sc,
pad[ptr ++] = 0; pad[ptr ++] = 0;
hamsi_small(sc, pad, 2); hamsi_small(sc, pad, 2);
hamsi_small_final(sc, pad + 8); hamsi_small_final(sc, pad + 8);
out = dst; out = (unsigned char *)dst;
for (u = 0; u < out_size_w32; u ++) for (u = 0; u < out_size_w32; u ++)
sph_enc32be(out + (u << 2), sc->h[u]); sph_enc32be(out + (u << 2), sc->h[u]);
} }
@ -689,7 +689,7 @@ hamsi_big_core(sph_hamsi_big_context *sc, const void *data, size_t len)
} }
} }
hamsi_big(sc, data, (len >> 3)); hamsi_big(sc, (const unsigned char *)data, (len >> 3));
data = (const unsigned char *)data + (len & ~(size_t)7); data = (const unsigned char *)data + (len & ~(size_t)7);
len &= (size_t)7; len &= (size_t)7;
memcpy(sc->partial, data, len); memcpy(sc->partial, data, len);
@ -718,7 +718,7 @@ hamsi_big_close(sph_hamsi_big_context *sc,
sc->partial[ptr ++] = 0; sc->partial[ptr ++] = 0;
hamsi_big(sc, sc->partial, 1); hamsi_big(sc, sc->partial, 1);
hamsi_big_final(sc, pad); hamsi_big_final(sc, pad);
out = dst; out = (unsigned char *)dst;
if (out_size_w32 == 12) { if (out_size_w32 == 12) {
sph_enc32be(out + 0, sc->h[ 0]); sph_enc32be(out + 0, sc->h[ 0]);
sph_enc32be(out + 4, sc->h[ 1]); sph_enc32be(out + 4, sc->h[ 1]);
@ -742,118 +742,118 @@ hamsi_big_close(sph_hamsi_big_context *sc,
void void
sph_hamsi224_init(void *cc) sph_hamsi224_init(void *cc)
{ {
hamsi_small_init(cc, IV224); hamsi_small_init((sph_hamsi_small_context *)cc, IV224);
} }
/* see sph_hamsi.h */ /* see sph_hamsi.h */
void void
sph_hamsi224(void *cc, const void *data, size_t len) sph_hamsi224(void *cc, const void *data, size_t len)
{ {
hamsi_small_core(cc, data, len); hamsi_small_core((sph_hamsi_small_context *)cc, data, len);
} }
/* see sph_hamsi.h */ /* see sph_hamsi.h */
void void
sph_hamsi224_close(void *cc, void *dst) sph_hamsi224_close(void *cc, void *dst)
{ {
hamsi_small_close(cc, 0, 0, dst, 7); hamsi_small_close((sph_hamsi_small_context *)cc, 0, 0, dst, 7);
hamsi_small_init(cc, IV224); hamsi_small_init((sph_hamsi_small_context *)cc, IV224);
} }
/* see sph_hamsi.h */ /* see sph_hamsi.h */
void void
sph_hamsi224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_hamsi224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
hamsi_small_close(cc, ub, n, dst, 7); hamsi_small_close((sph_hamsi_small_context *)cc, ub, n, dst, 7);
hamsi_small_init(cc, IV224); hamsi_small_init((sph_hamsi_small_context *)cc, IV224);
} }
/* see sph_hamsi.h */ /* see sph_hamsi.h */
void void
sph_hamsi256_init(void *cc) sph_hamsi256_init(void *cc)
{ {
hamsi_small_init(cc, IV256); hamsi_small_init((sph_hamsi_small_context *)cc, IV256);
} }
/* see sph_hamsi.h */ /* see sph_hamsi.h */
void void
sph_hamsi256(void *cc, const void *data, size_t len) sph_hamsi256(void *cc, const void *data, size_t len)
{ {
hamsi_small_core(cc, data, len); hamsi_small_core((sph_hamsi_small_context *)cc, data, len);
} }
/* see sph_hamsi.h */ /* see sph_hamsi.h */
void void
sph_hamsi256_close(void *cc, void *dst) sph_hamsi256_close(void *cc, void *dst)
{ {
hamsi_small_close(cc, 0, 0, dst, 8); hamsi_small_close((sph_hamsi_small_context *)cc, 0, 0, dst, 8);
hamsi_small_init(cc, IV256); hamsi_small_init((sph_hamsi_small_context *)cc, IV256);
} }
/* see sph_hamsi.h */ /* see sph_hamsi.h */
void void
sph_hamsi256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_hamsi256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
hamsi_small_close(cc, ub, n, dst, 8); hamsi_small_close((sph_hamsi_small_context *)cc, ub, n, dst, 8);
hamsi_small_init(cc, IV256); hamsi_small_init((sph_hamsi_small_context *)cc, IV256);
} }
/* see sph_hamsi.h */ /* see sph_hamsi.h */
void void
sph_hamsi384_init(void *cc) sph_hamsi384_init(void *cc)
{ {
hamsi_big_init(cc, IV384); hamsi_big_init((sph_hamsi_big_context *)cc, IV384);
} }
/* see sph_hamsi.h */ /* see sph_hamsi.h */
void void
sph_hamsi384(void *cc, const void *data, size_t len) sph_hamsi384(void *cc, const void *data, size_t len)
{ {
hamsi_big_core(cc, data, len); hamsi_big_core((sph_hamsi_big_context *)cc, data, len);
} }
/* see sph_hamsi.h */ /* see sph_hamsi.h */
void void
sph_hamsi384_close(void *cc, void *dst) sph_hamsi384_close(void *cc, void *dst)
{ {
hamsi_big_close(cc, 0, 0, dst, 12); hamsi_big_close((sph_hamsi_big_context *)cc, 0, 0, dst, 12);
hamsi_big_init(cc, IV384); hamsi_big_init((sph_hamsi_big_context *)cc, IV384);
} }
/* see sph_hamsi.h */ /* see sph_hamsi.h */
void void
sph_hamsi384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_hamsi384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
hamsi_big_close(cc, ub, n, dst, 12); hamsi_big_close((sph_hamsi_big_context *)cc, ub, n, dst, 12);
hamsi_big_init(cc, IV384); hamsi_big_init((sph_hamsi_big_context *)cc, IV384);
} }
/* see sph_hamsi.h */ /* see sph_hamsi.h */
void void
sph_hamsi512_init(void *cc) sph_hamsi512_init(void *cc)
{ {
hamsi_big_init(cc, IV512); hamsi_big_init((sph_hamsi_big_context *)cc, IV512);
} }
/* see sph_hamsi.h */ /* see sph_hamsi.h */
void void
sph_hamsi512(void *cc, const void *data, size_t len) sph_hamsi512(void *cc, const void *data, size_t len)
{ {
hamsi_big_core(cc, data, len); hamsi_big_core((sph_hamsi_big_context *)cc, data, len);
} }
/* see sph_hamsi.h */ /* see sph_hamsi.h */
void void
sph_hamsi512_close(void *cc, void *dst) sph_hamsi512_close(void *cc, void *dst)
{ {
hamsi_big_close(cc, 0, 0, dst, 16); hamsi_big_close((sph_hamsi_big_context *)cc, 0, 0, dst, 16);
hamsi_big_init(cc, IV512); hamsi_big_init((sph_hamsi_big_context *)cc, IV512);
} }
/* see sph_hamsi.h */ /* see sph_hamsi.h */
void void
sph_hamsi512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_hamsi512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
hamsi_big_close(cc, ub, n, dst, 16); hamsi_big_close((sph_hamsi_big_context *)cc, ub, n, dst, 16);
hamsi_big_init(cc, IV512); hamsi_big_init((sph_hamsi_big_context *)cc, IV512);
} }

32
sph/jh.c

@ -998,110 +998,110 @@ jh_close(sph_jh_context *sc, unsigned ub, unsigned n,
void void
sph_jh224_init(void *cc) sph_jh224_init(void *cc)
{ {
jh_init(cc, IV224); jh_init((sph_jh_context *)cc, IV224);
} }
/* see sph_jh.h */ /* see sph_jh.h */
void void
sph_jh224(void *cc, const void *data, size_t len) sph_jh224(void *cc, const void *data, size_t len)
{ {
jh_core(cc, data, len); jh_core((sph_jh_context *)cc, data, len);
} }
/* see sph_jh.h */ /* see sph_jh.h */
void void
sph_jh224_close(void *cc, void *dst) sph_jh224_close(void *cc, void *dst)
{ {
jh_close(cc, 0, 0, dst, 7, IV224); jh_close((sph_jh_context *)cc, 0, 0, dst, 7, IV224);
} }
/* see sph_jh.h */ /* see sph_jh.h */
void void
sph_jh224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_jh224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
jh_close(cc, ub, n, dst, 7, IV224); jh_close((sph_jh_context *)cc, ub, n, dst, 7, IV224);
} }
/* see sph_jh.h */ /* see sph_jh.h */
void void
sph_jh256_init(void *cc) sph_jh256_init(void *cc)
{ {
jh_init(cc, IV256); jh_init((sph_jh_context *)cc, IV256);
} }
/* see sph_jh.h */ /* see sph_jh.h */
void void
sph_jh256(void *cc, const void *data, size_t len) sph_jh256(void *cc, const void *data, size_t len)
{ {
jh_core(cc, data, len); jh_core((sph_jh_context *)cc, data, len);
} }
/* see sph_jh.h */ /* see sph_jh.h */
void void
sph_jh256_close(void *cc, void *dst) sph_jh256_close(void *cc, void *dst)
{ {
jh_close(cc, 0, 0, dst, 8, IV256); jh_close((sph_jh_context *)cc, 0, 0, dst, 8, IV256);
} }
/* see sph_jh.h */ /* see sph_jh.h */
void void
sph_jh256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_jh256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
jh_close(cc, ub, n, dst, 8, IV256); jh_close((sph_jh_context *)cc, ub, n, dst, 8, IV256);
} }
/* see sph_jh.h */ /* see sph_jh.h */
void void
sph_jh384_init(void *cc) sph_jh384_init(void *cc)
{ {
jh_init(cc, IV384); jh_init((sph_jh_context *)cc, IV384);
} }
/* see sph_jh.h */ /* see sph_jh.h */
void void
sph_jh384(void *cc, const void *data, size_t len) sph_jh384(void *cc, const void *data, size_t len)
{ {
jh_core(cc, data, len); jh_core((sph_jh_context *)cc, data, len);
} }
/* see sph_jh.h */ /* see sph_jh.h */
void void
sph_jh384_close(void *cc, void *dst) sph_jh384_close(void *cc, void *dst)
{ {
jh_close(cc, 0, 0, dst, 12, IV384); jh_close((sph_jh_context *)cc, 0, 0, dst, 12, IV384);
} }
/* see sph_jh.h */ /* see sph_jh.h */
void void
sph_jh384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_jh384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
jh_close(cc, ub, n, dst, 12, IV384); jh_close((sph_jh_context *)cc, ub, n, dst, 12, IV384);
} }
/* see sph_jh.h */ /* see sph_jh.h */
void void
sph_jh512_init(void *cc) sph_jh512_init(void *cc)
{ {
jh_init(cc, IV512); jh_init((sph_jh_context *)cc, IV512);
} }
/* see sph_jh.h */ /* see sph_jh.h */
void void
sph_jh512(void *cc, const void *data, size_t len) sph_jh512(void *cc, const void *data, size_t len)
{ {
jh_core(cc, data, len); jh_core((sph_jh_context *)cc, data, len);
} }
/* see sph_jh.h */ /* see sph_jh.h */
void void
sph_jh512_close(void *cc, void *dst) sph_jh512_close(void *cc, void *dst)
{ {
jh_close(cc, 0, 0, dst, 16, IV512); jh_close((sph_jh_context *)cc, 0, 0, dst, 16, IV512);
} }
/* see sph_jh.h */ /* see sph_jh.h */
void void
sph_jh512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_jh512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
jh_close(cc, ub, n, dst, 16, IV512); jh_close((sph_jh_context *)cc, ub, n, dst, 16, IV512);
} }

24
sph/keccak.c

@ -1706,14 +1706,14 @@ DEFCLOSE(64, 72)
void void
sph_keccak224_init(void *cc) sph_keccak224_init(void *cc)
{ {
keccak_init(cc, 224); keccak_init((sph_keccak_context *)cc, 224);
} }
/* see sph_keccak.h */ /* see sph_keccak.h */
void void
sph_keccak224(void *cc, const void *data, size_t len) sph_keccak224(void *cc, const void *data, size_t len)
{ {
keccak_core(cc, data, len, 144); keccak_core((sph_keccak_context *)cc, data, len, 144);
} }
/* see sph_keccak.h */ /* see sph_keccak.h */
@ -1727,21 +1727,21 @@ sph_keccak224_close(void *cc, void *dst)
void void
sph_keccak224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_keccak224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
keccak_close28(cc, ub, n, dst); keccak_close28((sph_keccak_context *)cc, ub, n, dst);
} }
/* see sph_keccak.h */ /* see sph_keccak.h */
void void
sph_keccak256_init(void *cc) sph_keccak256_init(void *cc)
{ {
keccak_init(cc, 256); keccak_init((sph_keccak_context *)cc, 256);
} }
/* see sph_keccak.h */ /* see sph_keccak.h */
void void
sph_keccak256(void *cc, const void *data, size_t len) sph_keccak256(void *cc, const void *data, size_t len)
{ {
keccak_core(cc, data, len, 136); keccak_core((sph_keccak_context *)cc, data, len, 136);
} }
/* see sph_keccak.h */ /* see sph_keccak.h */
@ -1755,21 +1755,21 @@ sph_keccak256_close(void *cc, void *dst)
void void
sph_keccak256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_keccak256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
keccak_close32(cc, ub, n, dst); keccak_close32((sph_keccak_context *)cc, ub, n, dst);
} }
/* see sph_keccak.h */ /* see sph_keccak.h */
void void
sph_keccak384_init(void *cc) sph_keccak384_init(void *cc)
{ {
keccak_init(cc, 384); keccak_init((sph_keccak_context *)cc, 384);
} }
/* see sph_keccak.h */ /* see sph_keccak.h */
void void
sph_keccak384(void *cc, const void *data, size_t len) sph_keccak384(void *cc, const void *data, size_t len)
{ {
keccak_core(cc, data, len, 104); keccak_core((sph_keccak_context *)cc, data, len, 104);
} }
/* see sph_keccak.h */ /* see sph_keccak.h */
@ -1783,21 +1783,21 @@ sph_keccak384_close(void *cc, void *dst)
void void
sph_keccak384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_keccak384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
keccak_close48(cc, ub, n, dst); keccak_close48((sph_keccak_context *)cc, ub, n, dst);
} }
/* see sph_keccak.h */ /* see sph_keccak.h */
void void
sph_keccak512_init(void *cc) sph_keccak512_init(void *cc)
{ {
keccak_init(cc, 512); keccak_init((sph_keccak_context *)cc, 512);
} }
/* see sph_keccak.h */ /* see sph_keccak.h */
void void
sph_keccak512(void *cc, const void *data, size_t len) sph_keccak512(void *cc, const void *data, size_t len)
{ {
keccak_core(cc, data, len, 72); keccak_core((sph_keccak_context *)cc, data, len, 72);
} }
/* see sph_keccak.h */ /* see sph_keccak.h */
@ -1811,5 +1811,5 @@ sph_keccak512_close(void *cc, void *dst)
void void
sph_keccak512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_keccak512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
keccak_close64(cc, ub, n, dst); keccak_close64((sph_keccak_context *)cc, ub, n, dst);
} }

30
sph/luffa.c

@ -1109,7 +1109,7 @@ luffa3_close(sph_luffa224_context *sc, unsigned ub, unsigned n,
P3; P3;
memset(buf, 0, sizeof sc->buf); memset(buf, 0, sizeof sc->buf);
} }
out = dst; out = (unsigned char *)dst;
sph_enc32be(out + 0, V00 ^ V10 ^ V20); sph_enc32be(out + 0, V00 ^ V10 ^ V20);
sph_enc32be(out + 4, V01 ^ V11 ^ V21); sph_enc32be(out + 4, V01 ^ V11 ^ V21);
sph_enc32be(out + 8, V02 ^ V12 ^ V22); sph_enc32be(out + 8, V02 ^ V12 ^ V22);
@ -1169,7 +1169,7 @@ luffa4_close(sph_luffa384_context *sc, unsigned ub, unsigned n, void *dst)
buf = sc->buf; buf = sc->buf;
ptr = sc->ptr; ptr = sc->ptr;
out = dst; out = (unsigned char *)dst;
z = 0x80 >> n; z = 0x80 >> n;
buf[ptr ++] = ((ub & -z) | z) & 0xFF; buf[ptr ++] = ((ub & -z) | z) & 0xFF;
memset(buf + ptr, 0, (sizeof sc->buf) - ptr); memset(buf + ptr, 0, (sizeof sc->buf) - ptr);
@ -1249,7 +1249,7 @@ luffa5_close(sph_luffa512_context *sc, unsigned ub, unsigned n, void *dst)
buf = sc->buf; buf = sc->buf;
ptr = sc->ptr; ptr = sc->ptr;
out = dst; out = (unsigned char *)dst;
z = 0x80 >> n; z = 0x80 >> n;
buf[ptr ++] = ((ub & -z) | z) & 0xFF; buf[ptr ++] = ((ub & -z) | z) & 0xFF;
memset(buf + ptr, 0, (sizeof sc->buf) - ptr); memset(buf + ptr, 0, (sizeof sc->buf) - ptr);
@ -1291,7 +1291,7 @@ sph_luffa224_init(void *cc)
{ {
sph_luffa224_context *sc; sph_luffa224_context *sc;
sc = cc; sc = (sph_luffa224_context *)cc;
memcpy(sc->V, V_INIT, sizeof(sc->V)); memcpy(sc->V, V_INIT, sizeof(sc->V));
sc->ptr = 0; sc->ptr = 0;
} }
@ -1300,7 +1300,7 @@ sph_luffa224_init(void *cc)
void void
sph_luffa224(void *cc, const void *data, size_t len) sph_luffa224(void *cc, const void *data, size_t len)
{ {
luffa3(cc, data, len); luffa3((sph_luffa224_context *)cc, data, len);
} }
/* see sph_luffa.h */ /* see sph_luffa.h */
@ -1314,7 +1314,7 @@ sph_luffa224_close(void *cc, void *dst)
void void
sph_luffa224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_luffa224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
luffa3_close(cc, ub, n, dst, 7); luffa3_close((sph_luffa224_context *)cc, ub, n, dst, 7);
sph_luffa224_init(cc); sph_luffa224_init(cc);
} }
@ -1324,7 +1324,7 @@ sph_luffa256_init(void *cc)
{ {
sph_luffa256_context *sc; sph_luffa256_context *sc;
sc = cc; sc = (sph_luffa256_context *)cc;
memcpy(sc->V, V_INIT, sizeof(sc->V)); memcpy(sc->V, V_INIT, sizeof(sc->V));
sc->ptr = 0; sc->ptr = 0;
} }
@ -1333,7 +1333,7 @@ sph_luffa256_init(void *cc)
void void
sph_luffa256(void *cc, const void *data, size_t len) sph_luffa256(void *cc, const void *data, size_t len)
{ {
luffa3(cc, data, len); luffa3((sph_luffa224_context *)cc, data, len);
} }
/* see sph_luffa.h */ /* see sph_luffa.h */
@ -1347,7 +1347,7 @@ sph_luffa256_close(void *cc, void *dst)
void void
sph_luffa256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_luffa256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
luffa3_close(cc, ub, n, dst, 8); luffa3_close((sph_luffa224_context *)cc, ub, n, dst, 8);
sph_luffa256_init(cc); sph_luffa256_init(cc);
} }
@ -1357,7 +1357,7 @@ sph_luffa384_init(void *cc)
{ {
sph_luffa384_context *sc; sph_luffa384_context *sc;
sc = cc; sc = (sph_luffa384_context *)cc;
memcpy(sc->V, V_INIT, sizeof(sc->V)); memcpy(sc->V, V_INIT, sizeof(sc->V));
sc->ptr = 0; sc->ptr = 0;
} }
@ -1366,7 +1366,7 @@ sph_luffa384_init(void *cc)
void void
sph_luffa384(void *cc, const void *data, size_t len) sph_luffa384(void *cc, const void *data, size_t len)
{ {
luffa4(cc, data, len); luffa4((sph_luffa384_context *)cc, data, len);
} }
/* see sph_luffa.h */ /* see sph_luffa.h */
@ -1380,7 +1380,7 @@ sph_luffa384_close(void *cc, void *dst)
void void
sph_luffa384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_luffa384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
luffa4_close(cc, ub, n, dst); luffa4_close((sph_luffa384_context *)cc, ub, n, dst);
sph_luffa384_init(cc); sph_luffa384_init(cc);
} }
@ -1390,7 +1390,7 @@ sph_luffa512_init(void *cc)
{ {
sph_luffa512_context *sc; sph_luffa512_context *sc;
sc = cc; sc = (sph_luffa512_context *)cc;
memcpy(sc->V, V_INIT, sizeof(sc->V)); memcpy(sc->V, V_INIT, sizeof(sc->V));
sc->ptr = 0; sc->ptr = 0;
} }
@ -1399,7 +1399,7 @@ sph_luffa512_init(void *cc)
void void
sph_luffa512(void *cc, const void *data, size_t len) sph_luffa512(void *cc, const void *data, size_t len)
{ {
luffa5(cc, data, len); luffa5((sph_luffa512_context *)cc, data, len);
} }
/* see sph_luffa.h */ /* see sph_luffa.h */
@ -1413,6 +1413,6 @@ sph_luffa512_close(void *cc, void *dst)
void void
sph_luffa512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_luffa512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
luffa5_close(cc, ub, n, dst); luffa5_close((sph_luffa512_context *)cc, ub, n, dst);
sph_luffa512_init(cc); sph_luffa512_init(cc);
} }

8
sph/md_helper.c

@ -131,7 +131,7 @@ SPH_XCAT(sph_, HASH)(void *cc, const void *data, size_t len)
SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc; SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *sc;
unsigned current; unsigned current;
sc = cc; sc = (SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *)cc;
#if SPH_64 #if SPH_64
current = (unsigned)sc->count & (SPH_BLEN - 1U); current = (unsigned)sc->count & (SPH_BLEN - 1U);
#else #else
@ -181,7 +181,7 @@ SPH_XCAT(sph_, HASH)(void *cc, const void *data, size_t len)
SPH_XCAT(HASH, _short)(cc, data, len); SPH_XCAT(HASH, _short)(cc, data, len);
return; return;
} }
sc = cc; sc = (SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *)cc;
#if SPH_64 #if SPH_64
current = (unsigned)sc->count & (SPH_BLEN - 1U); current = (unsigned)sc->count & (SPH_BLEN - 1U);
#else #else
@ -203,7 +203,7 @@ SPH_XCAT(sph_, HASH)(void *cc, const void *data, size_t len)
#endif #endif
orig_len = len; orig_len = len;
while (len >= SPH_BLEN) { while (len >= SPH_BLEN) {
RFUN(data, SPH_VAL); RFUN((const unsigned char *)data, SPH_VAL);
len -= SPH_BLEN; len -= SPH_BLEN;
data = (const unsigned char *)data + SPH_BLEN; data = (const unsigned char *)data + SPH_BLEN;
} }
@ -245,7 +245,7 @@ SPH_XCAT(HASH, _addbits_and_close)(void *cc,
sph_u32 low, high; sph_u32 low, high;
#endif #endif
sc = cc; sc = (SPH_XCAT(sph_, SPH_XCAT(HASH, _context)) *)cc;
#if SPH_64 #if SPH_64
current = (unsigned)sc->count & (SPH_BLEN - 1U); current = (unsigned)sc->count & (SPH_BLEN - 1U);
#else #else

10
sph/panama.c

@ -231,7 +231,7 @@ sph_panama_init(void *cc)
{ {
sph_panama_context *sc; sph_panama_context *sc;
sc = cc; sc = (sph_panama_context *)cc;
/* /*
* This is not completely conformant, but "it will work * This is not completely conformant, but "it will work
* everywhere". Initial state consists of zeroes everywhere. * everywhere". Initial state consists of zeroes everywhere.
@ -256,7 +256,7 @@ sph_panama(void *cc, const void *data, size_t len)
sph_panama_context *sc; sph_panama_context *sc;
unsigned current; unsigned current;
sc = cc; sc = (sph_panama_context *)cc;
current = sc->data_ptr; current = sc->data_ptr;
while (len > 0) { while (len > 0) {
unsigned clen; unsigned clen;
@ -289,7 +289,7 @@ sph_panama(void *cc, const void *data, size_t len)
panama_short(cc, data, len); panama_short(cc, data, len);
return; return;
} }
sc = cc; sc = (sph_panama_context *)cc;
current = sc->data_ptr; current = sc->data_ptr;
if (current > 0) { if (current > 0) {
unsigned t; unsigned t;
@ -305,7 +305,7 @@ sph_panama(void *cc, const void *data, size_t len)
return; return;
} }
#endif #endif
panama_push(sc, data, len >> 5); panama_push(sc, (const unsigned char *)data, len >> 5);
rlen = len & 31; rlen = len & 31;
if (rlen > 0) if (rlen > 0)
memcpy(sc->data, memcpy(sc->data,
@ -322,7 +322,7 @@ sph_panama_close(void *cc, void *dst)
unsigned current; unsigned current;
int i; int i;
sc = cc; sc = (sph_panama_context *)cc;
current = sc->data_ptr; current = sc->data_ptr;
sc->data[current ++] = 0x01; sc->data[current ++] = 0x01;
memset(sc->data + current, 0, (sizeof sc->data) - current); memset(sc->data + current, 0, (sizeof sc->data) - current);

4
sph/sha2.c

@ -619,7 +619,7 @@ sph_sha224_init(void *cc)
{ {
sph_sha224_context *sc; sph_sha224_context *sc;
sc = cc; sc = (sph_sha224_context *)cc;
memcpy(sc->val, H224, sizeof H224); memcpy(sc->val, H224, sizeof H224);
#if SPH_64 #if SPH_64
sc->count = 0; sc->count = 0;
@ -634,7 +634,7 @@ sph_sha256_init(void *cc)
{ {
sph_sha256_context *sc; sph_sha256_context *sc;
sc = cc; sc = (sph_sha256_context *)cc;
memcpy(sc->val, H256, sizeof H256); memcpy(sc->val, H256, sizeof H256);
#if SPH_64 #if SPH_64
sc->count = 0; sc->count = 0;

4
sph/sha2big.c

@ -182,7 +182,7 @@ sph_sha384_init(void *cc)
{ {
sph_sha384_context *sc; sph_sha384_context *sc;
sc = cc; sc = (sph_sha384_context *)cc;
memcpy(sc->val, H384, sizeof H384); memcpy(sc->val, H384, sizeof H384);
sc->count = 0; sc->count = 0;
} }
@ -193,7 +193,7 @@ sph_sha512_init(void *cc)
{ {
sph_sha512_context *sc; sph_sha512_context *sc;
sc = cc; sc = (sph_sha512_context *)cc;
memcpy(sc->val, H512, sizeof H512); memcpy(sc->val, H512, sizeof H512);
sc->count = 0; sc->count = 0;
} }

48
sph/shavite.c

@ -1639,118 +1639,118 @@ shavite_big_close(sph_shavite_big_context *sc,
void void
sph_shavite224_init(void *cc) sph_shavite224_init(void *cc)
{ {
shavite_small_init(cc, IV224); shavite_small_init((sph_shavite_small_context *)cc, IV224);
} }
/* see sph_shavite.h */ /* see sph_shavite.h */
void void
sph_shavite224(void *cc, const void *data, size_t len) sph_shavite224(void *cc, const void *data, size_t len)
{ {
shavite_small_core(cc, data, len); shavite_small_core((sph_shavite_small_context *)cc, data, len);
} }
/* see sph_shavite.h */ /* see sph_shavite.h */
void void
sph_shavite224_close(void *cc, void *dst) sph_shavite224_close(void *cc, void *dst)
{ {
shavite_small_close(cc, 0, 0, dst, 7); shavite_small_close((sph_shavite_small_context *)cc, 0, 0, dst, 7);
shavite_small_init(cc, IV224); shavite_small_init((sph_shavite_small_context *)cc, IV224);
} }
/* see sph_shavite.h */ /* see sph_shavite.h */
void void
sph_shavite224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_shavite224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
shavite_small_close(cc, ub, n, dst, 7); shavite_small_close((sph_shavite_small_context *)cc, ub, n, dst, 7);
shavite_small_init(cc, IV224); shavite_small_init((sph_shavite_small_context *)cc, IV224);
} }
/* see sph_shavite.h */ /* see sph_shavite.h */
void void
sph_shavite256_init(void *cc) sph_shavite256_init(void *cc)
{ {
shavite_small_init(cc, IV256); shavite_small_init((sph_shavite_small_context *)cc, IV256);
} }
/* see sph_shavite.h */ /* see sph_shavite.h */
void void
sph_shavite256(void *cc, const void *data, size_t len) sph_shavite256(void *cc, const void *data, size_t len)
{ {
shavite_small_core(cc, data, len); shavite_small_core((sph_shavite_small_context *)cc, data, len);
} }
/* see sph_shavite.h */ /* see sph_shavite.h */
void void
sph_shavite256_close(void *cc, void *dst) sph_shavite256_close(void *cc, void *dst)
{ {
shavite_small_close(cc, 0, 0, dst, 8); shavite_small_close((sph_shavite_small_context *)cc, 0, 0, dst, 8);
shavite_small_init(cc, IV256); shavite_small_init((sph_shavite_small_context *)cc, IV256);
} }
/* see sph_shavite.h */ /* see sph_shavite.h */
void void
sph_shavite256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_shavite256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
shavite_small_close(cc, ub, n, dst, 8); shavite_small_close((sph_shavite_small_context *)cc, ub, n, dst, 8);
shavite_small_init(cc, IV256); shavite_small_init((sph_shavite_small_context *)cc, IV256);
} }
/* see sph_shavite.h */ /* see sph_shavite.h */
void void
sph_shavite384_init(void *cc) sph_shavite384_init(void *cc)
{ {
shavite_big_init(cc, IV384); shavite_big_init((sph_shavite_big_context *)cc, IV384);
} }
/* see sph_shavite.h */ /* see sph_shavite.h */
void void
sph_shavite384(void *cc, const void *data, size_t len) sph_shavite384(void *cc, const void *data, size_t len)
{ {
shavite_big_core(cc, data, len); shavite_big_core((sph_shavite_big_context *)cc, data, len);
} }
/* see sph_shavite.h */ /* see sph_shavite.h */
void void
sph_shavite384_close(void *cc, void *dst) sph_shavite384_close(void *cc, void *dst)
{ {
shavite_big_close(cc, 0, 0, dst, 12); shavite_big_close((sph_shavite_big_context *)cc, 0, 0, dst, 12);
shavite_big_init(cc, IV384); shavite_big_init((sph_shavite_big_context *)cc, IV384);
} }
/* see sph_shavite.h */ /* see sph_shavite.h */
void void
sph_shavite384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_shavite384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
shavite_big_close(cc, ub, n, dst, 12); shavite_big_close((sph_shavite_big_context *)cc, ub, n, dst, 12);
shavite_big_init(cc, IV384); shavite_big_init((sph_shavite_big_context *)cc, IV384);
} }
/* see sph_shavite.h */ /* see sph_shavite.h */
void void
sph_shavite512_init(void *cc) sph_shavite512_init(void *cc)
{ {
shavite_big_init(cc, IV512); shavite_big_init((sph_shavite_big_context *)cc, IV512);
} }
/* see sph_shavite.h */ /* see sph_shavite.h */
void void
sph_shavite512(void *cc, const void *data, size_t len) sph_shavite512(void *cc, const void *data, size_t len)
{ {
shavite_big_core(cc, data, len); shavite_big_core((sph_shavite_big_context *)cc, data, len);
} }
/* see sph_shavite.h */ /* see sph_shavite.h */
void void
sph_shavite512_close(void *cc, void *dst) sph_shavite512_close(void *cc, void *dst)
{ {
shavite_big_close(cc, 0, 0, dst, 16); shavite_big_close((sph_shavite_big_context *)cc, 0, 0, dst, 16);
shavite_big_init(cc, IV512); shavite_big_init((sph_shavite_big_context *)cc, IV512);
} }
/* see sph_shavite.h */ /* see sph_shavite.h */
void void
sph_shavite512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_shavite512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
shavite_big_close(cc, ub, n, dst, 16); shavite_big_close((sph_shavite_big_context *)cc, ub, n, dst, 16);
shavite_big_init(cc, IV512); shavite_big_init((sph_shavite_big_context *)cc, IV512);
} }

20
sph/simd.c

@ -1558,7 +1558,7 @@ init_small(void *cc, const u32 *iv)
{ {
sph_simd_small_context *sc; sph_simd_small_context *sc;
sc = cc; sc = (sph_simd_small_context *)cc;
memcpy(sc->state, iv, sizeof sc->state); memcpy(sc->state, iv, sizeof sc->state);
sc->count_low = sc->count_high = 0; sc->count_low = sc->count_high = 0;
sc->ptr = 0; sc->ptr = 0;
@ -1569,7 +1569,7 @@ init_big(void *cc, const u32 *iv)
{ {
sph_simd_big_context *sc; sph_simd_big_context *sc;
sc = cc; sc = (sph_simd_big_context *)cc;
memcpy(sc->state, iv, sizeof sc->state); memcpy(sc->state, iv, sizeof sc->state);
sc->count_low = sc->count_high = 0; sc->count_low = sc->count_high = 0;
sc->ptr = 0; sc->ptr = 0;
@ -1580,7 +1580,7 @@ update_small(void *cc, const void *data, size_t len)
{ {
sph_simd_small_context *sc; sph_simd_small_context *sc;
sc = cc; sc = (sph_simd_small_context *)cc;
while (len > 0) { while (len > 0) {
size_t clen; size_t clen;
@ -1605,7 +1605,7 @@ update_big(void *cc, const void *data, size_t len)
{ {
sph_simd_big_context *sc; sph_simd_big_context *sc;
sc = cc; sc = (sph_simd_big_context *)cc;
while (len > 0) { while (len > 0) {
size_t clen; size_t clen;
@ -1654,7 +1654,7 @@ finalize_small(void *cc, unsigned ub, unsigned n, void *dst, size_t dst_len)
unsigned char *d; unsigned char *d;
size_t u; size_t u;
sc = cc; sc = (sph_simd_small_context *)cc;
if (sc->ptr > 0 || n > 0) { if (sc->ptr > 0 || n > 0) {
memset(sc->buf + sc->ptr, 0, memset(sc->buf + sc->ptr, 0,
(sizeof sc->buf) - sc->ptr); (sizeof sc->buf) - sc->ptr);
@ -1664,8 +1664,8 @@ finalize_small(void *cc, unsigned ub, unsigned n, void *dst, size_t dst_len)
memset(sc->buf, 0, sizeof sc->buf); memset(sc->buf, 0, sizeof sc->buf);
encode_count_small(sc->buf, sc->count_low, sc->count_high, sc->ptr, n); encode_count_small(sc->buf, sc->count_low, sc->count_high, sc->ptr, n);
compress_small(sc, 1); compress_small(sc, 1);
d = dst; d = (unsigned char *)dst;
for (d = dst, u = 0; u < dst_len; u ++) for (d = (unsigned char *)dst, u = 0; u < dst_len; u ++)
sph_enc32le(d + (u << 2), sc->state[u]); sph_enc32le(d + (u << 2), sc->state[u]);
} }
@ -1676,7 +1676,7 @@ finalize_big(void *cc, unsigned ub, unsigned n, void *dst, size_t dst_len)
unsigned char *d; unsigned char *d;
size_t u; size_t u;
sc = cc; sc = (sph_simd_big_context *)cc;
if (sc->ptr > 0 || n > 0) { if (sc->ptr > 0 || n > 0) {
memset(sc->buf + sc->ptr, 0, memset(sc->buf + sc->ptr, 0,
(sizeof sc->buf) - sc->ptr); (sizeof sc->buf) - sc->ptr);
@ -1686,8 +1686,8 @@ finalize_big(void *cc, unsigned ub, unsigned n, void *dst, size_t dst_len)
memset(sc->buf, 0, sizeof sc->buf); memset(sc->buf, 0, sizeof sc->buf);
encode_count_big(sc->buf, sc->count_low, sc->count_high, sc->ptr, n); encode_count_big(sc->buf, sc->count_low, sc->count_high, sc->ptr, n);
compress_big(sc, 1); compress_big(sc, 1);
d = dst; d = (unsigned char *)dst;
for (d = dst, u = 0; u < dst_len; u ++) for (d = (unsigned char *)dst, u = 0; u < dst_len; u ++)
sph_enc32le(d + (u << 2), sc->state[u]); sph_enc32le(d + (u << 2), sc->state[u]);
} }

24
sph/skein.c

@ -1129,14 +1129,14 @@ sph_skein256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
void void
sph_skein224_init(void *cc) sph_skein224_init(void *cc)
{ {
skein_big_init(cc, IV224); skein_big_init((sph_skein_big_context *)cc, IV224);
} }
/* see sph_skein.h */ /* see sph_skein.h */
void void
sph_skein224(void *cc, const void *data, size_t len) sph_skein224(void *cc, const void *data, size_t len)
{ {
skein_big_core(cc, data, len); skein_big_core((sph_skein_big_context *)cc, data, len);
} }
/* see sph_skein.h */ /* see sph_skein.h */
@ -1150,7 +1150,7 @@ sph_skein224_close(void *cc, void *dst)
void void
sph_skein224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_skein224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
skein_big_close(cc, ub, n, dst, 28); skein_big_close((sph_skein_big_context *)cc, ub, n, dst, 28);
sph_skein224_init(cc); sph_skein224_init(cc);
} }
@ -1158,14 +1158,14 @@ sph_skein224_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
void void
sph_skein256_init(void *cc) sph_skein256_init(void *cc)
{ {
skein_big_init(cc, IV256); skein_big_init((sph_skein_big_context *)cc, IV256);
} }
/* see sph_skein.h */ /* see sph_skein.h */
void void
sph_skein256(void *cc, const void *data, size_t len) sph_skein256(void *cc, const void *data, size_t len)
{ {
skein_big_core(cc, data, len); skein_big_core((sph_skein_big_context *)cc, data, len);
} }
/* see sph_skein.h */ /* see sph_skein.h */
@ -1179,7 +1179,7 @@ sph_skein256_close(void *cc, void *dst)
void void
sph_skein256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_skein256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
skein_big_close(cc, ub, n, dst, 32); skein_big_close((sph_skein_big_context *)cc, ub, n, dst, 32);
sph_skein256_init(cc); sph_skein256_init(cc);
} }
@ -1187,14 +1187,14 @@ sph_skein256_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
void void
sph_skein384_init(void *cc) sph_skein384_init(void *cc)
{ {
skein_big_init(cc, IV384); skein_big_init((sph_skein_big_context *)cc, IV384);
} }
/* see sph_skein.h */ /* see sph_skein.h */
void void
sph_skein384(void *cc, const void *data, size_t len) sph_skein384(void *cc, const void *data, size_t len)
{ {
skein_big_core(cc, data, len); skein_big_core((sph_skein_big_context *)cc, data, len);
} }
/* see sph_skein.h */ /* see sph_skein.h */
@ -1208,7 +1208,7 @@ sph_skein384_close(void *cc, void *dst)
void void
sph_skein384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_skein384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
skein_big_close(cc, ub, n, dst, 48); skein_big_close((sph_skein_big_context *)cc, ub, n, dst, 48);
sph_skein384_init(cc); sph_skein384_init(cc);
} }
@ -1216,14 +1216,14 @@ sph_skein384_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
void void
sph_skein512_init(void *cc) sph_skein512_init(void *cc)
{ {
skein_big_init(cc, IV512); skein_big_init((sph_skein_big_context *)cc, IV512);
} }
/* see sph_skein.h */ /* see sph_skein.h */
void void
sph_skein512(void *cc, const void *data, size_t len) sph_skein512(void *cc, const void *data, size_t len)
{ {
skein_big_core(cc, data, len); skein_big_core((sph_skein_big_context *)cc, data, len);
} }
/* see sph_skein.h */ /* see sph_skein.h */
@ -1237,7 +1237,7 @@ sph_skein512_close(void *cc, void *dst)
void void
sph_skein512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst) sph_skein512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
{ {
skein_big_close(cc, ub, n, dst, 64); skein_big_close((sph_skein_big_context *)cc, ub, n, dst, 64);
sph_skein512_init(cc); sph_skein512_init(cc);
} }

Loading…
Cancel
Save