diff --git a/src/microhttpd/md5_ext_openssl.c b/src/microhttpd/md5_ext_openssl.c index 13298f3d..53f68ccb 100644 --- a/src/microhttpd/md5_ext_openssl.c +++ b/src/microhttpd/md5_ext_openssl.c @@ -25,22 +25,22 @@ */ #include -#include "md5_ext.h" +#include "md5_ext_openssl.h" #include "mhd_assert.h" void -MHD_MD5 (struct Md5CtxExt *ctx, +MHD_MD5 (struct Md5CtxExt_OpenSSL *c, const unsigned char *d, size_t n) { unsigned char *md; if (NULL == MD5 (d, n, md)) { - ctx->ext_error = 1; + c->ext_error = 1; } else { - ctx->ext_error = 0; - memcpy (ctx->handle, md, sizeof(ctx->H)); + c->ext_error = 0; + memcpy (c->hash, md, sizeof(ctx->H)); } } diff --git a/src/microhttpd/md5_ext_openssl.h b/src/microhttpd/md5_ext_openssl.h new file mode 100644 index 00000000..db77196d --- /dev/null +++ b/src/microhttpd/md5_ext_openssl.h @@ -0,0 +1,57 @@ +/* + This file is part of GNU libmicrohttpd + Copyright (C) 2022 Evgeny Grin (Karlson2k) + + GNU libmicrohttpd is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with GNU libmicrohttpd. + If not, see . +*/ + +/** + * @file microhttpd/md5_ext.h + * @brief Wrapper declarations for MD5 calculation performed by TLS library + * @author Édouard LEFIZELIER + */ + +#ifndef MHD_MD5_EXT_OPENSSL_H +#define MHD_MD5_EXT_OPENSSL_H 1 + + +/* +MD5 calcul return +*/ + +struct Md5CtxExt_OpenSSL +{ + unsigned char *hash; /** Data's hash calculated */ + int ext_error; /** Non-zero if external error occurs during init or hashing */ +}; + + +/** + * Indicates that MHD_MD5() function is present. + */ +#define MHD_MD5 1 + + +/** + * Calculate MD5 hash of the data. + * + * @param c the informations about the hash return + * @param d the data to hash + * @param n the length of the data + */ +void +MHD_MD5 (struct Md5CtxExt_OpenSSL *c, + const unsigned char *d, + size_t n) \ No newline at end of file