1024: Verify server certificate hostname with OpenSSL
[elinks.git] / src / network / ssl / ssl.h
blob601fde1ffd4c88ae12b853e584a125386acbd8d8
2 #ifndef EL__NETWORK_SSL_SSL_H
3 #define EL__NETWORK_SSL_SSL_H
5 #ifdef CONFIG_SSL
7 #include "main/module.h"
9 struct socket;
11 extern struct module ssl_module;
13 /* Initializes the SSL connection data. Returns S_OK on success and S_SSL_ERROR
14 * on failure.
16 * server_name is the DNS name of the server (in UTF-8), or NULL if
17 * ELinks knows only the IP address. ELinks reports that name to the
18 * server so that the server can choose the correct certificate if it
19 * has multiple virtual hosts on the same IP address. See RFC 3546
20 * section 3.1.
22 * server_name does not affect how ELinks verifies the certificate
23 * after the server has returned it. */
24 int init_ssl_connection(struct socket *socket,
25 const unsigned char *server_name);
27 /* Releases the SSL connection data */
28 void done_ssl_connection(struct socket *socket);
30 unsigned char *get_ssl_connection_cipher(struct socket *socket);
32 #if defined(CONFIG_OPENSSL) || defined(CONFIG_NSS_COMPAT_OSSL)
33 extern int socket_SSL_ex_data_idx;
34 #endif
36 /* Internal type used in ssl module. */
38 #if defined(CONFIG_OPENSSL) || defined(CONFIG_NSS_COMPAT_OSSL)
39 #define ssl_t SSL
40 #elif defined(CONFIG_GNUTLS)
41 #define ssl_t gnutls_session_t
42 #endif
44 #endif /* CONFIG_SSL */
45 #endif