ReactOS 0.4.15-dev-7953-g1f49173
blake2-impl.h File Reference
#include <stdint.h>
#include <string.h>
Include dependency graph for blake2-impl.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  blake2b_state__
 

Macros

#define BLAKE2_INLINE
 
#define NATIVE_LITTLE_ENDIAN
 
#define BLAKE2_PACKED(x)   x __attribute__((packed))
 

Typedefs

typedef struct blake2b_state__ blake2b_state
 
typedef struct blake2b_param__ blake2b_param
 

Enumerations

enum  blake2b_constant {
  BLAKE2B_BLOCKBYTES = 128 , BLAKE2B_OUTBYTES = 64 , BLAKE2B_KEYBYTES = 64 , BLAKE2B_SALTBYTES = 16 ,
  BLAKE2B_PERSONALBYTES = 16
}
 

Functions

static BLAKE2_INLINE uint32_t load32 (const void *src)
 
static BLAKE2_INLINE uint64_t load64 (const void *src)
 
static BLAKE2_INLINE uint16_t load16 (const void *src)
 
static BLAKE2_INLINE void store16 (void *dst, uint16_t w)
 
static BLAKE2_INLINE void store32 (void *dst, uint32_t w)
 
static BLAKE2_INLINE void store64 (void *dst, uint64_t w)
 
static BLAKE2_INLINE uint64_t load48 (const void *src)
 
static BLAKE2_INLINE void store48 (void *dst, uint64_t w)
 
static BLAKE2_INLINE uint32_t rotr32 (const uint32_t w, const unsigned c)
 
static BLAKE2_INLINE uint64_t rotr64 (const uint64_t w, const unsigned c)
 
 BLAKE2_PACKED (struct blake2b_param__ { uint8_t digest_length;uint8_t key_length;uint8_t fanout;uint8_t depth;uint32_t leaf_length;uint32_t node_offset;uint32_t xof_length;uint8_t node_depth;uint8_t inner_length;uint8_t reserved[14];uint8_t salt[BLAKE2B_SALTBYTES];uint8_t personal[BLAKE2B_PERSONALBYTES];})
 

Macro Definition Documentation

◆ BLAKE2_INLINE

#define BLAKE2_INLINE

Definition at line 26 of file blake2-impl.h.

◆ BLAKE2_PACKED

#define BLAKE2_PACKED (   x)    x __attribute__((packed))

Definition at line 157 of file blake2-impl.h.

◆ NATIVE_LITTLE_ENDIAN

#define NATIVE_LITTLE_ENDIAN

Definition at line 32 of file blake2-impl.h.

Typedef Documentation

◆ blake2b_param

typedef struct blake2b_param__ blake2b_param

Definition at line 196 of file blake2-impl.h.

◆ blake2b_state

Enumeration Type Documentation

◆ blake2b_constant

Enumerator
BLAKE2B_BLOCKBYTES 
BLAKE2B_OUTBYTES 
BLAKE2B_KEYBYTES 
BLAKE2B_SALTBYTES 
BLAKE2B_PERSONALBYTES 

Definition at line 160 of file blake2-impl.h.

161{
162 BLAKE2B_BLOCKBYTES = 128,
163 BLAKE2B_OUTBYTES = 64,
164 BLAKE2B_KEYBYTES = 64,
167};
@ BLAKE2B_PERSONALBYTES
Definition: blake2-impl.h:166
@ BLAKE2B_KEYBYTES
Definition: blake2-impl.h:164
@ BLAKE2B_OUTBYTES
Definition: blake2-impl.h:163
@ BLAKE2B_SALTBYTES
Definition: blake2-impl.h:165
@ BLAKE2B_BLOCKBYTES
Definition: blake2-impl.h:162

Function Documentation

◆ BLAKE2_PACKED()

BLAKE2_PACKED ( struct blake2b_param__ { uint8_t digest_length;uint8_t key_length;uint8_t fanout;uint8_t depth;uint32_t leaf_length;uint32_t node_offset;uint32_t xof_length;uint8_t node_depth;uint8_t inner_length;uint8_t reserved[14];uint8_t salt[BLAKE2B_SALTBYTES];uint8_t personal[BLAKE2B_PERSONALBYTES];}  )

◆ load16()

static BLAKE2_INLINE uint16_t load16 ( const void src)
static

Definition at line 68 of file blake2-impl.h.

69{
70#if defined(NATIVE_LITTLE_ENDIAN)
71 uint16_t w;
72 memcpy(&w, src, sizeof w);
73 return w;
74#else
75 const uint8_t *p = ( const uint8_t * )src;
76 return ( uint16_t )((( uint32_t )( p[0] ) << 0) |
77 (( uint32_t )( p[1] ) << 8));
78#endif
79}
unsigned short int uint16_t
Definition: acefiex.h:54
UINT32 uint32_t
Definition: types.h:75
GLenum src
Definition: glext.h:6340
GLfloat GLfloat p
Definition: glext.h:8902
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
BYTE uint8_t
Definition: msvideo1.c:66
#define uint32_t
Definition: nsiface.idl:61

◆ load32()

static BLAKE2_INLINE uint32_t load32 ( const void src)
static

Definition at line 34 of file blake2-impl.h.

35{
36#if defined(NATIVE_LITTLE_ENDIAN)
37 uint32_t w;
38 memcpy(&w, src, sizeof w);
39 return w;
40#else
41 const uint8_t *p = ( const uint8_t * )src;
42 return (( uint32_t )( p[0] ) << 0) |
43 (( uint32_t )( p[1] ) << 8) |
44 (( uint32_t )( p[2] ) << 16) |
45 (( uint32_t )( p[3] ) << 24) ;
46#endif
47}

◆ load48()

static BLAKE2_INLINE uint64_t load48 ( const void src)
static

Definition at line 122 of file blake2-impl.h.

123{
124 const uint8_t *p = ( const uint8_t * )src;
125 return (( uint64_t )( p[0] ) << 0) |
126 (( uint64_t )( p[1] ) << 8) |
127 (( uint64_t )( p[2] ) << 16) |
128 (( uint64_t )( p[3] ) << 24) |
129 (( uint64_t )( p[4] ) << 32) |
130 (( uint64_t )( p[5] ) << 40) ;
131}
UINT64 uint64_t
Definition: types.h:77
#define uint64_t
Definition: nsiface.idl:62

◆ load64()

static BLAKE2_INLINE uint64_t load64 ( const void src)
static

Definition at line 49 of file blake2-impl.h.

50{
51#if defined(NATIVE_LITTLE_ENDIAN)
52 uint64_t w;
53 memcpy(&w, src, sizeof w);
54 return w;
55#else
56 const uint8_t *p = ( const uint8_t * )src;
57 return (( uint64_t )( p[0] ) << 0) |
58 (( uint64_t )( p[1] ) << 8) |
59 (( uint64_t )( p[2] ) << 16) |
60 (( uint64_t )( p[3] ) << 24) |
61 (( uint64_t )( p[4] ) << 32) |
62 (( uint64_t )( p[5] ) << 40) |
63 (( uint64_t )( p[6] ) << 48) |
64 (( uint64_t )( p[7] ) << 56) ;
65#endif
66}

Referenced by blake2b_compress(), and blake2b_init_param().

◆ rotr32()

static BLAKE2_INLINE uint32_t rotr32 ( const uint32_t  w,
const unsigned  c 
)
static

Definition at line 144 of file blake2-impl.h.

145{
146 return ( w >> c ) | ( w << ( 32 - c ) );
147}
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80

◆ rotr64()

static BLAKE2_INLINE uint64_t rotr64 ( const uint64_t  w,
const unsigned  c 
)
static

Definition at line 149 of file blake2-impl.h.

150{
151 return ( w >> c ) | ( w << ( 64 - c ) );
152}

◆ store16()

static BLAKE2_INLINE void store16 ( void dst,
uint16_t  w 
)
static

Definition at line 81 of file blake2-impl.h.

82{
83#if defined(NATIVE_LITTLE_ENDIAN)
84 memcpy(dst, &w, sizeof w);
85#else
86 uint8_t *p = ( uint8_t * )dst;
87 *p++ = ( uint8_t )w; w >>= 8;
88 *p++ = ( uint8_t )w;
89#endif
90}
GLenum GLenum dst
Definition: glext.h:6340
#define uint8_t
Definition: nsiface.idl:59

◆ store32()

static BLAKE2_INLINE void store32 ( void dst,
uint32_t  w 
)
static

Definition at line 92 of file blake2-impl.h.

93{
94#if defined(NATIVE_LITTLE_ENDIAN)
95 memcpy(dst, &w, sizeof w);
96#else
97 uint8_t *p = ( uint8_t * )dst;
98 p[0] = (uint8_t)(w >> 0);
99 p[1] = (uint8_t)(w >> 8);
100 p[2] = (uint8_t)(w >> 16);
101 p[3] = (uint8_t)(w >> 24);
102#endif
103}

Referenced by blake2b_init().

◆ store48()

static BLAKE2_INLINE void store48 ( void dst,
uint64_t  w 
)
static

Definition at line 133 of file blake2-impl.h.

134{
135 uint8_t *p = ( uint8_t * )dst;
136 p[0] = (uint8_t)(w >> 0);
137 p[1] = (uint8_t)(w >> 8);
138 p[2] = (uint8_t)(w >> 16);
139 p[3] = (uint8_t)(w >> 24);
140 p[4] = (uint8_t)(w >> 32);
141 p[5] = (uint8_t)(w >> 40);
142}

◆ store64()

static BLAKE2_INLINE void store64 ( void dst,
uint64_t  w 
)
static

Definition at line 105 of file blake2-impl.h.

106{
107#if defined(NATIVE_LITTLE_ENDIAN)
108 memcpy(dst, &w, sizeof w);
109#else
110 uint8_t *p = ( uint8_t * )dst;
111 p[0] = (uint8_t)(w >> 0);
112 p[1] = (uint8_t)(w >> 8);
113 p[2] = (uint8_t)(w >> 16);
114 p[3] = (uint8_t)(w >> 24);
115 p[4] = (uint8_t)(w >> 32);
116 p[5] = (uint8_t)(w >> 40);
117 p[6] = (uint8_t)(w >> 48);
118 p[7] = (uint8_t)(w >> 56);
119#endif
120}

Referenced by blake2b_final().