2 * Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008 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,
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 feature checks */
42 int _gnutls_version_has_selectable_prf (gnutls_protocol_t version
);
43 int _gnutls_version_has_selectable_sighash (gnutls_protocol_t version
);
44 int _gnutls_version_has_extensions (gnutls_protocol_t version
);
45 int _gnutls_version_has_explicit_iv (gnutls_protocol_t version
);
46 int _gnutls_version_has_variable_padding (gnutls_protocol_t version
);
48 /* Functions for MACs. */
49 int _gnutls_mac_is_ok (gnutls_mac_algorithm_t algorithm
);
50 gnutls_mac_algorithm_t
_gnutls_x509_oid2mac_algorithm (const char *oid
);
51 const char *_gnutls_x509_mac_to_oid (gnutls_mac_algorithm_t mac
);
53 /* Functions for cipher suites. */
54 int _gnutls_supported_ciphersuites (gnutls_session_t session
,
55 cipher_suite_st
** ciphers
);
56 int _gnutls_supported_ciphersuites_sorted (gnutls_session_t session
,
57 cipher_suite_st
** ciphers
);
58 const char *_gnutls_cipher_suite_get_name (cipher_suite_st
* algorithm
);
59 gnutls_cipher_algorithm_t
_gnutls_cipher_suite_get_cipher_algo (const
62 gnutls_kx_algorithm_t
_gnutls_cipher_suite_get_kx_algo (const cipher_suite_st
64 gnutls_mac_algorithm_t
_gnutls_cipher_suite_get_mac_algo (const
67 gnutls_protocol_t
_gnutls_cipher_suite_get_version (const cipher_suite_st
*
69 cipher_suite_st
_gnutls_cipher_suite_get_suite_name (cipher_suite_st
*
72 /* Functions for ciphers. */
73 int _gnutls_cipher_get_block_size (gnutls_cipher_algorithm_t algorithm
);
74 int _gnutls_cipher_is_block (gnutls_cipher_algorithm_t algorithm
);
75 int _gnutls_cipher_is_ok (gnutls_cipher_algorithm_t algorithm
);
76 int _gnutls_cipher_get_iv_size (gnutls_cipher_algorithm_t algorithm
);
77 int _gnutls_cipher_get_export_flag (gnutls_cipher_algorithm_t algorithm
);
79 /* Functions for key exchange. */
80 int _gnutls_kx_needs_dh_params (gnutls_kx_algorithm_t algorithm
);
81 int _gnutls_kx_needs_rsa_params (gnutls_kx_algorithm_t algorithm
);
82 mod_auth_st
*_gnutls_kx_auth_struct (gnutls_kx_algorithm_t algorithm
);
83 int _gnutls_kx_is_ok (gnutls_kx_algorithm_t algorithm
);
85 /* Type to KX mappings. */
86 gnutls_kx_algorithm_t
_gnutls_map_kx_get_kx (gnutls_credentials_type_t type
,
88 gnutls_credentials_type_t
_gnutls_map_kx_get_cred (gnutls_kx_algorithm_t
89 algorithm
, int server
);
91 /* KX to PK mapping. */
92 gnutls_pk_algorithm_t
_gnutls_map_pk_get_pk (gnutls_kx_algorithm_t
94 gnutls_pk_algorithm_t
_gnutls_x509_oid2pk_algorithm (const char *oid
);
95 const char *_gnutls_x509_pk_to_oid (gnutls_pk_algorithm_t pk
);
98 { CIPHER_ENCRYPT
= 0, CIPHER_SIGN
= 1, CIPHER_IGN
};
100 enum encipher_type
_gnutls_kx_encipher_type (gnutls_kx_algorithm_t algorithm
);
102 /* Functions for sign algorithms. */
103 gnutls_sign_algorithm_t
_gnutls_x509_oid2sign_algorithm (const char *oid
);
104 gnutls_sign_algorithm_t
_gnutls_x509_pk_to_sign (gnutls_pk_algorithm_t pk
,
105 gnutls_mac_algorithm_t mac
);
106 gnutls_pk_algorithm_t
_gnutls_x509_sign_to_pk (gnutls_sign_algorithm_t sign
);
107 const char *_gnutls_x509_sign_to_oid (gnutls_pk_algorithm_t
,
108 gnutls_mac_algorithm_t mac
);
109 gnutls_sign_algorithm_t
_gnutls_tls_aid_to_sign (const sign_algorithm_st
* aid
);
110 sign_algorithm_st
_gnutls_sign_to_tls_aid (gnutls_sign_algorithm_t sign
);
111 gnutls_mac_algorithm_t
_gnutls_sign_get_hash_algorithm (gnutls_sign_algorithm_t
);
112 gnutls_pk_algorithm_t
_gnutls_sign_get_pk_algorithm (gnutls_sign_algorithm_t
);
114 int _gnutls_mac_priority (gnutls_session_t session
,
115 gnutls_mac_algorithm_t algorithm
);
116 int _gnutls_cipher_priority (gnutls_session_t session
,
117 gnutls_cipher_algorithm_t algorithm
);
118 int _gnutls_kx_priority (gnutls_session_t session
,
119 gnutls_kx_algorithm_t algorithm
);