projects
/
umurmur.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
21d88cd
)
fixed cipher suite and implemented shutdown/free
author
Felix Morgner
<felix.morgner@gmail.com>
Fri, 30 Jan 2015 16:21:46 +0000
(17:21 +0100)
committer
Felix Morgner
<felix.morgner@gmail.com>
Sat, 31 Jan 2015 12:12:20 +0000
(13:12 +0100)
src/ssli_gnutls.c
patch
|
blob
|
history
diff --git
a/src/ssli_gnutls.c
b/src/ssli_gnutls.c
index b2e149e719d399b77b82a9d3c3aa470c12f73a25..a50d48c3edf9ef69441ced9d4091a5984673deaa 100644
(file)
--- a/
src/ssli_gnutls.c
+++ b/
src/ssli_gnutls.c
@@
-5,7
+5,7
@@
static gnutls_dh_params_t dhParameters;
static gnutls_certificate_credentials_t certificate;
static gnutls_dh_params_t dhParameters;
static gnutls_certificate_credentials_t certificate;
-static const char * ciphers = "
SECURE128:-VERS-DTLS-ALL:-VERS-SSL3.0:-VERS-TLS1.0:+COMP_ALL
";
+static const char * ciphers = "
NONE:+CTYPE-X.509:+DHE-RSA:+RSA:+AES-256-CBC:+AES-128-CBC:+SHA256:+SHA1:+VERS-TLS-ALL:+COMP-ALL:+SIGN-DSA-SHA256:+SIGN-DSA-SHA1
";
static gnutls_priority_t cipherCache;
void initializeCertificate()
static gnutls_priority_t cipherCache;
void initializeCertificate()
@@
-60,7
+60,7
@@
void SSLi_deinit()
SSL_handle_t * SSLi_newconnection( int * fileDescriptor, bool_t * isSSLReady )
{
SSL_handle_t * SSLi_newconnection( int * fileDescriptor, bool_t * isSSLReady )
{
- gnutls_session_t * session
; // Maybe we need to calloc here
+ gnutls_session_t * session
= calloc(1, sizeof(gnutls_session_t));
gnutls_init(session, GNUTLS_SERVER);
gnutls_priority_set(*session, cipherCache);
gnutls_init(session, GNUTLS_SERVER);
gnutls_priority_set(*session, cipherCache);
@@
-70,7
+70,8
@@
SSL_handle_t * SSLi_newconnection( int * fileDescriptor, bool_t * isSSLReady )
gnutls_transport_set_int(*session, *fileDescriptor);
gnutls_transport_set_int(*session, *fileDescriptor);
- *isSSLReady = true;
+ if(isSSLReady && SSLi_nonblockaccept(session, isSSLReady))
+ *isSSLReady = true;
return session;
}
return session;
}
@@
-85,13
+86,16
@@
int SSLi_nonblockaccept( SSL_handle_t *session, bool_t * isSSLReady )
{
int error;
do {
{
int error;
do {
- gnutls_handshake(*session);
+
error =
gnutls_handshake(*session);
} while(error < GNUTLS_E_SUCCESS && !gnutls_error_is_fatal(error));
if ( error < GNUTLS_E_SUCCESS ) {
Log_fatal("TLS handshake failed with error %i (%s).", error, gnutls_strerror(error));
}
} while(error < GNUTLS_E_SUCCESS && !gnutls_error_is_fatal(error));
if ( error < GNUTLS_E_SUCCESS ) {
Log_fatal("TLS handshake failed with error %i (%s).", error, gnutls_strerror(error));
}
+ if(isSSLReady)
+ *isSSLReady = true;
+
return error;
}
return error;
}
@@
-115,8
+119,12
@@
bool_t SSLi_data_pending(SSL_handle_t *session)
return gnutls_record_check_pending(*session);
}
return gnutls_record_check_pending(*session);
}
-void SSLi_shutdown(SSL_handle_t *s
sl
)
+void SSLi_shutdown(SSL_handle_t *s
ession
)
{
{
+ gnutls_bye(*session, GNUTLS_SHUT_WR);
}
}
-void SSLi_free(SSL_handle_t *ssl) {}
+void SSLi_free(SSL_handle_t *session)
+ {
+ gnutls_deinit(*session);
+ }