]> git.ipfire.org Git - thirdparty/squid.git/blame - include/rfc2617.h
Source Format Enforcement (#532)
[thirdparty/squid.git] / include / rfc2617.h
CommitLineData
5c193dec 1/*
77b1029d 2 * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
5c193dec
AJ
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
2d70df72 9/* The source in this file is derived from the reference implementation
10 * in RFC 2617.
11 * RFC 2617 is Copyright (C) The Internet Society (1999). All Rights Reserved.
12 *
13 * The following copyright and licence statement covers all changes made to the
14 * reference implementation.
15 *
c5dd4956 16 * Key changes to the reference implementation were:
2d70df72 17 * alteration to a plain C layout.
18 * Create CvtBin function
19 * Allow CalcHA1 to make use of precaculated username:password:realm hash's
20 * to prevent squid knowing the users password (idea suggested in RFC 2617).
21 */
22
b5638623 23#ifndef SQUID_RFC2617_H
24#define SQUID_RFC2617_H
2d70df72 25
25f98340
AJ
26#ifdef __cplusplus
27extern "C" {
28#endif
29
2d70df72 30#define HASHLEN 16
f53969cc 31typedef char HASH[HASHLEN];
2d70df72 32#define HASHHEXLEN 32
f53969cc 33typedef char HASHHEX[HASHHEXLEN + 1];
2d70df72 34
f53969cc
SM
35/* calculate H(A1) as per HTTP Digest spec */
36extern void DigestCalcHA1(
37 const char *pszAlg,
38 const char *pszUserName,
39 const char *pszRealm,
40 const char *pszPassword,
41 const char *pszNonce,
42 const char *pszCNonce,
43 HASH HA1,
44 HASHHEX SessionKey
45);
2d70df72 46
f53969cc
SM
47/* calculate request-digest/response-digest as per HTTP Digest spec */
48extern void DigestCalcResponse(
49 const HASHHEX HA1, /* H(A1) */
50 const char *pszNonce, /* nonce from server */
51 const char *pszNonceCount, /* 8 hex digits */
52 const char *pszCNonce, /* client nonce */
53 const char *pszQop, /* qop-value: "", "auth", "auth-int" */
54 const char *pszMethod, /* method from the request */
55 const char *pszDigestUri, /* requested URL */
56 const HASHHEX HEntity, /* H(entity body) if qop="auth-int" */
57 HASHHEX Response /* request-digest or response-digest */
58);
2d70df72 59
f53969cc 60extern void CvtHex(const HASH Bin, HASHHEX Hex);
2d70df72 61
f53969cc 62extern void CvtBin(const HASHHEX Hex, HASH Bin);
2d70df72 63
25f98340
AJ
64#ifdef __cplusplus
65}
66#endif
b5638623 67#endif /* SQUID_RFC2617_H */
f53969cc 68