This file is indexed.

/usr/include/sofia-sip-1.12/sofia-sip/auth_digest.h is in libsofia-sip-ua-dev 1.12.11+20110422-1build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
/*
 * This file is part of the Sofia-SIP package
 *
 * Copyright (C) 2005 Nokia Corporation.
 *
 * Contact: Pekka Pessi <pekka.pessi@nokia.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public License
 * as published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 *
 */

#ifndef AUTH_DIGEST_H
/** Defined when <sofia-sip/auth_digest.h> has been included. */
#define AUTH_DIGEST_H

/**@file sofia-sip/auth_digest.h
 * Datatypes and functions for Digest authentication.
 *
 * The structures and functions here follow the RFC 2617.
 *
 * @sa @RFC2617,
 * <i>"HTTP Authentication: Basic and Digest Access Authentication"</i>,
 * J. Franks et al,
 * June 1999.
 *
 * @sa @RFC3261 section 22
 *
 * @author Pekka Pessi <Pekka.Pessi@nokia.com>
 *
 * @date Created: Thu Feb 22 12:25:55 2001 ppessi
 */

#ifndef SU_ALLOC_H
#include <sofia-sip/su_alloc.h>
#endif

SOFIA_BEGIN_DECLS

/** Parameters for digest-challenge.
 *
 * The digest-challenge is sent by server or proxy to client. It can be
 * included in, e.g, WWW-Authenticate or Proxy-Authenticate headers.
 *
 * @code
 *   challenge        =  "Digest" digest-challenge
 *   digest-challenge  = 1#( realm | [domain] | nonce |
 *                           [opaque] | [stale] | [algorithm] |
 *                           [qop-options] | [auth-param] )
 *   domain            = "domain" "=" <"> URI ( 1*SP URI ) <">
 *   URI               = absoluteURI | abs_path
 *   nonce             = "nonce" "=" nonce-value
 *   nonce-value       = quoted-string
 *   opaque            = "opaque" "=" quoted-string
 *   stale             = "stale" "=" ( "true" | "false" )
 *   algorithm         = "algorithm" "=" ( "MD5" | "MD5-sess" | token )
 *   qop-options       = "qop" "=" <"> 1#qop-value <">
 *   qop-value         = "auth" | "auth-int" | token
 * @endcode
 *
 * @sa @RFC2617
 */
typedef struct {
  int         ac_size;
  char const *ac_realm;		/**< realm */
  char const *ac_domain;	/**< domain */
  char const *ac_nonce;		/**< nonce */
  char const *ac_opaque;	/**< opaque */
  char const *ac_algorithm;	/**< algorithm */
  char const *ac_qop;		/**< qop */
  unsigned    ac_stale : 1;	/**< stale=true */
  unsigned    ac_md5 : 1;	/**< algorithm=MS5 (or missing) */
  unsigned    ac_md5sess : 1;	/**< algorithm=MD5-sess */
  unsigned    ac_sha1 : 1;	/**< algorithm=sha1 (SSA Hash) */
  unsigned    ac_auth : 1;	/**< qop=auth */
  unsigned    ac_auth_int : 1;	/**< qop=auth-int */
  unsigned : 0;
} auth_challenge_t;

/** Digest parameters for digest-response in Authorize.
 *
 * The digest-response is sent by the client to a server or a proxy. It can
 * be included in, e.g., Authorization or Proxy-Authorization headers.
 *
 * @code
 *   credentials      = "Digest" digest-response
 *   digest-response  = 1#( username | realm | nonce | digest-uri |
 *                          response | [ algorithm ] | [cnonce] | [opaque] |
 *                          [message-qop] | [nonce-count] | [auth-param] )
 *   username         = "username" "=" username-value
 *   username-value   = quoted-string
 *   digest-uri       = "uri" "=" digest-uri-value
 *   digest-uri-value = request-uri   ; As specified by HTTP/1.1
 *   message-qop      = "qop" "=" qop-value
 *   cnonce           = "cnonce" "=" cnonce-value
 *   cnonce-value     = nonce-value
 *   nonce-count      = "nc" "=" nc-value
 *   nc-value         = 8LHEX
 *   response         = "response" "=" request-digest
 *   request-digest   = <"> 32LHEX <">
 *   LHEX             =  "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" |
 *                       "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f"
 * @endcode
 */
typedef struct {
  int         ar_size;
  char const *ar_username;
  char const *ar_realm;		/**< realm */
  char const *ar_nonce;		/**< nonce */
  char const *ar_uri;		/**< uri */
  char const *ar_response;	/**< response */
  char const *ar_algorithm;	/**< algorithm */
  char const *ar_cnonce;	/**< cnonce */
  char const *ar_opaque;	/**< opaque */
  char const *ar_qop;		/**< qop */
  char const *ar_nc;		/**< nonce count */
  unsigned    ar_md5 : 1;	/**< MS5 algorithm */
  unsigned    ar_md5sess : 1;	/**< MD5-sess algorithm */
  unsigned    ar_sha1 : 1;	/**< SHA1 algorithm */
  unsigned    ar_auth : 1;	/**< qop=auth */
  unsigned    ar_auth_int : 1;	/**< qop=auth-int */
  unsigned : 0;
} auth_response_t;

typedef char auth_hexmd5_t[33];

SOFIAPUBFUN issize_t auth_digest_challenge_get(su_home_t *, auth_challenge_t *,
					       char const * const params[]);
SOFIAPUBFUN void auth_digest_challenge_free_params(su_home_t *home,
						   auth_challenge_t *ac);
SOFIAPUBFUN issize_t auth_digest_response_get(su_home_t *, auth_response_t *,
					      char const * const params[]);

SOFIAPUBFUN int auth_digest_ha1(auth_hexmd5_t ha1,
				char const *username,
				char const *realm,
				char const *secret);

SOFIAPUBFUN int auth_digest_a1(auth_response_t *ar,
			       auth_hexmd5_t ha1,
			       char const *secret);

SOFIAPUBFUN int auth_digest_a1sess(auth_response_t *ar,
				   auth_hexmd5_t ha1sess,
				   char const *ha1);

SOFIAPUBFUN int auth_digest_sessionkey(auth_response_t *, auth_hexmd5_t ha1,
				       char const *secret);

SOFIAPUBFUN int auth_digest_response(auth_response_t *, auth_hexmd5_t response,
				     auth_hexmd5_t const ha1,
				     char const *method_name,
				     void const *data, isize_t dlen);

SOFIAPUBFUN int auth_struct_copy(void *dst, void const *src, isize_t s_size);

SOFIAPUBFUN int auth_strcmp(char const *quoted, char const *unquoted);

SOFIA_END_DECLS

#endif