47c4ceb2cfe6e3b61ab9ed3304cce90cb0447a91
[openssl.git] / crypto / evp / m_wp.c
1 /* crypto/evp/m_wp.c */
2
3 #include <stdio.h>
4 #include "internal/cryptlib.h"
5
6 #ifndef OPENSSL_NO_WHIRLPOOL
7
8 # include <openssl/evp.h>
9 # include <openssl/objects.h>
10 # include <openssl/x509.h>
11 # include <openssl/whrlpool.h>
12
13 static int init(EVP_MD_CTX *ctx)
14 {
15     return WHIRLPOOL_Init(EVP_MD_CTX_md_data(ctx));
16 }
17
18 static int update(EVP_MD_CTX *ctx, const void *data, size_t count)
19 {
20     return WHIRLPOOL_Update(EVP_MD_CTX_md_data(ctx), data, count);
21 }
22
23 static int final(EVP_MD_CTX *ctx, unsigned char *md)
24 {
25     return WHIRLPOOL_Final(md, EVP_MD_CTX_md_data(ctx));
26 }
27
28 static const EVP_MD whirlpool_md = {
29     NID_whirlpool,
30     0,
31     WHIRLPOOL_DIGEST_LENGTH,
32     0,
33     init,
34     update,
35     final,
36     NULL,
37     NULL,
38     WHIRLPOOL_BBLOCK / 8,
39     sizeof(EVP_MD *) + sizeof(WHIRLPOOL_CTX),
40 };
41
42 const EVP_MD *EVP_whirlpool(void)
43 {
44     return (&whirlpool_md);
45 }
46 #endif