2 * Copyright (C) 2001, 2004, 2005, 2007, 2008, 2009, 2010 Free Software
5 * Author: Nikos Mavrogiannopoulos
7 * This file is part of GnuTLS.
9 * The GnuTLS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1 of
12 * the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
26 #include "gnutls_int.h"
30 #include "gnutls_errors.h"
31 #include "auth_anon.h"
32 #include "gnutls_auth.h"
33 #include "gnutls_dh.h"
34 #include "gnutls_num.h"
35 #include "gnutls_mpi.h"
38 * gnutls_anon_free_server_credentials:
39 * @sc: is a #gnutls_anon_server_credentials_t structure.
41 * This structure is complex enough to manipulate directly thus this
42 * helper function is provided in order to free (deallocate) it.
45 gnutls_anon_free_server_credentials (gnutls_anon_server_credentials_t sc
)
52 * gnutls_anon_allocate_server_credentials:
53 * @sc: is a pointer to a #gnutls_anon_server_credentials_t structure.
55 * This structure is complex enough to manipulate directly thus this
56 * helper function is provided in order to allocate it.
58 * Returns: %GNUTLS_E_SUCCESS on success, or an error code.
61 gnutls_anon_allocate_server_credentials (gnutls_anon_server_credentials_t
*
65 *sc
= gnutls_calloc (1, sizeof (anon_server_credentials_st
));
72 * gnutls_anon_free_client_credentials:
73 * @sc: is a #gnutls_anon_client_credentials_t structure.
75 * This structure is complex enough to manipulate directly thus this
76 * helper function is provided in order to free (deallocate) it.
79 gnutls_anon_free_client_credentials (gnutls_anon_client_credentials_t sc
)
83 static struct gnutls_anon_client_credentials_st anon_dummy_struct
;
84 static const gnutls_anon_client_credentials_t anon_dummy
= &anon_dummy_struct
;
87 * gnutls_anon_allocate_client_credentials:
88 * @sc: is a pointer to a #gnutls_anon_client_credentials_t structure.
90 * This structure is complex enough to manipulate directly thus
91 * this helper function is provided in order to allocate it.
93 * Returns: %GNUTLS_E_SUCCESS on success, or an error code.
96 gnutls_anon_allocate_client_credentials (gnutls_anon_client_credentials_t
*
99 /* anon_dummy is only there for *sc not to be null.
100 * it is not used at all;
108 * gnutls_anon_set_server_dh_params:
109 * @res: is a gnutls_anon_server_credentials_t structure
110 * @dh_params: is a structure that holds Diffie-Hellman parameters.
112 * This function will set the Diffie-Hellman parameters for an
113 * anonymous server to use. These parameters will be used in
114 * Anonymous Diffie-Hellman cipher suites.
117 gnutls_anon_set_server_dh_params (gnutls_anon_server_credentials_t res
,
118 gnutls_dh_params_t dh_params
)
120 res
->dh_params
= dh_params
;
124 * gnutls_anon_set_server_params_function:
125 * @res: is a gnutls_certificate_credentials_t structure
126 * @func: is the function to be called
128 * This function will set a callback in order for the server to get
129 * the Diffie-Hellman parameters for anonymous authentication. The
130 * callback should return zero on success.
133 gnutls_anon_set_server_params_function (gnutls_anon_server_credentials_t res
,
134 gnutls_params_function
* func
)
136 res
->params_func
= func
;