2 * GOST R 34.11-2012 core functions definitions.
4 * Copyright (c) 2013 Cryptocom LTD.
5 * This file is distributed under the same license as OpenSSL.
7 * Author: Alexey Degtyarev <alexey@renatasystems.org>
13 #ifdef OPENSSL_IA32_SSE2
16 # define __GOST3411_HAS_SSE2__
21 #ifdef __GOST3411_HAS_SSE2__
22 # if (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 2)
23 # undef __GOST3411_HAS_SSE2__
28 # define __GOST3411_BIG_ENDIAN__
30 #if defined __GOST3411_HAS_SSE2__
31 # include "gosthash2012_sse2.h"
33 # include "gosthash2012_ref.h"
37 # define ALIGN(x) __declspec(align(x))
39 # define ALIGN(x) __attribute__ ((__aligned__(x)))
43 typedef union uint512_u {
44 unsigned long long QWORD[8];
47 #include "gosthash2012_const.h"
48 #include "gosthash2012_precalc.h"
50 /* GOST R 34.11-2012 hash context */
52 typedef struct gost2012_hash_ctx {
53 ALIGN(16) unsigned char buffer[64];
57 union uint512_u Sigma;
59 unsigned int digest_size;
62 void init_gost2012_hash_ctx(gost2012_hash_ctx * CTX,
63 const unsigned int digest_size);
64 void gost2012_hash_block(gost2012_hash_ctx * CTX,
65 const unsigned char *data, size_t len);
66 void gost2012_finish_hash(gost2012_hash_ctx * CTX, unsigned char *digest);