VirtualBox

source: vbox/trunk/src/libs/curl-7.87.0/lib/curl_hmac.h@ 98929

Last change on this file since 98929 was 98326, checked in by vboxsync, 2 years ago

curl-7.87.0: Applied and adjusted our curl changes to 7.83.1. bugref:10356

  • Property svn:eol-style set to native
File size: 2.9 KB
Line 
1#ifndef HEADER_CURL_HMAC_H
2#define HEADER_CURL_HMAC_H
3/***************************************************************************
4 * _ _ ____ _
5 * Project ___| | | | _ \| |
6 * / __| | | | |_) | |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
9 *
10 * Copyright (C) 1998 - 2022, Daniel Stenberg, <[email protected]>, et al.
11 *
12 * This software is licensed as described in the file COPYING, which
13 * you should have received as part of this distribution. The terms
14 * are also available at https://curl.se/docs/copyright.html.
15 *
16 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 * copies of the Software, and permit persons to whom the Software is
18 * furnished to do so, under the terms of the COPYING file.
19 *
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
22 *
23 * SPDX-License-Identifier: curl
24 *
25 ***************************************************************************/
26
27#ifndef CURL_DISABLE_CRYPTO_AUTH
28
29#include <curl/curl.h>
30
31#define HMAC_MD5_LENGTH 16
32
33typedef CURLcode (* HMAC_hinit_func)(void *context);
34typedef void (* HMAC_hupdate_func)(void *context,
35 const unsigned char *data,
36 unsigned int len);
37typedef void (* HMAC_hfinal_func)(unsigned char *result, void *context);
38
39
40/* Per-hash function HMAC parameters. */
41struct HMAC_params {
42 HMAC_hinit_func
43 hmac_hinit; /* Initialize context procedure. */
44 HMAC_hupdate_func hmac_hupdate; /* Update context with data. */
45 HMAC_hfinal_func hmac_hfinal; /* Get final result procedure. */
46 unsigned int hmac_ctxtsize; /* Context structure size. */
47 unsigned int hmac_maxkeylen; /* Maximum key length (bytes). */
48 unsigned int hmac_resultlen; /* Result length (bytes). */
49};
50
51
52/* HMAC computation context. */
53struct HMAC_context {
54 const struct HMAC_params *hmac_hash; /* Hash function definition. */
55 void *hmac_hashctxt1; /* Hash function context 1. */
56 void *hmac_hashctxt2; /* Hash function context 2. */
57};
58
59
60/* Prototypes. */
61struct HMAC_context *Curl_HMAC_init(const struct HMAC_params *hashparams,
62 const unsigned char *key,
63 unsigned int keylen);
64int Curl_HMAC_update(struct HMAC_context *context,
65 const unsigned char *data,
66 unsigned int len);
67int Curl_HMAC_final(struct HMAC_context *context, unsigned char *result);
68
69CURLcode Curl_hmacit(const struct HMAC_params *hashparams,
70 const unsigned char *key, const size_t keylen,
71 const unsigned char *data, const size_t datalen,
72 unsigned char *output);
73
74#endif
75
76#endif /* HEADER_CURL_HMAC_H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette