X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=src%2Fssli_gnutls.c;fp=src%2Fssli_gnutls.c;h=e8b4609a052cf9bc7b5d8357c92557fb6bce21fd;hb=2785848e2d632108a2f61aaa41ccca97f5443284;hp=dfe2f2eeb47628fde849950c9d1608ce54b2a0c0;hpb=898e1028c5e2d7d987c564b176e82b346c435b15;p=umurmur.git diff --git a/src/ssli_gnutls.c b/src/ssli_gnutls.c index dfe2f2e..e8b4609 100644 --- a/src/ssli_gnutls.c +++ b/src/ssli_gnutls.c @@ -78,10 +78,13 @@ SSL_handle_t * SSLi_newconnection( int * fileDescriptor, bool_t * isSSLReady ) return session; } -bool_t SSLi_getSHA1Hash(SSL_handle_t *ssl, uint8_t *hash) +bool_t SSLi_getSHA1Hash(SSL_handle_t *session, uint8_t *hash) { - *hash = 0; - return true; + gnutls_datum_t const * certificateData = gnutls_certificate_get_peers(*session, NULL); + + size_t resultSize = 0; + int error = gnutls_fingerprint( GNUTLS_DIG_SHA1, certificateData, hash, &resultSize); + return error == GNUTLS_E_SUCCESS && resultSize == 20; } int SSLi_nonblockaccept( SSL_handle_t *session, bool_t * isSSLReady )