Debian Codegraph @

lib/alg-gost3411-2012-core.h

raw
1 /*
2 * Copyright (c) 2013, Alexey Degtyarev <[email protected]>.
3 * All rights reserved.
4 *
5 * $Id$
6 */
7
8 #ifndef _CRYPT_ALG_GOST3411_2012_CORE_H
9 #define _CRYPT_ALG_GOST3411_2012_CORE_H
10
11 #if defined __GOST3411_HAS_SSE41__
12 #include "alg-gost3411-2012-sse41.h"
13 #elif defined __GOST3411_HAS_SSE2__
14 #include "alg-gost3411-2012-sse2.h"
15 #elif defined __GOST3411_HAS_MMX__
16 #include "alg-gost3411-2012-mmx.h"
17 #else
18 #include "alg-gost3411-2012-ref.h"
19 #endif
20
21 typedef union uint512_u
22 {
23 unsigned long long QWORD[8];
24 } uint512_u;
25
26 #include "alg-gost3411-2012-const.h"
27 #include "alg-gost3411-2012-precalc.h"
28
29 typedef struct GOST34112012Context
30 {
31 unsigned char buffer[64];
32 uint512_u hash;
33 uint512_u h;
34 uint512_u N;
35 uint512_u Sigma;
36 size_t bufsize;
37 unsigned int digest_size;
38 } GOST34112012Context;
39
40 extern void GOST34112012Init(GOST34112012Context *CTX,
41 const unsigned int digest_size);
42
43 extern void GOST34112012Update(GOST34112012Context *CTX,
44 const unsigned char *data, size_t len);
45
46 extern void GOST34112012Final(GOST34112012Context *CTX,
47 unsigned char *digest);
48
49 extern void GOST34112012Cleanup(GOST34112012Context *CTX);
50
51 #endif /* alg-gost3411-2012-core.h */