1221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom/* crypto/evp/m_wp.c */
2221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom
3221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#include <stdio.h>
4221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#include "cryptlib.h"
5221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom
6221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#ifndef OPENSSL_NO_WHIRLPOOL
7221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom
8221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#include <openssl/evp.h>
9221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#include <openssl/objects.h>
10221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#include <openssl/x509.h>
11221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#include <openssl/whrlpool.h>
12392aa7cc7d2b122614c5393c3e357da07fd07af3Brian Carlstrom#include "evp_locl.h"
13221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom
14221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromstatic int init(EVP_MD_CTX *ctx)
15221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom	{ return WHIRLPOOL_Init(ctx->md_data); }
16221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom
17221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromstatic int update(EVP_MD_CTX *ctx,const void *data,size_t count)
18221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom	{ return WHIRLPOOL_Update(ctx->md_data,data,count); }
19221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom
20221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromstatic int final(EVP_MD_CTX *ctx,unsigned char *md)
21221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom	{ return WHIRLPOOL_Final(md,ctx->md_data); }
22221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom
23221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromstatic const EVP_MD whirlpool_md=
24221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom	{
25221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom	NID_whirlpool,
26221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom	0,
27221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom	WHIRLPOOL_DIGEST_LENGTH,
28221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom	0,
29221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom	init,
30221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom	update,
31221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom	final,
32221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom	NULL,
33221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom	NULL,
34221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom	EVP_PKEY_NULL_method,
35221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom	WHIRLPOOL_BBLOCK/8,
36221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom	sizeof(EVP_MD *)+sizeof(WHIRLPOOL_CTX),
37221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom	};
38221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom
39221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstromconst EVP_MD *EVP_whirlpool(void)
40221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom	{
41221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom	return(&whirlpool_md);
42221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom	}
43221304ee937bc0910948a8be1320cb8cc4eb6d36Brian Carlstrom#endif
44