Raven Core  3.0.0
P2P Digital Currency
Macros | Functions
sph_whirlpool.c File Reference
#include <stddef.h>
#include <string.h>
#include "sph_whirlpool.h"
#include "md_helper.c"
Include dependency graph for sph_whirlpool.c:

Go to the source code of this file.

Macros

#define DECL8(z)
 
#define READ_DATA_W(x)
 
#define UPDATE_STATE_W(x)
 
#define LVARS   DECL8(n); DECL8(sn); DECL8(h);
 
#define READ_STATE_W(x)   do { h ## x = state[x]; } while (0)
 
#define MUL8(FUN)
 
#define ROUND0_W(x)
 
#define READ_DATA   MUL8(READ_DATA_W)
 
#define READ_STATE   MUL8(READ_STATE_W)
 
#define ROUND0   MUL8(ROUND0_W)
 
#define UPDATE_STATE   MUL8(UPDATE_STATE_W)
 
#define BYTE(x, n)   ((unsigned)((x) >> (8 * (n))) & 0xFF)
 
#define ROUND_ELT(table, in, i0, i1, i2, i3, i4, i5, i6, i7)
 
#define ROUND(table, in, out, c0, c1, c2, c3, c4, c5, c6, c7)
 
#define ROUND_KSCHED(table, in, out, c)   ROUND(table, in, out, c, 0, 0, 0, 0, 0, 0, 0)
 
#define ROUND_WENC(table, in, key, out)
 
#define TRANSFER(dst, src)
 
#define ROUND_FUN(name, type)
 
#define BE64   1
 
#define SVAL   sc->state
 
#define BLEN   64U
 
#define PLW4   1
 
#define RFUN   whirlpool_round
 
#define HASH   whirlpool
 
#define RFUN   whirlpool0_round
 
#define HASH   whirlpool0
 
#define RFUN   whirlpool1_round
 
#define HASH   whirlpool1
 
#define MAKE_CLOSE(name)
 

Functions

void sph_whirlpool_init (void *cc)
 

Macro Definition Documentation

◆ BE64

#define BE64   1

Definition at line 3438 of file sph_whirlpool.c.

◆ BLEN

#define BLEN   64U

Definition at line 3440 of file sph_whirlpool.c.

◆ BYTE

#define BYTE (   x,
 
)    ((unsigned)((x) >> (8 * (n))) & 0xFF)

Definition at line 3327 of file sph_whirlpool.c.

◆ DECL8

#define DECL8 (   z)
Value:
sph_u64 z ## 0, z ## 1, z ## 2, z ## 3, \
z ## 4, z ## 5, z ## 6, z ## 7

Definition at line 3278 of file sph_whirlpool.c.

◆ HASH [1/3]

#define HASH   whirlpool

Definition at line 3456 of file sph_whirlpool.c.

◆ HASH [2/3]

#define HASH   whirlpool0

Definition at line 3456 of file sph_whirlpool.c.

◆ HASH [3/3]

#define HASH   whirlpool1

Definition at line 3456 of file sph_whirlpool.c.

◆ LVARS

#define LVARS   DECL8(n); DECL8(sn); DECL8(h);

Definition at line 3299 of file sph_whirlpool.c.

◆ MAKE_CLOSE

#define MAKE_CLOSE (   name)
Value:
void \
sph_ ## name ## _close(void *cc, void *dst) \
{ \
sph_ ## name ## _context *sc; \
int i; \
\
name ## _close(cc, dst, 0); \
sc = cc; \
for (i = 0; i < 8; i ++) \
sph_enc64le((unsigned char *)dst + 8 * i, sc->state[i]); \
sph_ ## name ## _init(cc); \
}

Definition at line 3461 of file sph_whirlpool.c.

◆ MUL8

#define MUL8 (   FUN)
Value:
do { \
FUN(0); \
FUN(1); \
FUN(2); \
FUN(3); \
FUN(4); \
FUN(5); \
FUN(6); \
FUN(7); \
} while (0)

Definition at line 3304 of file sph_whirlpool.c.

◆ PLW4

#define PLW4   1

Definition at line 3441 of file sph_whirlpool.c.

◆ READ_DATA

#define READ_DATA   MUL8(READ_DATA_W)

Definition at line 3322 of file sph_whirlpool.c.

◆ READ_DATA_W

#define READ_DATA_W (   x)
Value:
do { \
sn ## x = n ## x = sph_dec64le_aligned( \
(const unsigned char *)src + 8 * (x)); \
} while (0)

Definition at line 3292 of file sph_whirlpool.c.

◆ READ_STATE

#define READ_STATE   MUL8(READ_STATE_W)

Definition at line 3323 of file sph_whirlpool.c.

◆ READ_STATE_W

#define READ_STATE_W (   x)    do { h ## x = state[x]; } while (0)

Definition at line 3302 of file sph_whirlpool.c.

◆ RFUN [1/3]

#define RFUN   whirlpool_round

Definition at line 3455 of file sph_whirlpool.c.

◆ RFUN [2/3]

#define RFUN   whirlpool0_round

Definition at line 3455 of file sph_whirlpool.c.

◆ RFUN [3/3]

#define RFUN   whirlpool1_round

Definition at line 3455 of file sph_whirlpool.c.

◆ ROUND

#define ROUND (   table,
  in,
  out,
  c0,
  c1,
  c2,
  c3,
  c4,
  c5,
  c6,
  c7 
)
Value:
do { \
out ## 0 = ROUND_ELT(table, in, 0, 7, 6, 5, 4, 3, 2, 1) ^ c0; \
out ## 1 = ROUND_ELT(table, in, 1, 0, 7, 6, 5, 4, 3, 2) ^ c1; \
out ## 2 = ROUND_ELT(table, in, 2, 1, 0, 7, 6, 5, 4, 3) ^ c2; \
out ## 3 = ROUND_ELT(table, in, 3, 2, 1, 0, 7, 6, 5, 4) ^ c3; \
out ## 4 = ROUND_ELT(table, in, 4, 3, 2, 1, 0, 7, 6, 5) ^ c4; \
out ## 5 = ROUND_ELT(table, in, 5, 4, 3, 2, 1, 0, 7, 6) ^ c5; \
out ## 6 = ROUND_ELT(table, in, 6, 5, 4, 3, 2, 1, 0, 7) ^ c6; \
out ## 7 = ROUND_ELT(table, in, 7, 6, 5, 4, 3, 2, 1, 0) ^ c7; \
} while (0)
#define ROUND_ELT(table, in, i0, i1, i2, i3, i4, i5, i6, i7)

Definition at line 3358 of file sph_whirlpool.c.

◆ ROUND0

#define ROUND0   MUL8(ROUND0_W)

Definition at line 3324 of file sph_whirlpool.c.

◆ ROUND0_W

#define ROUND0_W (   x)
Value:
do { \
n ## x ^= h ## x; \
} while (0)

Definition at line 3318 of file sph_whirlpool.c.

◆ ROUND_ELT

#define ROUND_ELT (   table,
  in,
  i0,
  i1,
  i2,
  i3,
  i4,
  i5,
  i6,
  i7 
)
Value:
(table ## 0[BYTE(in ## i0, 0)] \
^ table ## 1[BYTE(in ## i1, 1)] \
^ table ## 2[BYTE(in ## i2, 2)] \
^ table ## 3[BYTE(in ## i3, 3)] \
^ table ## 4[BYTE(in ## i4, 4)] \
^ table ## 5[BYTE(in ## i5, 5)] \
^ table ## 6[BYTE(in ## i6, 6)] \
^ table ## 7[BYTE(in ## i7, 7)])
#define BYTE(x, n)

Definition at line 3347 of file sph_whirlpool.c.

◆ ROUND_FUN

#define ROUND_FUN (   name,
  type 
)
Value:
static void \
name ## _round(const void *src, sph_u64 *state) \
{ \
LVARS \
int r; \
\
READ_DATA; \
READ_STATE; \
ROUND0; \
for (r = 0; r < 10; r ++) { \
DECL8(tmp); \
ROUND_KSCHED(type ## _T, h, tmp, type ## _RC[r]); \
TRANSFER(h, tmp); \
ROUND_WENC(type ## _T, n, h, tmp); \
TRANSFER(n, tmp); \
} \
UPDATE_STATE; \
}
#define ROUND_KSCHED(table, in, out, c)

Definition at line 3407 of file sph_whirlpool.c.

◆ ROUND_KSCHED

#define ROUND_KSCHED (   table,
  in,
  out,
 
)    ROUND(table, in, out, c, 0, 0, 0, 0, 0, 0, 0)

Definition at line 3369 of file sph_whirlpool.c.

◆ ROUND_WENC

#define ROUND_WENC (   table,
  in,
  key,
  out 
)
Value:
ROUND(table, in, out, key ## 0, key ## 1, key ## 2, \
key ## 3, key ## 4, key ## 5, key ## 6, key ## 7)
#define ROUND(table, in, out, c0, c1, c2, c3, c4, c5, c6, c7)

Definition at line 3372 of file sph_whirlpool.c.

◆ SVAL

#define SVAL   sc->state

Definition at line 3439 of file sph_whirlpool.c.

◆ TRANSFER

#define TRANSFER (   dst,
  src 
)
Value:
do { \
dst ## 0 = src ## 0; \
dst ## 1 = src ## 1; \
dst ## 2 = src ## 2; \
dst ## 3 = src ## 3; \
dst ## 4 = src ## 4; \
dst ## 5 = src ## 5; \
dst ## 6 = src ## 6; \
dst ## 7 = src ## 7; \
} while (0)

Definition at line 3376 of file sph_whirlpool.c.

◆ UPDATE_STATE

#define UPDATE_STATE   MUL8(UPDATE_STATE_W)

Definition at line 3325 of file sph_whirlpool.c.

◆ UPDATE_STATE_W

#define UPDATE_STATE_W (   x)
Value:
do { \
state[x] ^= n ## x ^ sn ## x; \
} while (0)

Definition at line 3296 of file sph_whirlpool.c.

Function Documentation

◆ sph_whirlpool_init()

void sph_whirlpool_init ( void *  cc)

Definition at line 3389 of file sph_whirlpool.c.

Here is the caller graph for this function: