]> git.ipfire.org Git - thirdparty/openssl.git/blame - crypto/evp/m_md2.c
Copyright consolidation 05/10
[thirdparty/openssl.git] / crypto / evp / m_md2.c
CommitLineData
aa6bb135
RS
1/*
2 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
d02b48c6 3 *
aa6bb135
RS
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
d02b48c6
RE
8 */
9
10#include <stdio.h>
b39fc560 11#include "internal/cryptlib.h"
641e6ef2
RL
12
13#ifndef OPENSSL_NO_MD2
14
0f113f3e
MC
15# include <openssl/evp.h>
16# include <openssl/objects.h>
17# include <openssl/x509.h>
18# include <openssl/md2.h>
3c27208f 19# include <openssl/rsa.h>
d02b48c6 20
6c3b5664
BL
21#include "internal/evp_int.h"
22
26188931 23static int init(EVP_MD_CTX *ctx)
0f113f3e 24{
6c3b5664 25 return MD2_Init(EVP_MD_CTX_md_data(ctx));
0f113f3e 26}
26188931 27
0f113f3e
MC
28static int update(EVP_MD_CTX *ctx, const void *data, size_t count)
29{
6c3b5664 30 return MD2_Update(EVP_MD_CTX_md_data(ctx), data, count);
0f113f3e 31}
26188931 32
0f113f3e
MC
33static int final(EVP_MD_CTX *ctx, unsigned char *md)
34{
6c3b5664 35 return MD2_Final(md, EVP_MD_CTX_md_data(ctx));
0f113f3e 36}
26188931 37
0f113f3e
MC
38static const EVP_MD md2_md = {
39 NID_md2,
40 NID_md2WithRSAEncryption,
41 MD2_DIGEST_LENGTH,
42 0,
43 init,
44 update,
45 final,
46 NULL,
47 NULL,
0f113f3e
MC
48 MD2_BLOCK,
49 sizeof(EVP_MD *) + sizeof(MD2_CTX),
50};
d02b48c6 51
13588350 52const EVP_MD *EVP_md2(void)
0f113f3e 53{
6c3b5664 54 return &md2_md;
0f113f3e 55}
d02f751c 56#endif