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-2026 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#define HASHLEN 16
24typedef unsigned char HASH[HASHLEN];
25#define HASHHEXLEN 32
26typedef unsigned char HASHHEX[HASHHEXLEN + 1];
27
28/* calculate H(A1) as per HTTP Digest spec */
29void DigestCalcHA1(const char *pszAlg, const char *pszUserName, const char *pszRealm, const char *pszPassword,
30 const char *pszNonce, const char *pszCNonce, HASHHEX SessionKey);
31
32/* calculate request-digest/response-digest as per HTTP Digest spec */
33void DigestCalcResponse(const HASHHEX HA1, /* H(A1) */
34 const char *pszNonce, /* nonce from server */
35 const char *pszNonceCount, /* 8 hex digits */
36 const char *pszCNonce, /* client nonce */
37 const char *pszQop, /* qop-value: "", "auth", "auth-int" */
38 const char *pszMethod, /* method from the request */
39 const char *pszDigestUri, /* requested URL */
40 const HASHHEX HEntity, /* H(entity body) if qop="auth-int" */
41 HASHHEX Response /* request-digest or response-digest */
42);
#define HASHLEN
Definition httpdigest.h:23
#define HASHHEXLEN
Definition httpdigest.h:25
unsigned char HASHHEX[HASHHEXLEN+1]
Definition httpdigest.h:26
unsigned char HASH[HASHLEN]
Definition httpdigest.h:24
void DigestCalcResponse(const HASHHEX HA1, const char *pszNonce, const char *pszNonceCount, const char *pszCNonce, const char *pszQop, const char *pszMethod, const char *pszDigestUri, const HASHHEX HEntity, HASHHEX Response)
Definition httpdigest.c:91
void DigestCalcHA1(const char *pszAlg, const char *pszUserName, const char *pszRealm, const char *pszPassword, const char *pszNonce, const char *pszCNonce, HASHHEX SessionKey)
Definition httpdigest.c:61