libpurple/plugins/ssl/ssl-gnutls.c

branch
release-2.x.y
changeset 35978
c0b60f37a7db
parent 31155
757baa7d408f
child 35989
2b5a26ddbb69
child 36146
42ba908c25c7
--- a/libpurple/plugins/ssl/ssl-gnutls.c	Tue May 06 12:43:32 2014 +0200
+++ b/libpurple/plugins/ssl/ssl-gnutls.c	Tue May 06 13:03:47 2014 +0200
@@ -34,7 +34,7 @@
 
 typedef struct
 {
-	gnutls_session session;
+	gnutls_session_t session;
 	guint handshake_handler;
 	guint handshake_timer;
 } PurpleSslGnutlsData;
@@ -284,9 +284,9 @@
 		g_list_free(peers);
 
 		{
-			const gnutls_datum *cert_list;
+			const gnutls_datum_t *cert_list;
 			unsigned int cert_list_size = 0;
-			gnutls_session session=gnutls_data->session;
+			gnutls_session_t session=gnutls_data->session;
 			int i;
 
 			cert_list =
@@ -303,13 +303,13 @@
 				gchar tbuf[256];
 				gsize tsz=sizeof(tbuf);
 				gchar * tasc = NULL;
-				gnutls_x509_crt cert;
+				gnutls_x509_crt_t cert;
 
 				gnutls_x509_crt_init(&cert);
 				gnutls_x509_crt_import (cert, &cert_list[i],
 						GNUTLS_X509_FMT_DER);
 
-				gnutls_x509_crt_get_fingerprint(cert, GNUTLS_MAC_SHA,
+				gnutls_x509_crt_get_fingerprint(cert, GNUTLS_DIG_SHA,
 						fpr_bin, &fpr_bin_sz);
 
 				fpr_asc =
@@ -386,7 +386,6 @@
 ssl_gnutls_connect(PurpleSslConnection *gsc)
 {
 	PurpleSslGnutlsData *gnutls_data;
-	static const int cert_type_priority[2] = { GNUTLS_CRT_X509, 0 };
 
 	gnutls_data = g_new0(PurpleSslGnutlsData, 1);
 	gsc->private_data = gnutls_data;
@@ -413,9 +412,6 @@
 	gnutls_set_default_priority(gnutls_data->session);
 #endif
 
-	gnutls_certificate_type_set_priority(gnutls_data->session,
-		cert_type_priority);
-
 	gnutls_credentials_set(gnutls_data->session, GNUTLS_CRD_CERTIFICATE,
 		xcred);
 
@@ -519,7 +515,7 @@
 
 /* Forward declarations are fun! */
 static PurpleCertificate *
-x509_import_from_datum(const gnutls_datum dt, gnutls_x509_crt_fmt mode);
+x509_import_from_datum(const gnutls_datum_t dt, gnutls_x509_crt_fmt_t mode);
 /* indeed! */
 static gboolean
 x509_certificate_signed_by(PurpleCertificate * crt,
@@ -537,7 +533,7 @@
 	GList * peer_certs = NULL;
 
 	/* List of raw certificates as given by GnuTLS */
-	const gnutls_datum *cert_list;
+	const gnutls_datum_t *cert_list;
 	unsigned int cert_list_size = 0;
 
 	unsigned int i;
@@ -585,7 +581,7 @@
 /** Refcounted GnuTLS certificate data instance */
 typedef struct {
 	gint refcount;
-	gnutls_x509_crt crt;
+	gnutls_x509_crt_t crt;
 } x509_crtdata_t;
 
 /** Helper functions for reference counting */
@@ -627,7 +623,7 @@
  * @return A newly allocated Certificate structure of the x509_gnutls scheme
  */
 static PurpleCertificate *
-x509_import_from_datum(const gnutls_datum dt, gnutls_x509_crt_fmt mode)
+x509_import_from_datum(const gnutls_datum_t dt, gnutls_x509_crt_fmt_t mode)
 {
 	/* Internal certificate data structure */
 	x509_crtdata_t *certdat;
@@ -662,7 +658,7 @@
 	PurpleCertificate *crt;  /* Certificate being constructed */
 	gchar *buf;        /* Used to load the raw file data */
 	gsize buf_sz;      /* Size of the above */
-	gnutls_datum dt; /* Struct to pass down to GnuTLS */
+	gnutls_datum_t dt; /* Struct to pass down to GnuTLS */
 
 	purple_debug_info("gnutls",
 			  "Attempting to load X.509 certificate from %s\n",
@@ -705,7 +701,7 @@
 	gchar *begin, *end;
 	GSList *crts = NULL;
 	gsize buf_sz;      /* Size of the above */
-	gnutls_datum dt; /* Struct to pass down to GnuTLS */
+	gnutls_datum_t dt; /* Struct to pass down to GnuTLS */
 
 	purple_debug_info("gnutls",
 			  "Attempting to load X.509 certificates from %s\n",
@@ -751,7 +747,7 @@
 static gboolean
 x509_export_certificate(const gchar *filename, PurpleCertificate *crt)
 {
-	gnutls_x509_crt crt_dat; /* GnuTLS cert struct */
+	gnutls_x509_crt_t crt_dat; /* GnuTLS cert struct */
 	int ret;
 	gchar * out_buf; /* Data to output */
 	size_t out_size; /* Output size */
@@ -857,8 +853,8 @@
 x509_certificate_signed_by(PurpleCertificate * crt,
 			   PurpleCertificate * issuer)
 {
-	gnutls_x509_crt crt_dat;
-	gnutls_x509_crt issuer_dat;
+	gnutls_x509_crt_t crt_dat;
+	gnutls_x509_crt_t issuer_dat;
 	unsigned int verify; /* used to store result from GnuTLS verifier */
 	int ret;
 	gchar *crt_id = NULL;
@@ -963,7 +959,7 @@
 {
 	size_t hashlen = 20; /* SHA1 hashes are 20 bytes */
 	size_t tmpsz = hashlen; /* Throw-away variable for GnuTLS to stomp on*/
-	gnutls_x509_crt crt_dat;
+	gnutls_x509_crt_t crt_dat;
 	GByteArray *hash; /**< Final hash container */
 	guchar hashbuf[hashlen]; /**< Temporary buffer to contain hash */
 
@@ -973,7 +969,7 @@
 
 	/* Extract the fingerprint */
 	g_return_val_if_fail(
-		0 == gnutls_x509_crt_get_fingerprint(crt_dat, GNUTLS_MAC_SHA,
+		0 == gnutls_x509_crt_get_fingerprint(crt_dat, GNUTLS_DIG_SHA,
 						     hashbuf, &tmpsz),
 		NULL);
 
@@ -990,7 +986,7 @@
 static gchar *
 x509_cert_dn (PurpleCertificate *crt)
 {
-	gnutls_x509_crt cert_dat;
+	gnutls_x509_crt_t cert_dat;
 	gchar *dn = NULL;
 	size_t dn_size;
 
@@ -1023,7 +1019,7 @@
 static gchar *
 x509_issuer_dn (PurpleCertificate *crt)
 {
-	gnutls_x509_crt cert_dat;
+	gnutls_x509_crt_t cert_dat;
 	gchar *dn = NULL;
 	size_t dn_size;
 
@@ -1057,7 +1053,7 @@
 static gchar *
 x509_common_name (PurpleCertificate *crt)
 {
-	gnutls_x509_crt cert_dat;
+	gnutls_x509_crt_t cert_dat;
 	gchar *cn = NULL;
 	size_t cn_size;
 	int ret;
@@ -1100,7 +1096,7 @@
 static gboolean
 x509_check_name (PurpleCertificate *crt, const gchar *name)
 {
-	gnutls_x509_crt crt_dat;
+	gnutls_x509_crt_t crt_dat;
 
 	g_return_val_if_fail(crt, FALSE);
 	g_return_val_if_fail(crt->scheme == &x509_gnutls, FALSE);
@@ -1118,7 +1114,7 @@
 static gboolean
 x509_times (PurpleCertificate *crt, time_t *activation, time_t *expiration)
 {
-	gnutls_x509_crt crt_dat;
+	gnutls_x509_crt_t crt_dat;
 	/* GnuTLS time functions return this on error */
 	const time_t errval = (time_t) (-1);
 	gboolean success = TRUE;

mercurial