OpenVPN
httpdigest.h
Go to the documentation of this file.
1/*
2 * OpenVPN -- An application to securely tunnel IP networks
3 * over a single TCP/UDP port, with support for SSL/TLS-based
4 * session authentication and key exchange,
5 * packet encryption, packet authentication, and
6 * packet compression.
7 *
8 * Copyright (C) 2002-2025 OpenVPN Inc <sales@openvpn.net>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2
12 * as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, see <https://www.gnu.org/licenses/>.
21 */
22
23#if PROXY_DIGEST_AUTH
24
25#define HASHLEN 16
26typedef unsigned char HASH[HASHLEN];
27#define HASHHEXLEN 32
28typedef unsigned char HASHHEX[HASHHEXLEN + 1];
29#undef IN
30#undef OUT
31#define IN const
32#define OUT
33
34/* calculate H(A1) as per HTTP Digest spec */
35void DigestCalcHA1(IN char *pszAlg, IN char *pszUserName, IN char *pszRealm, IN char *pszPassword,
36 IN char *pszNonce, IN char *pszCNonce, OUT HASHHEX SessionKey);
37
38/* calculate request-digest/response-digest as per HTTP Digest spec */
39void DigestCalcResponse(IN HASHHEX HA1, /* H(A1) */
40 IN char *pszNonce, /* nonce from server */
41 IN char *pszNonceCount, /* 8 hex digits */
42 IN char *pszCNonce, /* client nonce */
43 IN char *pszQop, /* qop-value: "", "auth", "auth-int" */
44 IN char *pszMethod, /* method from the request */
45 IN char *pszDigestUri, /* requested URL */
46 IN HASHHEX HEntity, /* H(entity body) if qop="auth-int" */
47 OUT HASHHEX Response /* request-digest or response-digest */
48);
49
50#endif /* if PROXY_DIGEST_AUTH */
void DigestCalcHA1(IN char *pszAlg, IN char *pszUserName, IN char *pszRealm, IN char *pszPassword, IN char *pszNonce, IN char *pszCNonce, OUT HASHHEX SessionKey)
Definition httpdigest.c:66
void DigestCalcResponse(IN HASHHEX HA1, IN char *pszNonce, IN char *pszNonceCount, IN char *pszCNonce, IN char *pszQop, IN char *pszMethod, IN char *pszDigestUri, IN HASHHEX HEntity, OUT HASHHEX Response)
Definition httpdigest.c:96