#define CERTERR_SIGNERNOTCA 32
#define CERTERR_INSECUREALG 64
+/* deprecated types compatibility */
+
+#ifndef HAVE_GNUTLS_CERTIFICATE_CREDENTIALS_T
+typedef gnutls_certificate_credentials gnutls_certificate_credentials_t;
+#endif
+
+#ifndef HAVE_GNUTLS_CERTIFICATE_STATUS_T
+typedef gnutls_certificate_status gnutls_certificate_status_t;
+#endif
+
+#ifndef HAVE_GNUTLS_DATUM_T
+typedef gnutls_datum gnutls_datum_t;
+#endif
+
+#ifndef HAVE_GNUTLS_DIGEST_ALGORITHM_T
+typedef gnutls_digest_algorithm gnutls_digest_algorithm_t;
+#endif
+
+#ifndef HAVE_GNUTLS_SESSION_T
+typedef gnutls_session gnutls_session_t;
+#endif
+
+#ifndef HAVE_GNUTLS_TRANSPORT_PTR_T
+typedef gnutls_transport_ptr gnutls_transport_ptr_t;
+#endif
+
+#ifndef HAVE_GNUTLS_X509_CRT_T
+typedef gnutls_x509_crt gnutls_x509_crt_t;
+#endif
+
+
typedef struct _tlssockdata
{
- gnutls_session state;
- gnutls_certificate_credentials xcred;
+ gnutls_session_t state;
+ gnutls_certificate_credentials_t xcred;
}
tlssockdata;
}
/* set socket */
- gnutls_transport_set_ptr (data->state, (gnutls_transport_ptr)conn->fd);
+ gnutls_transport_set_ptr (data->state, (gnutls_transport_ptr_t)(long)conn->fd);
if (tls_set_priority(data) < 0) {
goto fail;
#define CERT_SEP "-----BEGIN"
/* this bit is based on read_ca_file() in gnutls */
-static int tls_compare_certificates (const gnutls_datum *peercert)
+static int tls_compare_certificates (const gnutls_datum_t *peercert)
{
- gnutls_datum cert;
+ gnutls_datum_t cert;
unsigned char *ptr;
FILE *fd1;
int ret;
- gnutls_datum b64_data;
+ gnutls_datum_t b64_data;
unsigned char *b64_data_data;
struct stat filestat;
return 0;
}
-static void tls_fingerprint (gnutls_digest_algorithm algo,
- char* s, int l, const gnutls_datum* data)
+static void tls_fingerprint (gnutls_digest_algorithm_t algo,
+ char* s, int l, const gnutls_datum_t* data)
{
unsigned char md[36];
size_t n;
return (s);
}
-static int tls_check_stored_hostname (const gnutls_datum *cert,
+static int tls_check_stored_hostname (const gnutls_datum_t *cert,
const char *hostname)
{
char buf[80];
}
static int tls_check_preauth (const gnutls_datum_t *certdata,
- gnutls_certificate_status certstat,
+ gnutls_certificate_status_t certstat,
const char *hostname, int chainidx, int* certerr,
int* savedcert)
{
- gnutls_x509_crt cert;
+ gnutls_x509_crt_t cert;
*certerr = CERTERR_VALID;
*savedcert = 0;
* Returns 0 on failure, nonzero on success.
*/
static int tls_check_one_certificate (const gnutls_datum_t *certdata,
- gnutls_certificate_status certstat,
+ gnutls_certificate_status_t certstat,
const char* hostname, int idx, int len)
{
int certerr, savedcert;
- gnutls_x509_crt cert;
+ gnutls_x509_crt_t cert;
char buf[SHORT_STRING];
char fpbuf[SHORT_STRING];
size_t buflen;
char helpstr[LONG_STRING];
char title[STRING];
FILE *fp;
- gnutls_datum pemdata;
+ gnutls_datum_t pemdata;
int i, row, done, ret;
if (!tls_check_preauth (certdata, certstat, hostname, idx, &certerr,
}
/* sanity-checking wrapper for gnutls_certificate_verify_peers */
-static gnutls_certificate_status tls_verify_peers (gnutls_session tlsstate)
+static gnutls_certificate_status_t tls_verify_peers (gnutls_session_t tlsstate)
{
int verify_ret;
unsigned int status;
static int tls_check_certificate (CONNECTION* conn)
{
tlssockdata *data = conn->sockdata;
- gnutls_session state = data->state;
- const gnutls_datum *cert_list;
+ gnutls_session_t state = data->state;
+ const gnutls_datum_t *cert_list;
unsigned int cert_list_size = 0;
- gnutls_certificate_status certstat;
+ gnutls_certificate_status_t certstat;
int certerr, i, preauthrc, savedcert, rc = 0;
int rcpeer = -1; /* the result of tls_check_preauth() on the peer's EE cert */