Issue #126: fixed deprecated GnuTLS types.

This commit is contained in:
Vincent Richard 2016-03-23 20:17:07 +01:00
parent 4b62ae4174
commit af4c21ccdb
5 changed files with 19 additions and 19 deletions

View File

@ -122,8 +122,8 @@ struct TLSGlobal
#endif // VMIME_DEBUG && GNUTLS_DEBUG #endif // VMIME_DEBUG && GNUTLS_DEBUG
gnutls_anon_client_credentials anonCred; gnutls_anon_client_credentials_t anonCred;
gnutls_certificate_credentials certCred; gnutls_certificate_credentials_t certCred;
}; };
static TLSGlobal g_gnutlsGlobal; static TLSGlobal g_gnutlsGlobal;
@ -145,7 +145,7 @@ TLSSession_GnuTLS::TLSSession_GnuTLS(shared_ptr <security::cert::certificateVeri
{ {
int res; int res;
m_gnutlsSession = new gnutls_session; m_gnutlsSession = new gnutls_session_t;
if (gnutls_init(m_gnutlsSession, GNUTLS_CLIENT) != 0) if (gnutls_init(m_gnutlsSession, GNUTLS_CLIENT) != 0)
throw std::bad_alloc(); throw std::bad_alloc();

View File

@ -68,7 +68,7 @@ private:
#ifdef LIBGNUTLS_VERSION #ifdef LIBGNUTLS_VERSION
gnutls_session* m_gnutlsSession; gnutls_session_t* m_gnutlsSession;
#else #else
void* m_gnutlsSession; void* m_gnutlsSession;
#endif // LIBGNUTLS_VERSION #endif // LIBGNUTLS_VERSION

View File

@ -354,7 +354,7 @@ void TLSSocket_GnuTLS::handshake()
} }
int TLSSocket_GnuTLS::gnutlsErrnoFunc(gnutls_transport_ptr trspt) int TLSSocket_GnuTLS::gnutlsErrnoFunc(gnutls_transport_ptr_t trspt)
{ {
TLSSocket_GnuTLS* sok = reinterpret_cast <TLSSocket_GnuTLS*>(trspt); TLSSocket_GnuTLS* sok = reinterpret_cast <TLSSocket_GnuTLS*>(trspt);
return sok->m_errno; return sok->m_errno;
@ -362,7 +362,7 @@ int TLSSocket_GnuTLS::gnutlsErrnoFunc(gnutls_transport_ptr trspt)
ssize_t TLSSocket_GnuTLS::gnutlsPushFunc ssize_t TLSSocket_GnuTLS::gnutlsPushFunc
(gnutls_transport_ptr trspt, const void* data, size_t len) (gnutls_transport_ptr_t trspt, const void* data, size_t len)
{ {
TLSSocket_GnuTLS* sok = reinterpret_cast <TLSSocket_GnuTLS*>(trspt); TLSSocket_GnuTLS* sok = reinterpret_cast <TLSSocket_GnuTLS*>(trspt);
@ -392,7 +392,7 @@ ssize_t TLSSocket_GnuTLS::gnutlsPushFunc
ssize_t TLSSocket_GnuTLS::gnutlsPullFunc ssize_t TLSSocket_GnuTLS::gnutlsPullFunc
(gnutls_transport_ptr trspt, void* data, size_t len) (gnutls_transport_ptr_t trspt, void* data, size_t len)
{ {
TLSSocket_GnuTLS* sok = reinterpret_cast <TLSSocket_GnuTLS*>(trspt); TLSSocket_GnuTLS* sok = reinterpret_cast <TLSSocket_GnuTLS*>(trspt);
@ -427,14 +427,14 @@ shared_ptr <security::cert::certificateChain> TLSSocket_GnuTLS::getPeerCertifica
getTracer()->traceSend("Getting peer certificates"); getTracer()->traceSend("Getting peer certificates");
unsigned int certCount = 0; unsigned int certCount = 0;
const gnutls_datum* rawData = gnutls_certificate_get_peers const gnutls_datum_t* rawData = gnutls_certificate_get_peers
(*m_session->m_gnutlsSession, &certCount); (*m_session->m_gnutlsSession, &certCount);
if (rawData == NULL) if (rawData == NULL)
return null; return null;
// Try X.509 // Try X.509
gnutls_x509_crt* x509Certs = new gnutls_x509_crt[certCount]; gnutls_x509_crt_t* x509Certs = new gnutls_x509_crt_t[certCount];
for (unsigned int i = 0; i < certCount; ++i) for (unsigned int i = 0; i < certCount; ++i)
{ {

View File

@ -91,9 +91,9 @@ private:
void internalThrow(); void internalThrow();
#ifdef LIBGNUTLS_VERSION #ifdef LIBGNUTLS_VERSION
static ssize_t gnutlsPushFunc(gnutls_transport_ptr trspt, const void* data, size_t len); static ssize_t gnutlsPushFunc(gnutls_transport_ptr_t trspt, const void* data, size_t len);
static ssize_t gnutlsPullFunc(gnutls_transport_ptr trspt, void* data, size_t len); static ssize_t gnutlsPullFunc(gnutls_transport_ptr_t trspt, void* data, size_t len);
static int gnutlsErrnoFunc(gnutls_transport_ptr trspt); static int gnutlsErrnoFunc(gnutls_transport_ptr_t trspt);
#else #else
static int gnutlsPushFunc(void* trspt, const void* data, size_t len); static int gnutlsPushFunc(void* trspt, const void* data, size_t len);
static int gnutlsPullFunc(void* trspt, void* data, size_t len); static int gnutlsPullFunc(void* trspt, void* data, size_t len);

View File

@ -57,7 +57,7 @@ struct GnuTLSX509CertificateInternalData
} }
gnutls_x509_crt cert; gnutls_x509_crt_t cert;
}; };
#endif // VMIME_BUILDING_DOC #endif // VMIME_BUILDING_DOC
@ -108,7 +108,7 @@ shared_ptr <X509Certificate> X509Certificate::import(utility::inputStream& is)
shared_ptr <X509Certificate> X509Certificate::import shared_ptr <X509Certificate> X509Certificate::import
(const byte_t* data, const size_t length) (const byte_t* data, const size_t length)
{ {
gnutls_datum buffer; gnutls_datum_t buffer;
buffer.data = const_cast <byte_t*>(data); buffer.data = const_cast <byte_t*>(data);
buffer.size = static_cast <unsigned int>(length); buffer.size = static_cast <unsigned int>(length);
@ -132,7 +132,7 @@ void X509Certificate_GnuTLS::write
(utility::outputStream& os, const Format format) const (utility::outputStream& os, const Format format) const
{ {
size_t dataSize = 0; size_t dataSize = 0;
gnutls_x509_crt_fmt fmt = GNUTLS_X509_FMT_DER; gnutls_x509_crt_fmt_t fmt = GNUTLS_X509_FMT_DER;
switch (format) switch (format)
{ {
@ -236,7 +236,7 @@ const datetime X509Certificate_GnuTLS::getExpirationDate() const
const byteArray X509Certificate_GnuTLS::getFingerprint(const DigestAlgorithm algo) const const byteArray X509Certificate_GnuTLS::getFingerprint(const DigestAlgorithm algo) const
{ {
gnutls_digest_algorithm galgo; gnutls_digest_algorithm_t galgo;
switch (algo) switch (algo)
{ {