m_wp.c revision 1.4
1/* crypto/evp/m_wp.c */ 2 3#include <stdio.h> 4#include "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#include "evp_locl.h" 13 14static int 15init(EVP_MD_CTX *ctx) 16{ 17 return WHIRLPOOL_Init(ctx->md_data); 18} 19 20static int 21update(EVP_MD_CTX *ctx, const void *data, size_t count) 22{ 23 return WHIRLPOOL_Update(ctx->md_data, data, count); 24} 25 26static int 27final(EVP_MD_CTX *ctx, unsigned char *md) 28{ 29 return WHIRLPOOL_Final(md, ctx->md_data); 30} 31 32static const EVP_MD whirlpool_md = { 33 .type = NID_whirlpool, 34 .pkey_type = 0, 35 .md_size = WHIRLPOOL_DIGEST_LENGTH, 36 .flags = 0, 37 .init = init, 38 .update = update, 39 .final = final, 40 .copy = NULL, 41 .cleanup = NULL, 42 .sign = NULL, 43 .verify = NULL, 44 .required_pkey_type = { 45 0, 0, 0, 0, 46 }, 47 .block_size = WHIRLPOOL_BBLOCK / 8, 48 .ctx_size = sizeof(EVP_MD *) + sizeof(WHIRLPOOL_CTX), 49}; 50 51const EVP_MD * 52EVP_whirlpool(void) 53{ 54 return (&whirlpool_md); 55} 56#endif 57