blob: bbbd1ca2f4d2a2cdc400cf3bcc81b37026ebb3c6 [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001/* md5.h
2 *
3 * Copyright (C) 2006-2021 wolfSSL Inc.
4 *
5 * This file is part of wolfSSL.
6 *
7 * wolfSSL is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * wolfSSL is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
20 */
21
22/* md5.h for openssl */
23
24
25#ifndef WOLFSSL_MD5_H_
26#define WOLFSSL_MD5_H_
27
28#include <wolfssl/wolfcrypt/settings.h>
29
30#ifndef NO_MD5
31
32#include <wolfssl/wolfcrypt/hash.h>
33
34#ifdef WOLFSSL_PREFIX
35#include "prefix_md5.h"
36#endif
37
38#ifdef __cplusplus
39 extern "C" {
40#endif
41
42
43typedef struct WOLFSSL_MD5_CTX {
44 /* big enough to hold wolfcrypt md5, but check on init */
45#ifdef STM32_HASH
46 void* holder[(112 + WC_ASYNC_DEV_SIZE + sizeof(STM32_HASH_Context)) / sizeof(void*)];
47#else
48 void* holder[(112 + WC_ASYNC_DEV_SIZE) / sizeof(void*)];
49#endif
50} WOLFSSL_MD5_CTX;
51
52WOLFSSL_API int wolfSSL_MD5_Init(WOLFSSL_MD5_CTX*);
53WOLFSSL_API int wolfSSL_MD5_Update(WOLFSSL_MD5_CTX*, const void*, unsigned long);
54WOLFSSL_API int wolfSSL_MD5_Final(unsigned char*, WOLFSSL_MD5_CTX*);
55WOLFSSL_API int wolfSSL_MD5_Transform(WOLFSSL_MD5_CTX*, const unsigned char*);
56
57typedef WOLFSSL_MD5_CTX MD5_CTX;
58
59#define MD5_Init wolfSSL_MD5_Init
60#define MD5_Update wolfSSL_MD5_Update
61#define MD5_Final wolfSSL_MD5_Final
62#define MD5_Transform wolfSSL_MD5_Transform
63
64#ifdef OPENSSL_EXTRA_BSD
65 #define MD5Init wolfSSL_MD5_Init
66 #define MD5Update wolfSSL_MD5_Update
67 #define MD5Final wolfSSL_MD5_Final
68#endif
69
70#ifndef MD5
71#define MD5(d, n, md) wc_Md5Hash((d), (n), (md))
72#endif
73
74#define MD5_DIGEST_LENGTH MD5_DIGEST_SIZE
75
76#ifdef __cplusplus
77 } /* extern "C" */
78#endif
79
80#endif /* NO_MD5 */
81
82#endif /* WOLFSSL_MD5_H_ */