/src/libressl/crypto/evp/m_wp.c
Line  | Count  | Source (jump to first uncovered line)  | 
1  |  | /* $OpenBSD: m_wp.c,v 1.10 2022/01/14 08:38:06 tb Exp $ */  | 
2  |  |  | 
3  |  | #include <stdio.h>  | 
4  |  |  | 
5  |  | #include <openssl/opensslconf.h>  | 
6  |  |  | 
7  |  | #ifndef OPENSSL_NO_WHIRLPOOL  | 
8  |  |  | 
9  |  | #include <openssl/evp.h>  | 
10  |  | #include <openssl/objects.h>  | 
11  |  | #include <openssl/x509.h>  | 
12  |  | #include <openssl/whrlpool.h>  | 
13  |  |  | 
14  |  | #include "evp_locl.h"  | 
15  |  |  | 
16  |  | static int  | 
17  |  | init(EVP_MD_CTX *ctx)  | 
18  | 0  | { | 
19  | 0  |   return WHIRLPOOL_Init(ctx->md_data);  | 
20  | 0  | }  | 
21  |  |  | 
22  |  | static int  | 
23  |  | update(EVP_MD_CTX *ctx, const void *data, size_t count)  | 
24  | 0  | { | 
25  | 0  |   return WHIRLPOOL_Update(ctx->md_data, data, count);  | 
26  | 0  | }  | 
27  |  |  | 
28  |  | static int  | 
29  |  | final(EVP_MD_CTX *ctx, unsigned char *md)  | 
30  | 0  | { | 
31  | 0  |   return WHIRLPOOL_Final(md, ctx->md_data);  | 
32  | 0  | }  | 
33  |  |  | 
34  |  | static const EVP_MD whirlpool_md = { | 
35  |  |   .type = NID_whirlpool,  | 
36  |  |   .pkey_type = 0,  | 
37  |  |   .md_size = WHIRLPOOL_DIGEST_LENGTH,  | 
38  |  |   .flags = 0,  | 
39  |  |   .init = init,  | 
40  |  |   .update = update,  | 
41  |  |   .final = final,  | 
42  |  |   .copy = NULL,  | 
43  |  |   .cleanup = NULL,  | 
44  |  |   .block_size = WHIRLPOOL_BBLOCK / 8,  | 
45  |  |   .ctx_size = sizeof(EVP_MD *) + sizeof(WHIRLPOOL_CTX),  | 
46  |  | };  | 
47  |  |  | 
48  |  | const EVP_MD *  | 
49  |  | EVP_whirlpool(void)  | 
50  | 2  | { | 
51  | 2  |   return (&whirlpool_md);  | 
52  | 2  | }  | 
53  |  | #endif  |