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
gnutls_anon_client_credentials anonCred;
gnutls_certificate_credentials certCred;
gnutls_anon_client_credentials_t anonCred;
gnutls_certificate_credentials_t certCred;
};
static TLSGlobal g_gnutlsGlobal;
@ -145,7 +145,7 @@ TLSSession_GnuTLS::TLSSession_GnuTLS(shared_ptr <security::cert::certificateVeri
{
int res;
m_gnutlsSession = new gnutls_session;
m_gnutlsSession = new gnutls_session_t;
if (gnutls_init(m_gnutlsSession, GNUTLS_CLIENT) != 0)
throw std::bad_alloc();

View File

@ -68,7 +68,7 @@ private:
#ifdef LIBGNUTLS_VERSION
gnutls_session* m_gnutlsSession;
gnutls_session_t* m_gnutlsSession;
#else
void* m_gnutlsSession;
#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);
return sok->m_errno;
@ -362,7 +362,7 @@ int TLSSocket_GnuTLS::gnutlsErrnoFunc(gnutls_transport_ptr trspt)
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);
@ -392,7 +392,7 @@ ssize_t TLSSocket_GnuTLS::gnutlsPushFunc
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);
@ -427,14 +427,14 @@ shared_ptr <security::cert::certificateChain> TLSSocket_GnuTLS::getPeerCertifica
getTracer()->traceSend("Getting peer certificates");
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);
if (rawData == NULL)
return null;
// 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)
{

View File

@ -91,9 +91,9 @@ private:
void internalThrow();
#ifdef LIBGNUTLS_VERSION
static ssize_t gnutlsPushFunc(gnutls_transport_ptr trspt, const void* data, size_t len);
static ssize_t gnutlsPullFunc(gnutls_transport_ptr trspt, void* data, size_t len);
static int gnutlsErrnoFunc(gnutls_transport_ptr trspt);
static ssize_t gnutlsPushFunc(gnutls_transport_ptr_t trspt, const 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_t trspt);
#else
static int gnutlsPushFunc(void* trspt, const 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
@ -108,7 +108,7 @@ shared_ptr <X509Certificate> X509Certificate::import(utility::inputStream& is)
shared_ptr <X509Certificate> X509Certificate::import
(const byte_t* data, const size_t length)
{
gnutls_datum buffer;
gnutls_datum_t buffer;
buffer.data = const_cast <byte_t*>(data);
buffer.size = static_cast <unsigned int>(length);
@ -132,7 +132,7 @@ void X509Certificate_GnuTLS::write
(utility::outputStream& os, const Format format) const
{
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)
{
@ -203,15 +203,15 @@ bool X509Certificate_GnuTLS::verifyHostName
dnsNameLength = sizeof(dnsName);
if (gnutls_x509_crt_get_dn_by_oid(m_data->cert, OID_X520_COMMON_NAME, 0, 0, dnsName, &dnsNameLength) >= 0)
if (gnutls_x509_crt_get_dn_by_oid(m_data->cert, OID_X520_COMMON_NAME, 0, 0, dnsName, &dnsNameLength) >= 0)
nonMatchingNames->push_back(dnsName);
for (int i = 0, ret = 0 ; ret >= 0 ; ++i)
for (int i = 0, ret = 0 ; ret >= 0 ; ++i)
{
dnsNameLength = sizeof(dnsName);
ret = gnutls_x509_crt_get_subject_alt_name(m_data->cert, i, dnsName, &dnsNameLength, NULL);
if (ret == GNUTLS_SAN_DNSNAME)
if (ret == GNUTLS_SAN_DNSNAME)
nonMatchingNames->push_back(dnsName);
}
}
@ -236,7 +236,7 @@ const datetime X509Certificate_GnuTLS::getExpirationDate() const
const byteArray X509Certificate_GnuTLS::getFingerprint(const DigestAlgorithm algo) const
{
gnutls_digest_algorithm galgo;
gnutls_digest_algorithm_t galgo;
switch (algo)
{