2 * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software Foundation
4 * Author: Nikos Mavroyanopoulos
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,
28 #include "gnutls_auth.h"
30 /* Functions for version handling. */
31 gnutls_protocol_t
_gnutls_version_lowest (gnutls_session_t session
);
32 gnutls_protocol_t
_gnutls_version_max (gnutls_session_t session
);
33 int _gnutls_version_priority (gnutls_session_t session
,
34 gnutls_protocol_t version
);
35 int _gnutls_version_is_supported (gnutls_session_t session
,
36 const gnutls_protocol_t version
);
37 int _gnutls_version_get_major (gnutls_protocol_t ver
);
38 int _gnutls_version_get_minor (gnutls_protocol_t ver
);
39 gnutls_protocol_t
_gnutls_version_get (int major
, int minor
);
41 /* Functions for MACs. */
42 int _gnutls_mac_is_ok (gnutls_mac_algorithm_t algorithm
);
43 int _gnutls_mac_priority (gnutls_session_t session
,
44 gnutls_mac_algorithm_t algorithm
);
45 gnutls_mac_algorithm_t
_gnutls_x509_oid2mac_algorithm (const char *oid
);
46 const char *_gnutls_x509_mac_to_oid (gnutls_mac_algorithm_t mac
);
48 /* Functions for cipher suites. */
49 int _gnutls_supported_ciphersuites (gnutls_session_t session
,
50 cipher_suite_st
** ciphers
);
51 int _gnutls_supported_ciphersuites_sorted (gnutls_session_t session
,
52 cipher_suite_st
** ciphers
);
53 int _gnutls_supported_compression_methods (gnutls_session_t session
,
55 const char *_gnutls_cipher_suite_get_name (cipher_suite_st
* algorithm
);
56 gnutls_cipher_algorithm_t
_gnutls_cipher_suite_get_cipher_algo (const
59 gnutls_kx_algorithm_t
_gnutls_cipher_suite_get_kx_algo (const cipher_suite_st
61 gnutls_mac_algorithm_t
_gnutls_cipher_suite_get_mac_algo (const
64 gnutls_protocol_t
_gnutls_cipher_suite_get_version (const cipher_suite_st
*
66 cipher_suite_st
_gnutls_cipher_suite_get_suite_name (cipher_suite_st
*
69 /* Functions for ciphers. */
70 int _gnutls_cipher_priority (gnutls_session_t session
,
71 gnutls_cipher_algorithm_t algorithm
);
72 int _gnutls_cipher_get_block_size (gnutls_cipher_algorithm_t algorithm
);
73 int _gnutls_cipher_is_block (gnutls_cipher_algorithm_t algorithm
);
74 int _gnutls_cipher_is_ok (gnutls_cipher_algorithm_t algorithm
);
75 int _gnutls_cipher_get_iv_size (gnutls_cipher_algorithm_t algorithm
);
76 int _gnutls_cipher_get_export_flag (gnutls_cipher_algorithm_t algorithm
);
78 /* Functions for key exchange. */
79 int _gnutls_kx_priority (gnutls_session_t session
,
80 gnutls_kx_algorithm_t algorithm
);
81 int _gnutls_kx_needs_dh_params (gnutls_kx_algorithm_t algorithm
);
82 int _gnutls_kx_needs_rsa_params (gnutls_kx_algorithm_t algorithm
);
83 mod_auth_st
*_gnutls_kx_auth_struct (gnutls_kx_algorithm_t algorithm
);
84 int _gnutls_kx_is_ok (gnutls_kx_algorithm_t algorithm
);
86 /* Functions for compression. */
87 int _gnutls_compression_priority (gnutls_session_t session
,
88 gnutls_compression_method_t algorithm
);
89 int _gnutls_compression_is_ok (gnutls_compression_method_t algorithm
);
90 int _gnutls_compression_get_num (gnutls_compression_method_t algorithm
);
91 gnutls_compression_method_t
_gnutls_compression_get_id (int num
);
92 int _gnutls_compression_get_mem_level (gnutls_compression_method_t algorithm
);
93 int _gnutls_compression_get_comp_level (gnutls_compression_method_t
95 int _gnutls_compression_get_wbits (gnutls_compression_method_t algorithm
);
97 /* Type to KX mappings. */
98 gnutls_kx_algorithm_t
_gnutls_map_kx_get_kx (gnutls_credentials_type_t type
,
100 gnutls_credentials_type_t
_gnutls_map_kx_get_cred (gnutls_kx_algorithm_t
101 algorithm
, int server
);
103 /* KX to PK mapping. */
104 gnutls_pk_algorithm_t
_gnutls_map_pk_get_pk (gnutls_kx_algorithm_t
106 gnutls_pk_algorithm_t
_gnutls_x509_oid2pk_algorithm (const char *oid
);
107 const char *_gnutls_x509_pk_to_oid (gnutls_pk_algorithm_t pk
);
110 { CIPHER_ENCRYPT
= 0, CIPHER_SIGN
= 1, CIPHER_IGN
};
112 enum encipher_type
_gnutls_kx_encipher_type (gnutls_kx_algorithm_t algorithm
);
114 struct gnutls_compression_entry
117 gnutls_compression_method_t id
;
118 int num
; /* the number reserved in TLS for the specific compression method */
120 /* used in zlib compressor */
125 typedef struct gnutls_compression_entry gnutls_compression_entry
;
127 /* Functions for sign algorithms. */
128 gnutls_sign_algorithm_t
_gnutls_x509_oid2sign_algorithm (const char *oid
);
129 gnutls_sign_algorithm_t
_gnutls_x509_pk_to_sign (gnutls_pk_algorithm_t pk
,
130 gnutls_mac_algorithm_t mac
);
131 const char *_gnutls_x509_sign_to_oid (gnutls_pk_algorithm_t
,
132 gnutls_mac_algorithm_t mac
);