2 * Copyright (C) 2001, 2004, 2005, 2007 Free Software Foundation
4 * Author: Nikos Mavrogiannopoulos
6 * This file is part of GNUTLS.
8 * The GNUTLS library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public License
10 * as published by the Free Software Foundation; either version 2.1 of
11 * the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
25 #include "gnutls_int.h"
29 #include "gnutls_errors.h"
30 #include "auth_anon.h"
31 #include "gnutls_auth_int.h"
32 #include "gnutls_dh.h"
33 #include "gnutls_num.h"
34 #include "gnutls_mpi.h"
36 static const int anon_dummy
;
39 * gnutls_anon_free_server_credentials - Used to free an allocated gnutls_anon_server_credentials_t structure
40 * @sc: is an #gnutls_anon_server_credentials_t structure.
42 * This structure is complex enough to manipulate directly thus this
43 * helper function is provided in order to free (deallocate) it.
46 gnutls_anon_free_server_credentials (gnutls_anon_server_credentials_t sc
)
53 * gnutls_anon_allocate_server_credentials - Used to allocate an gnutls_anon_server_credentials_t structure
54 * @sc: is a pointer to an #gnutls_anon_server_credentials_t structure.
56 * This structure is complex enough to manipulate directly thus this
57 * helper function is provided in order to allocate it.
59 * Returns: %GNUTLS_E_SUCCESS on success, or an error code.
62 gnutls_anon_allocate_server_credentials (gnutls_anon_server_credentials_t
*sc
)
65 *sc
= gnutls_calloc (1, sizeof (anon_server_credentials_st
));
72 * gnutls_anon_free_client_credentials - Used to free an allocated gnutls_anon_client_credentials_t structure
73 * @sc: is an #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
)
84 * gnutls_anon_allocate_client_credentials - Used to allocate a credentials structure
85 * @sc: is a pointer to an #gnutls_anon_client_credentials_t structure.
87 * This structure is complex enough to manipulate directly thus
88 * this helper function is provided in order to allocate it.
90 * Returns: %GNUTLS_E_SUCCESS on success, or an error code.
93 gnutls_anon_allocate_client_credentials (gnutls_anon_client_credentials_t
*sc
)
95 /* anon_dummy is only there for *sc not to be null.
96 * it is not used at all;
98 *sc
= (void *) &anon_dummy
;
104 * gnutls_anon_set_server_dh_params - set the DH parameters for a server to use
105 * @res: is a gnutls_anon_server_credentials_t structure
106 * @dh_params: is a structure that holds diffie hellman parameters.
108 * This function will set the diffie hellman parameters for an
109 * anonymous server to use. These parameters will be used in
110 * Anonymous Diffie Hellman cipher suites.
113 gnutls_anon_set_server_dh_params (gnutls_anon_server_credentials_t res
,
114 gnutls_dh_params_t dh_params
)
116 res
->dh_params
= dh_params
;
120 * gnutls_anon_set_server_params_function - set the DH parameters callback
121 * @res: is a gnutls_certificate_credentials_t structure
122 * @func: is the function to be called
124 * This function will set a callback in order for the server to get
125 * the diffie hellman parameters for anonymous authentication. The
126 * callback should return zero on success.
129 gnutls_anon_set_server_params_function (gnutls_anon_server_credentials_t res
,
130 gnutls_params_function
* func
)
132 res
->params_func
= func
;