Check that we have enough padding characters.
[openssl.git] / crypto / evp / m_wp.c
1
2 #include <stdio.h>
3 #include "internal/cryptlib.h"
4
5 #ifndef OPENSSL_NO_WHIRLPOOL
6
7 # include <openssl/evp.h>
8 # include <openssl/objects.h>
9 # include <openssl/x509.h>
10 # include <openssl/whrlpool.h>
11 # include "internal/evp_int.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