]>
Commit | Line | Data |
---|---|---|
8b9afce5 AP |
1 | /* crypto/evp/m_wp.c */ |
2 | ||
3 | #include <stdio.h> | |
b39fc560 | 4 | #include "internal/cryptlib.h" |
8b9afce5 AP |
5 | |
6 | #ifndef OPENSSL_NO_WHIRLPOOL | |
7 | ||
0f113f3e MC |
8 | # include <openssl/evp.h> |
9 | # include <openssl/objects.h> | |
10 | # include <openssl/x509.h> | |
11 | # include <openssl/whrlpool.h> | |
8b9afce5 AP |
12 | |
13 | static int init(EVP_MD_CTX *ctx) | |
0f113f3e | 14 | { |
6e59a892 | 15 | return WHIRLPOOL_Init(EVP_MD_CTX_md_data(ctx)); |
0f113f3e MC |
16 | } |
17 | ||
18 | static int update(EVP_MD_CTX *ctx, const void *data, size_t count) | |
19 | { | |
6e59a892 | 20 | return WHIRLPOOL_Update(EVP_MD_CTX_md_data(ctx), data, count); |
0f113f3e MC |
21 | } |
22 | ||
23 | static int final(EVP_MD_CTX *ctx, unsigned char *md) | |
24 | { | |
6e59a892 | 25 | return WHIRLPOOL_Final(md, EVP_MD_CTX_md_data(ctx)); |
0f113f3e MC |
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, | |
0f113f3e MC |
38 | WHIRLPOOL_BBLOCK / 8, |
39 | sizeof(EVP_MD *) + sizeof(WHIRLPOOL_CTX), | |
40 | }; | |
8b9afce5 AP |
41 | |
42 | const EVP_MD *EVP_whirlpool(void) | |
0f113f3e MC |
43 | { |
44 | return (&whirlpool_md); | |
45 | } | |
8b9afce5 | 46 | #endif |