md5.h
1 /* md5.h
2  *
3  * Copyright (C) 2006-2020 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 
43 typedef 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 
52 WOLFSSL_API int wolfSSL_MD5_Init(WOLFSSL_MD5_CTX*);
53 WOLFSSL_API int wolfSSL_MD5_Update(WOLFSSL_MD5_CTX*, const void*, unsigned long);
54 WOLFSSL_API int wolfSSL_MD5_Final(unsigned char*, WOLFSSL_MD5_CTX*);
55 
56 
57 typedef 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 
63 #ifdef OPENSSL_EXTRA_BSD
64  #define MD5Init wolfSSL_MD5_Init
65  #define MD5Update wolfSSL_MD5_Update
66  #define MD5Final wolfSSL_MD5_Final
67 #endif
68 
69 #ifndef MD5
70 #define MD5(d, n, md) wc_Md5Hash((d), (n), (md))
71 #endif
72 
73 #define MD5_DIGEST_LENGTH MD5_DIGEST_SIZE
74 
75 #ifdef __cplusplus
76  } /* extern "C" */
77 #endif
78 
79 #endif /* NO_MD5 */
80 
81 #endif /* WOLFSSL_MD5_H_ */
Definition: stm32.h:67