GNU libmicrohttpd  1.0.1
mhd_md5_wrap.h
Go to the documentation of this file.
1 /*
2  This file is part of GNU libmicrohttpd
3  Copyright (C) 2022 Evgeny Grin (Karlson2k)
4 
5  GNU libmicrohttpd is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with GNU libmicrohttpd.
17  If not, see <http://www.gnu.org/licenses/>.
18 */
19 
26 #ifndef MHD_MD5_WRAP_H
27 #define MHD_MD5_WRAP_H 1
28 
29 #include "mhd_options.h"
30 #ifndef MHD_MD5_SUPPORT
31 #error This file must be used only when MD5 is enabled
32 #endif
33 #ifndef MHD_MD5_TLSLIB
34 #include "md5.h"
35 #else /* MHD_MD5_TLSLIB */
36 #include "md5_ext.h"
37 #endif /* MHD_MD5_TLSLIB */
38 
39 #ifndef MD5_DIGEST_SIZE
44 #define MD5_DIGEST_SIZE (16)
45 #endif /* ! MD5_DIGEST_SIZE */
46 
47 #ifndef MD5_DIGEST_STRING_SIZE
51 #define MD5_DIGEST_STRING_SIZE ((MD5_DIGEST_SIZE) * 2 + 1)
52 #endif /* ! MD5_DIGEST_STRING_SIZE */
53 
54 #ifndef MHD_MD5_TLSLIB
58 #define Md5CtxWr Md5Ctx
59 #else /* MHD_MD5_TLSLIB */
63 #define Md5CtxWr Md5CtxExt
64 #endif /* MHD_MD5_TLSLIB */
65 
66 #ifndef MHD_MD5_HAS_INIT_ONE_TIME
70 #define MHD_MD5_init_one_time(ctx) MHD_MD5_init(ctx)
71 #endif /* ! MHD_MD5_HAS_INIT_ONE_TIME */
72 
73 #ifndef MHD_MD5_HAS_FINISH_RESET
77 #define MHD_MD5_reset(ctx) MHD_MD5_init(ctx)
81 #define MHD_MD5_finish_reset(ctx,digest) MHD_MD5_finish(ctx,digest), \
82  MHD_MD5_reset(ctx)
83 
84 #else /* MHD_MD5_HAS_FINISH_RESET */
85 #define MHD_MD5_reset(ctx) (void)0
86 #endif /* MHD_MD5_HAS_FINISH_RESET */
87 
88 #ifndef MHD_MD5_HAS_DEINIT
89 #define MHD_MD5_deinit(ignore) (void)0
90 #endif /* HAVE_MD5_DEINIT */
91 
92 /* Sanity checks */
93 
94 #if ! defined(MHD_MD5_HAS_FINISH_RESET) && ! defined(MHD_MD5_HAS_FINISH)
95 #error Required at least one of MHD_MD5_finish_reset(), MHD_MD5_finish_reset()
96 #endif /* ! MHD_MD5_HAS_FINISH_RESET && ! MHD_MD5_HAS_FINISH */
97 
98 #endif /* MHD_MD5_WRAP_H */
Calculation of MD5 digest.
Wrapper declarations for MD5 calculation performed by TLS library.
additional automatic macros for MHD_config.h