ReactOS  0.4.15-dev-1374-g8d3e80e
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 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 155 of file blake2-impl.h.

Typedef Documentation

◆ blake2b_param

typedef struct blake2b_param__ blake2b_param

Definition at line 194 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 158 of file blake2-impl.h.

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 66 of file blake2-impl.h.

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

◆ load32()

static BLAKE2_INLINE uint32_t load32 ( const void src)
static

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

33 {
34 #if defined(NATIVE_LITTLE_ENDIAN)
35  uint32_t w;
36  memcpy(&w, src, sizeof w);
37  return w;
38 #else
39  const uint8_t *p = ( const uint8_t * )src;
40  return (( uint32_t )( p[0] ) << 0) |
41  (( uint32_t )( p[1] ) << 8) |
42  (( uint32_t )( p[2] ) << 16) |
43  (( uint32_t )( p[3] ) << 24) ;
44 #endif
45 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum src
Definition: glext.h:6340
BYTE uint8_t
Definition: msvideo1.c:66
UINT32 uint32_t
Definition: types.h:75
GLfloat GLfloat p
Definition: glext.h:8902
#define uint32_t
Definition: nsiface.idl:61

◆ load48()

static BLAKE2_INLINE uint64_t load48 ( const void src)
static

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

121 {
122  const uint8_t *p = ( const uint8_t * )src;
123  return (( uint64_t )( p[0] ) << 0) |
124  (( uint64_t )( p[1] ) << 8) |
125  (( uint64_t )( p[2] ) << 16) |
126  (( uint64_t )( p[3] ) << 24) |
127  (( uint64_t )( p[4] ) << 32) |
128  (( uint64_t )( p[5] ) << 40) ;
129 }
GLenum src
Definition: glext.h:6340
BYTE uint8_t
Definition: msvideo1.c:66
#define uint64_t
Definition: nsiface.idl:62
UINT64 uint64_t
Definition: types.h:77
GLfloat GLfloat p
Definition: glext.h:8902

◆ load64()

static BLAKE2_INLINE uint64_t load64 ( const void src)
static

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

48 {
49 #if defined(NATIVE_LITTLE_ENDIAN)
50  uint64_t w;
51  memcpy(&w, src, sizeof w);
52  return w;
53 #else
54  const uint8_t *p = ( const uint8_t * )src;
55  return (( uint64_t )( p[0] ) << 0) |
56  (( uint64_t )( p[1] ) << 8) |
57  (( uint64_t )( p[2] ) << 16) |
58  (( uint64_t )( p[3] ) << 24) |
59  (( uint64_t )( p[4] ) << 32) |
60  (( uint64_t )( p[5] ) << 40) |
61  (( uint64_t )( p[6] ) << 48) |
62  (( uint64_t )( p[7] ) << 56) ;
63 #endif
64 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum src
Definition: glext.h:6340
BYTE uint8_t
Definition: msvideo1.c:66
#define uint64_t
Definition: nsiface.idl:62
UINT64 uint64_t
Definition: types.h:77
GLfloat GLfloat p
Definition: glext.h:8902

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 142 of file blake2-impl.h.

143 {
144  return ( w >> c ) | ( w << ( 32 - c ) );
145 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
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 147 of file blake2-impl.h.

148 {
149  return ( w >> c ) | ( w << ( 64 - c ) );
150 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
const GLubyte * c
Definition: glext.h:8905
#define c
Definition: ke_i.h:80

◆ store16()

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

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

80 {
81 #if defined(NATIVE_LITTLE_ENDIAN)
82  memcpy(dst, &w, sizeof w);
83 #else
84  uint8_t *p = ( uint8_t * )dst;
85  *p++ = ( uint8_t )w; w >>= 8;
86  *p++ = ( uint8_t )w;
87 #endif
88 }
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 uint8_t
Definition: nsiface.idl:59
GLenum GLenum dst
Definition: glext.h:6340
GLfloat GLfloat p
Definition: glext.h:8902

◆ store32()

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

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

91 {
92 #if defined(NATIVE_LITTLE_ENDIAN)
93  memcpy(dst, &w, sizeof w);
94 #else
95  uint8_t *p = ( uint8_t * )dst;
96  p[0] = (uint8_t)(w >> 0);
97  p[1] = (uint8_t)(w >> 8);
98  p[2] = (uint8_t)(w >> 16);
99  p[3] = (uint8_t)(w >> 24);
100 #endif
101 }
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 uint8_t
Definition: nsiface.idl:59
GLenum GLenum dst
Definition: glext.h:6340
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by blake2b_init().

◆ store48()

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

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

132 {
133  uint8_t *p = ( uint8_t * )dst;
134  p[0] = (uint8_t)(w >> 0);
135  p[1] = (uint8_t)(w >> 8);
136  p[2] = (uint8_t)(w >> 16);
137  p[3] = (uint8_t)(w >> 24);
138  p[4] = (uint8_t)(w >> 32);
139  p[5] = (uint8_t)(w >> 40);
140 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
BYTE uint8_t
Definition: msvideo1.c:66
#define uint8_t
Definition: nsiface.idl:59
GLenum GLenum dst
Definition: glext.h:6340
GLfloat GLfloat p
Definition: glext.h:8902

◆ store64()

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

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

104 {
105 #if defined(NATIVE_LITTLE_ENDIAN)
106  memcpy(dst, &w, sizeof w);
107 #else
108  uint8_t *p = ( uint8_t * )dst;
109  p[0] = (uint8_t)(w >> 0);
110  p[1] = (uint8_t)(w >> 8);
111  p[2] = (uint8_t)(w >> 16);
112  p[3] = (uint8_t)(w >> 24);
113  p[4] = (uint8_t)(w >> 32);
114  p[5] = (uint8_t)(w >> 40);
115  p[6] = (uint8_t)(w >> 48);
116  p[7] = (uint8_t)(w >> 56);
117 #endif
118 }
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 uint8_t
Definition: nsiface.idl:59
GLenum GLenum dst
Definition: glext.h:6340
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by blake2b_final().