2 * Copyright (C) 2001-2012 Free Software Foundation, Inc.
4 * Author: Nikos Mavrogiannopoulos
6 * This file is part of GnuTLS.
8 * The GnuTLS 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 License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>
23 #include "gnutls_int.h"
27 #include "gnutls_errors.h"
28 #include <auth/anon.h>
29 #include "gnutls_auth.h"
30 #include "gnutls_dh.h"
31 #include "gnutls_num.h"
32 #include "gnutls_mpi.h"
35 * gnutls_anon_free_server_credentials:
36 * @sc: is a #gnutls_anon_server_credentials_t structure.
38 * This structure is complex enough to manipulate directly thus this
39 * helper function is provided in order to free (deallocate) it.
42 gnutls_anon_free_server_credentials(gnutls_anon_server_credentials_t sc)
49 * gnutls_anon_allocate_server_credentials:
50 * @sc: is a pointer to a #gnutls_anon_server_credentials_t structure.
52 * This structure is complex enough to manipulate directly thus this
53 * helper function is provided in order to allocate it.
55 * Returns: %GNUTLS_E_SUCCESS on success, or an error code.
58 gnutls_anon_allocate_server_credentials(gnutls_anon_server_credentials_t *
62 *sc = gnutls_calloc(1, sizeof(anon_server_credentials_st));
69 * gnutls_anon_free_client_credentials:
70 * @sc: is a #gnutls_anon_client_credentials_t structure.
72 * This structure is complex enough to manipulate directly thus this
73 * helper function is provided in order to free (deallocate) it.
76 gnutls_anon_free_client_credentials(gnutls_anon_client_credentials_t sc)
80 static struct gnutls_anon_client_credentials_st anon_dummy_struct;
81 static const gnutls_anon_client_credentials_t anon_dummy =
85 * gnutls_anon_allocate_client_credentials:
86 * @sc: is a pointer to a #gnutls_anon_client_credentials_t structure.
88 * This structure is complex enough to manipulate directly thus
89 * this helper function is provided in order to allocate it.
91 * Returns: %GNUTLS_E_SUCCESS on success, or an error code.
94 gnutls_anon_allocate_client_credentials(gnutls_anon_client_credentials_t *
97 /* anon_dummy is only there for *sc not to be null.
98 * it is not used at all;
106 * gnutls_anon_set_server_dh_params:
107 * @res: is a gnutls_anon_server_credentials_t structure
108 * @dh_params: is a structure that holds Diffie-Hellman parameters.
110 * This function will set the Diffie-Hellman parameters for an
111 * anonymous server to use. These parameters will be used in
112 * Anonymous Diffie-Hellman cipher suites.
115 gnutls_anon_set_server_dh_params(gnutls_anon_server_credentials_t res,
116 gnutls_dh_params_t dh_params)
118 res->dh_params = dh_params;
122 * gnutls_anon_set_server_params_function:
123 * @res: is a gnutls_certificate_credentials_t structure
124 * @func: is the function to be called
126 * This function will set a callback in order for the server to get
127 * the Diffie-Hellman parameters for anonymous authentication. The
128 * callback should return %GNUTLS_E_SUCCESS (0) on success.
131 gnutls_anon_set_server_params_function(gnutls_anon_server_credentials_t
132 res, gnutls_params_function * func)
134 res->params_func = func;