Monero
Loading...
Searching...
No Matches
blake2b.c File Reference
#include <stdint.h>
#include <string.h>
#include <stdio.h>
#include "blake2.h"
#include "blake2-impl.h"
Include dependency graph for blake2b.c:

Macros

#define G(r, i, a, b, c, d)
#define ROUND(r)
#define TRY(statement)

Functions

static FORCE_INLINE void blake2b_set_lastnode (blake2b_state *S)
static FORCE_INLINE void blake2b_set_lastblock (blake2b_state *S)
static FORCE_INLINE void blake2b_increment_counter (blake2b_state *S, uint64_t inc)
static FORCE_INLINE void blake2b_invalidate_state (blake2b_state *S)
static FORCE_INLINE void blake2b_init0 (blake2b_state *S)
int blake2b_init_param (blake2b_state *S, const blake2b_param *P)
int blake2b_init (blake2b_state *S, size_t outlen)
int blake2b_init_key (blake2b_state *S, size_t outlen, const void *key, size_t keylen)
static void blake2b_compress (blake2b_state *S, const uint8_t *block)
int blake2b_update (blake2b_state *S, const void *in, size_t inlen)
int blake2b_final (blake2b_state *S, void *out, size_t outlen)
int blake2b (void *out, size_t outlen, const void *in, size_t inlen, const void *key, size_t keylen)
int blake2b_long (void *pout, size_t outlen, const void *in, size_t inlen)

Variables

static const uint64_t blake2b_IV [8]
static const unsigned int blake2b_sigma [12][16]

Macro Definition Documentation

◆ G

#define G ( r,
i,
a,
b,
c,
d )
Value:
do { \
a = a + b + m[blake2b_sigma[r][2 * i + 0]]; \
d = rotr64(d ^ a, 32); \
c = c + d; \
b = rotr64(b ^ c, 24); \
a = a + b + m[blake2b_sigma[r][2 * i + 1]]; \
d = rotr64(d ^ a, 16); \
c = c + d; \
b = rotr64(b ^ c, 63); \
} while ((void)0, 0)
static FORCE_INLINE uint64_t rotr64(const uint64_t w, const unsigned c)
Definition blake2-impl.h:72
static const unsigned int blake2b_sigma[12][16]
Definition blake2b.c:48
cryptonote::block b
Definition block.cpp:40
Definition d.py:1
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1124

◆ ROUND

#define ROUND ( r)
Value:
do { \
G(r, 0, v[0], v[4], v[8], v[12]); \
G(r, 1, v[1], v[5], v[9], v[13]); \
G(r, 2, v[2], v[6], v[10], v[14]); \
G(r, 3, v[3], v[7], v[11], v[15]); \
G(r, 4, v[0], v[5], v[10], v[15]); \
G(r, 5, v[1], v[6], v[11], v[12]); \
G(r, 6, v[2], v[7], v[8], v[13]); \
G(r, 7, v[3], v[4], v[9], v[14]); \
} while ((void)0, 0)

◆ TRY

#define TRY ( statement)
Value:
do { \
ret = statement; \
if (ret < 0) { \
goto fail; \
} \
} while ((void)0, 0)

Function Documentation

◆ blake2b()

int blake2b ( void * out,
size_t outlen,
const void * in,
size_t inlen,
const void * key,
size_t keylen )

◆ blake2b_compress()

void blake2b_compress ( blake2b_state * S,
const uint8_t * block )
static

◆ blake2b_final()

int blake2b_final ( blake2b_state * S,
void * out,
size_t outlen )

◆ blake2b_increment_counter()

FORCE_INLINE void blake2b_increment_counter ( blake2b_state * S,
uint64_t inc )
static

◆ blake2b_init()

int blake2b_init ( blake2b_state * S,
size_t outlen )

◆ blake2b_init0()

FORCE_INLINE void blake2b_init0 ( blake2b_state * S)
static

◆ blake2b_init_key()

int blake2b_init_key ( blake2b_state * S,
size_t outlen,
const void * key,
size_t keylen )

◆ blake2b_init_param()

int blake2b_init_param ( blake2b_state * S,
const blake2b_param * P )

◆ blake2b_invalidate_state()

FORCE_INLINE void blake2b_invalidate_state ( blake2b_state * S)
static

◆ blake2b_long()

int blake2b_long ( void * pout,
size_t outlen,
const void * in,
size_t inlen )

◆ blake2b_set_lastblock()

FORCE_INLINE void blake2b_set_lastblock ( blake2b_state * S)
static

◆ blake2b_set_lastnode()

FORCE_INLINE void blake2b_set_lastnode ( blake2b_state * S)
static

◆ blake2b_update()

int blake2b_update ( blake2b_state * S,
const void * in,
size_t inlen )

Variable Documentation

◆ blake2b_IV

const uint64_t blake2b_IV[8]
static
Initial value:
= {
UINT64_C(0x6a09e667f3bcc908), UINT64_C(0xbb67ae8584caa73b),
UINT64_C(0x3c6ef372fe94f82b), UINT64_C(0xa54ff53a5f1d36f1),
UINT64_C(0x510e527fade682d1), UINT64_C(0x9b05688c2b3e6c1f),
UINT64_C(0x1f83d9abfb41bd6b), UINT64_C(0x5be0cd19137e2179) }
#define UINT64_C(val)
Definition stdint.h:284

◆ blake2b_sigma

const unsigned int blake2b_sigma[12][16]
static
Initial value:
= {
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
{14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3},
{11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4},
{7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8},
{9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13},
{2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9},
{12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11},
{13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10},
{6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5},
{10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0},
{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15},
{14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3},
}