00001 #ifndef HEADER_CURL_HMAC_H 00002 #define HEADER_CURL_HMAC_H 00003 /*************************************************************************** 00004 * _ _ ____ _ 00005 * Project ___| | | | _ \| | 00006 * / __| | | | |_) | | 00007 * | (__| |_| | _ <| |___ 00008 * \___|\___/|_| \_\_____| 00009 * 00010 * Copyright (C) 1998 - 2016, 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 00027 typedef void (* HMAC_hinit_func)(void *context); 00028 typedef void (* HMAC_hupdate_func)(void *context, 00029 const unsigned char *data, 00030 unsigned int len); 00031 typedef void (* HMAC_hfinal_func)(unsigned char *result, void *context); 00032 00033 00034 /* Per-hash function HMAC parameters. */ 00035 00036 typedef struct { 00037 HMAC_hinit_func hmac_hinit; /* Initialize context procedure. */ 00038 HMAC_hupdate_func hmac_hupdate; /* Update context with data. */ 00039 HMAC_hfinal_func hmac_hfinal; /* Get final result procedure. */ 00040 unsigned int hmac_ctxtsize; /* Context structure size. */ 00041 unsigned int hmac_maxkeylen; /* Maximum key length (bytes). */ 00042 unsigned int hmac_resultlen; /* Result length (bytes). */ 00043 } HMAC_params; 00044 00045 00046 /* HMAC computation context. */ 00047 00048 typedef struct { 00049 const HMAC_params *hmac_hash; /* Hash function definition. */ 00050 void *hmac_hashctxt1; /* Hash function context 1. */ 00051 void *hmac_hashctxt2; /* Hash function context 2. */ 00052 } HMAC_context; 00053 00054 00055 /* Prototypes. */ 00056 00057 HMAC_context * Curl_HMAC_init(const HMAC_params *hashparams, 00058 const unsigned char *key, 00059 unsigned int keylen); 00060 int Curl_HMAC_update(HMAC_context *context, 00061 const unsigned char *data, 00062 unsigned int len); 00063 int Curl_HMAC_final(HMAC_context *context, unsigned char *result); 00064 00065 #endif 00066 00067 #endif /* HEADER_CURL_HMAC_H */