*** empty log message ***
[gnutls.git] / lib / gnutls_anon_cred.c
blob8fc90566d5d3af00b13c1a3463b7a86f23d509b5
1 /*
2 * Copyright (C) 2001 Nikos Mavroyanopoulos
4 * This file is part of GNUTLS.
6 * The GNUTLS library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include "gnutls_int.h"
23 #include "gnutls_errors.h"
24 #include "auth_anon.h"
26 #ifdef ENABLE_ANON
28 #include "gnutls_auth_int.h"
29 #include "gnutls_dh.h"
30 #include "gnutls_num.h"
31 #include "gnutls_mpi.h"
33 static int anon_tmp;
35 /**
36 * gnutls_anon_free_server_sc - Used to free an allocated GNUTLS_ANON_SERVER_CREDENTIALS structure
37 * @sc: is an &GNUTLS_ANON_SERVER_CREDENTIALS structure.
39 * This structure is complex enough to manipulate directly thus
40 * this helper function is provided in order to free (deallocate)
41 * the structure.
42 **/
43 void gnutls_anon_free_server_sc( GNUTLS_ANON_SERVER_CREDENTIALS sc) {
45 gnutls_free( sc);
48 /**
49 * gnutls_anon_allocate_server_sc - Used to allocate an GNUTLS_ANON_SERVER CREDENTIALS structure
50 * @sc: is a pointer to an &GNUTLS_ANON_SERVER_CREDENTIALS structure.
52 * This structure is complex enough to manipulate directly thus
53 * this helper function is provided in order to allocate
54 * the structure.
55 **/
56 int gnutls_anon_allocate_server_sc( GNUTLS_ANON_SERVER_CREDENTIALS *sc) {
58 *sc = gnutls_calloc( 1, sizeof(ANON_SERVER_CREDENTIALS_INT));
59 (*sc)->dh_params = &_gnutls_dh_default_params;
61 return 0;
65 /**
66 * gnutls_anon_free_client_sc - Used to free an allocated GNUTLS_ANON_CLIENT_CREDENTIALS structure
67 * @sc: is an &GNUTLS_ANON_CLIENT_CREDENTIALS structure.
69 * This structure is complex enough to manipulate directly thus
70 * this helper function is provided in order to free (deallocate)
71 * the structure.
72 **/
73 void gnutls_anon_free_client_sc( GNUTLS_ANON_CLIENT_CREDENTIALS sc) {
74 return;
78 /**
79 * gnutls_allocate_anon_client_sc - Used to allocate an GNUTLS_ANON_CLIENT CREDENTIALS structure
80 * @sc: is a pointer to an &GNUTLS_ANON_CLIENT_CREDENTIALS structure.
82 * This structure is complex enough to manipulate directly thus
83 * this helper function is provided in order to allocate
84 * the structure.
85 **/
86 int gnutls_anon_allocate_client_sc( GNUTLS_ANON_CLIENT_CREDENTIALS *sc) {
87 /* anon_tmp is only there for *sc not to be null.
88 * it is not used at all;
90 *sc = (void*) &anon_tmp;
92 return 0;
95 #else /* No ANON: define stubs */
97 void gnutls_anon_free_server_sc( GNUTLS_ANON_SERVER_CREDENTIALS sc) {
98 return;
101 int gnutls_anon_allocate_server_sc( GNUTLS_ANON_SERVER_CREDENTIALS *sc) {
103 return GNUTLS_E_UNIMPLEMENTED_FEATURE;
106 void gnutls_anon_free_client_sc( GNUTLS_ANON_CLIENT_CREDENTIALS sc) {
107 return;
111 int gnutls_anon_allocate_client_sc( GNUTLS_ANON_CLIENT_CREDENTIALS *sc) {
112 return GNUTLS_E_UNIMPLEMENTED_FEATURE;
115 #endif