~ubuntu-branches/ubuntu/quantal/gnutls26/quantal-security

« back to all changes in this revision

Viewing changes to lib/gnutls_auth.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Langasek
  • Date: 2011-05-20 13:07:18 UTC
  • mfrom: (12.1.11 sid)
  • Revision ID: james.westby@ubuntu.com-20110520130718-db41dybbanzfvlji
Tags: 2.10.5-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Fix build failure with --no-add-needed.
  - Build for multiarch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 2001, 2002, 2003, 2004, 2005, 2008, 2009 Free Software Foundation
 
2
 * Copyright (C) 2001, 2002, 2003, 2004, 2005, 2008, 2009, 2010 Free
 
3
 * Software Foundation, Inc.
3
4
 *
4
5
 * Author: Nikos Mavrogiannopoulos
5
6
 *
6
 
 * This file is part of GNUTLS.
 
7
 * This file is part of GnuTLS.
7
8
 *
8
 
 * The GNUTLS library is free software; you can redistribute it and/or
 
9
 * The GnuTLS is free software; you can redistribute it and/or
9
10
 * modify it under the terms of the GNU Lesser General Public License
10
11
 * as published by the Free Software Foundation; either version 2.1 of
11
12
 * the License, or (at your option) any later version.
38
39
 */
39
40
 
40
41
/**
41
 
  * gnutls_credentials_clear - Clears all the credentials previously set
42
 
  * @session: is a #gnutls_session_t structure.
43
 
  *
44
 
  * Clears all the credentials previously set in this session.
45
 
  *
46
 
  **/
 
42
 * gnutls_credentials_clear:
 
43
 * @session: is a #gnutls_session_t structure.
 
44
 *
 
45
 * Clears all the credentials previously set in this session.
 
46
 **/
47
47
void
48
48
gnutls_credentials_clear (gnutls_session_t session)
49
49
{
66
66
 * { algorithm, credentials, pointer to next }
67
67
 */
68
68
/**
69
 
 * gnutls_credentials_set - Sets the needed credentials for the specified authentication algorithm.
 
69
 * gnutls_credentials_set:
70
70
 * @session: is a #gnutls_session_t structure.
71
71
 * @type: is the type of the credentials
72
72
 * @cred: is a pointer to a structure.
155
155
}
156
156
 
157
157
/**
158
 
  * gnutls_auth_get_type - Returns the type of credentials for the current authentication schema.
159
 
  * @session: is a #gnutls_session_t structure.
160
 
  *
161
 
  * Returns type of credentials for the current authentication schema.
162
 
  * The returned information is to be used to distinguish the function used
163
 
  * to access authentication data.
164
 
  *
165
 
  * Eg. for CERTIFICATE ciphersuites (key exchange algorithms:
166
 
  * %GNUTLS_KX_RSA, %GNUTLS_KX_DHE_RSA), the same function are to be
167
 
  * used to access the authentication data.
168
 
  *
169
 
  * Returns: The type of credentials for the current authentication
170
 
  *   schema, a #gnutls_credentials_type_t type.
171
 
  **/
 
158
 * gnutls_auth_get_type:
 
159
 * @session: is a #gnutls_session_t structure.
 
160
 *
 
161
 * Returns type of credentials for the current authentication schema.
 
162
 * The returned information is to be used to distinguish the function used
 
163
 * to access authentication data.
 
164
 *
 
165
 * Eg. for CERTIFICATE ciphersuites (key exchange algorithms:
 
166
 * %GNUTLS_KX_RSA, %GNUTLS_KX_DHE_RSA), the same function are to be
 
167
 * used to access the authentication data.
 
168
 *
 
169
 * Returns: The type of credentials for the current authentication
 
170
 *   schema, a #gnutls_credentials_type_t type.
 
171
 **/
172
172
gnutls_credentials_type_t
173
173
gnutls_auth_get_type (gnutls_session_t session)
174
174
{
179
179
 
180
180
  return
181
181
    _gnutls_map_kx_get_cred (_gnutls_cipher_suite_get_kx_algo
182
 
                             (&session->security_parameters.
183
 
                              current_cipher_suite), server);
 
182
                             (&session->
 
183
                              security_parameters.current_cipher_suite),
 
184
                             server);
184
185
}
185
186
 
186
187
/**
187
 
  * gnutls_auth_server_get_type - Returns the type of credentials for the server authentication schema.
188
 
  * @session: is a #gnutls_session_t structure.
189
 
  *
190
 
  * Returns the type of credentials that were used for server authentication.
191
 
  * The returned information is to be used to distinguish the function used
192
 
  * to access authentication data.
193
 
  *
194
 
  * Returns: The type of credentials for the server authentication
195
 
  *   schema, a #gnutls_credentials_type_t type.
196
 
  **/
 
188
 * gnutls_auth_server_get_type:
 
189
 * @session: is a #gnutls_session_t structure.
 
190
 *
 
191
 * Returns the type of credentials that were used for server authentication.
 
192
 * The returned information is to be used to distinguish the function used
 
193
 * to access authentication data.
 
194
 *
 
195
 * Returns: The type of credentials for the server authentication
 
196
 *   schema, a #gnutls_credentials_type_t type.
 
197
 **/
197
198
gnutls_credentials_type_t
198
199
gnutls_auth_server_get_type (gnutls_session_t session)
199
200
{
200
201
  return
201
202
    _gnutls_map_kx_get_cred (_gnutls_cipher_suite_get_kx_algo
202
 
                             (&session->security_parameters.
203
 
                              current_cipher_suite), 1);
 
203
                             (&session->
 
204
                              security_parameters.current_cipher_suite), 1);
204
205
}
205
206
 
206
207
/**
207
 
  * gnutls_auth_client_get_type - Returns the type of credentials for the client authentication schema.
208
 
  * @session: is a #gnutls_session_t structure.
209
 
  *
210
 
  * Returns the type of credentials that were used for client authentication.
211
 
  * The returned information is to be used to distinguish the function used
212
 
  * to access authentication data.
213
 
  *
214
 
  * Returns: The type of credentials for the client authentication
215
 
  *   schema, a #gnutls_credentials_type_t type.
216
 
  **/
 
208
 * gnutls_auth_client_get_type:
 
209
 * @session: is a #gnutls_session_t structure.
 
210
 *
 
211
 * Returns the type of credentials that were used for client authentication.
 
212
 * The returned information is to be used to distinguish the function used
 
213
 * to access authentication data.
 
214
 *
 
215
 * Returns: The type of credentials for the client authentication
 
216
 *   schema, a #gnutls_credentials_type_t type.
 
217
 **/
217
218
gnutls_credentials_type_t
218
219
gnutls_auth_client_get_type (gnutls_session_t session)
219
220
{
220
221
  return
221
222
    _gnutls_map_kx_get_cred (_gnutls_cipher_suite_get_kx_algo
222
 
                             (&session->security_parameters.
223
 
                              current_cipher_suite), 0);
 
223
                             (&session->
 
224
                              security_parameters.current_cipher_suite), 0);
224
225
}
225
226
 
226
227
 
270
271
}
271
272
 
272
273
/*-
273
 
  * _gnutls_get_auth_info - Returns a pointer to authentication information.
274
 
  * @session: is a #gnutls_session_t structure.
275
 
  *
276
 
  * This function must be called after a succesful gnutls_handshake().
277
 
  * Returns a pointer to authentication information. That information
278
 
  * is data obtained by the handshake protocol, the key exchange algorithm,
279
 
  * and the TLS extensions messages.
280
 
  *
281
 
  * In case of GNUTLS_CRD_ANON returns a type of &anon_(server/client)_auth_info_t;
282
 
  * In case of GNUTLS_CRD_CERTIFICATE returns a type of &cert_auth_info_t;
283
 
  * In case of GNUTLS_CRD_SRP returns a type of &srp_(server/client)_auth_info_t;
284
 
  -*/
 
274
 * _gnutls_get_auth_info - Returns a pointer to authentication information.
 
275
 * @session: is a #gnutls_session_t structure.
 
276
 *
 
277
 * This function must be called after a successful gnutls_handshake().
 
278
 * Returns a pointer to authentication information. That information
 
279
 * is data obtained by the handshake protocol, the key exchange algorithm,
 
280
 * and the TLS extensions messages.
 
281
 *
 
282
 * In case of GNUTLS_CRD_ANON returns a type of &anon_(server/client)_auth_info_t;
 
283
 * In case of GNUTLS_CRD_CERTIFICATE returns a type of &cert_auth_info_t;
 
284
 * In case of GNUTLS_CRD_SRP returns a type of &srp_(server/client)_auth_info_t;
 
285
 -*/
285
286
void *
286
287
_gnutls_get_auth_info (gnutls_session_t session)
287
288
{
289
290
}
290
291
 
291
292
/*-
292
 
  * _gnutls_free_auth_info - Frees the auth info structure
293
 
  * @session: is a #gnutls_session_t structure.
294
 
  *
295
 
  * This function frees the auth info structure and sets it to
296
 
  * null. It must be called since some structures contain malloced
297
 
  * elements.
298
 
  -*/
 
293
 * _gnutls_free_auth_info - Frees the auth info structure
 
294
 * @session: is a #gnutls_session_t structure.
 
295
 *
 
296
 * This function frees the auth info structure and sets it to
 
297
 * null. It must be called since some structures contain malloced
 
298
 * elements.
 
299
 -*/
299
300
void
300
301
_gnutls_free_auth_info (gnutls_session_t session)
301
302
{