00001 #ifndef HEADER_CURL_MD5_H 00002 #define HEADER_CURL_MD5_H 00003 /*************************************************************************** 00004 * _ _ ____ _ 00005 * Project ___| | | | _ \| | 00006 * / __| | | | |_) | | 00007 * | (__| |_| | _ <| |___ 00008 * \___|\___/|_| \_\_____| 00009 * 00010 * Copyright (C) 1998 - 2010, Daniel Stenberg, <daniel@haxx.se>, et al. 00011 * 00012 * This software is licensed as described in the file COPYING, which 00013 * you should have received as part of this distribution. The terms 00014 * are also available at https://curl.haxx.se/docs/copyright.html. 00015 * 00016 * You may opt to use, copy, modify, merge, publish, distribute and/or sell 00017 * copies of the Software, and permit persons to whom the Software is 00018 * furnished to do so, under the terms of the COPYING file. 00019 * 00020 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 00021 * KIND, either express or implied. 00022 * 00023 ***************************************************************************/ 00024 00025 #ifndef CURL_DISABLE_CRYPTO_AUTH 00026 #include "curl_hmac.h" 00027 00028 #define MD5_DIGEST_LEN 16 00029 00030 typedef void (* Curl_MD5_init_func)(void *context); 00031 typedef void (* Curl_MD5_update_func)(void *context, 00032 const unsigned char *data, 00033 unsigned int len); 00034 typedef void (* Curl_MD5_final_func)(unsigned char *result, void *context); 00035 00036 typedef struct { 00037 Curl_MD5_init_func md5_init_func; /* Initialize context procedure */ 00038 Curl_MD5_update_func md5_update_func; /* Update context with data */ 00039 Curl_MD5_final_func md5_final_func; /* Get final result procedure */ 00040 unsigned int md5_ctxtsize; /* Context structure size */ 00041 unsigned int md5_resultlen; /* Result length (bytes) */ 00042 } MD5_params; 00043 00044 typedef struct { 00045 const MD5_params *md5_hash; /* Hash function definition */ 00046 void *md5_hashctx; /* Hash function context */ 00047 } MD5_context; 00048 00049 extern const MD5_params Curl_DIGEST_MD5[1]; 00050 extern const HMAC_params Curl_HMAC_MD5[1]; 00051 00052 void Curl_md5it(unsigned char *output, 00053 const unsigned char *input); 00054 00055 MD5_context * Curl_MD5_init(const MD5_params *md5params); 00056 int Curl_MD5_update(MD5_context *context, 00057 const unsigned char *data, 00058 unsigned int len); 00059 int Curl_MD5_final(MD5_context *context, unsigned char *result); 00060 00061 #endif 00062 00063 #endif /* HEADER_CURL_MD5_H */