]>
Commit | Line | Data |
---|---|---|
2d70df72 | 1 | /* The source in this file is derived from the reference implementation |
2 | * in RFC 2617. | |
3 | * RFC 2617 is Copyright (C) The Internet Society (1999). All Rights Reserved. | |
4 | * | |
5 | * The following copyright and licence statement covers all changes made to the | |
6 | * reference implementation. | |
7 | * | |
8 | * Key changes to the reference implementation were: | |
9 | * alteration to a plain C layout. | |
10 | * Create CvtBin function | |
11 | * Allow CalcHA1 to make use of precaculated username:password:realm hash's | |
12 | * to prevent squid knowing the users password (idea suggested in RFC 2617). | |
13 | */ | |
14 | ||
15 | ||
16 | /* | |
528b2c61 | 17 | * $Id: rfc2617.h,v 1.5 2003/01/23 00:36:47 robertc Exp $ |
2d70df72 | 18 | * |
19 | * DEBUG: | |
20 | * AUTHOR: RFC 2617 & Robert Collins | |
21 | * | |
22 | * SQUID Internet Object Cache http://squid.nlanr.net/Squid/ | |
23 | * ---------------------------------------------------------- | |
24 | * | |
25 | * Squid is the result of efforts by numerous individuals from the | |
26 | * Internet community. Development is led by Duane Wessels of the | |
27 | * National Laboratory for Applied Network Research and funded by the | |
28 | * National Science Foundation. Squid is Copyrighted (C) 1998 by | |
29 | * the Regents of the University of California. Please see the | |
30 | * COPYRIGHT file for full details. Squid incorporates software | |
31 | * developed and/or copyrighted by other sources. Please see the | |
32 | * CREDITS file for full details. | |
33 | * | |
34 | * This program is free software; you can redistribute it and/or modify | |
35 | * it under the terms of the GNU General Public License as published by | |
36 | * the Free Software Foundation; either version 2 of the License, or | |
37 | * (at your option) any later version. | |
38 | * | |
39 | * This program is distributed in the hope that it will be useful, | |
40 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
41 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
42 | * GNU General Public License for more details. | |
43 | * | |
44 | * You should have received a copy of the GNU General Public License | |
45 | * along with this program; if not, write to the Free Software | |
46 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. | |
47 | * | |
48 | */ | |
b5638623 | 49 | #ifndef SQUID_RFC2617_H |
50 | #define SQUID_RFC2617_H | |
2d70df72 | 51 | |
e1f7507e AJ |
52 | #include "config.h" |
53 | ||
2d70df72 | 54 | #define HASHLEN 16 |
55 | typedef char HASH[HASHLEN]; | |
56 | #define HASHHEXLEN 32 | |
57 | typedef char HASHHEX[HASHHEXLEN + 1]; | |
58 | ||
59 | /* calculate H(A1) as per HTTP Digest spec */ | |
e6ccf245 | 60 | SQUIDCEXTERN void DigestCalcHA1( |
2d70df72 | 61 | const char *pszAlg, |
62 | const char *pszUserName, | |
63 | const char *pszRealm, | |
64 | const char *pszPassword, | |
65 | const char *pszNonce, | |
66 | const char *pszCNonce, | |
67 | HASH HA1, | |
68 | HASHHEX SessionKey | |
69 | ); | |
70 | ||
71 | /* calculate request-digest/response-digest as per HTTP Digest spec */ | |
e6ccf245 | 72 | SQUIDCEXTERN void DigestCalcResponse( |
2d70df72 | 73 | const HASHHEX HA1, /* H(A1) */ |
74 | const char *pszNonce, /* nonce from server */ | |
75 | const char *pszNonceCount, /* 8 hex digits */ | |
76 | const char *pszCNonce, /* client nonce */ | |
77 | const char *pszQop, /* qop-value: "", "auth", "auth-int" */ | |
78 | const char *pszMethod, /* method from the request */ | |
79 | const char *pszDigestUri, /* requested URL */ | |
80 | const HASHHEX HEntity, /* H(entity body) if qop="auth-int" */ | |
81 | HASHHEX Response /* request-digest or response-digest */ | |
82 | ); | |
83 | ||
e6ccf245 | 84 | SQUIDCEXTERN void CvtHex(const HASH Bin, HASHHEX Hex); |
2d70df72 | 85 | |
e6ccf245 | 86 | SQUIDCEXTERN void CvtBin(const HASHHEX Hex, HASH Bin); |
2d70df72 | 87 | |
b5638623 | 88 | #endif /* SQUID_RFC2617_H */ |