diff options
Diffstat (limited to 'kio/kssl/ksmimecrypto.cc')
-rw-r--r-- | kio/kssl/ksmimecrypto.cc | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/kio/kssl/ksmimecrypto.cc b/kio/kssl/ksmimecrypto.cc index 1a9e37e60..92318b9f0 100644 --- a/kio/kssl/ksmimecrypto.cc +++ b/kio/kssl/ksmimecrypto.cc @@ -38,15 +38,6 @@ #endif -// forward included macros to KOpenSSLProxy -#define sk_new kossl->sk_new -#define sk_free kossl->sk_free -#define sk_push kossl->sk_push -#define sk_value kossl->sk_value -#define sk_num kossl->sk_num -#define BIO_ctrl kossl->BIO_ctrl - - #ifdef KSSL_HAVE_SSL static const char eot = 0; @@ -87,10 +78,10 @@ KSMIMECryptoPrivate::KSMIMECryptoPrivate(KOpenSSLProxy *kossl): kossl(kossl) { STACK_OF(X509) *KSMIMECryptoPrivate::certsToX509(TQPtrList<KSSLCertificate> &certs) { - STACK_OF(X509) *x509 = reinterpret_cast<STACK_OF(X509)*>(sk_new(NULL)); + STACK_OF(X509) *x509 = reinterpret_cast<STACK_OF(X509)*>(kossl->OPENSSL_sk_new(NULL)); KSSLCertificate *cert = certs.first(); while(cert) { - sk_X509_push(x509, cert->getCert()); + kossl->OPENSSL_sk_push(x509, cert->getCert()); cert = certs.next(); } return x509; @@ -111,7 +102,7 @@ KSMIMECrypto::rc KSMIMECryptoPrivate::signMessage(BIO *clearText, PKCS7 *p7 = kossl->PKCS7_sign(privKey.getCertificate()->getCert(), privKey.getPrivateKey(), other, clearText, flags); - if (other) sk_X509_free(other); + if (other) kossl->OPENSSL_sk_free(other); if (!p7) return sslErrToRc(); @@ -154,7 +145,7 @@ KSMIMECrypto::rc KSMIMECryptoPrivate::encryptMessage(BIO *clearText, PKCS7 *p7 = kossl->PKCS7_encrypt(certs, clearText, cipher, 0); - sk_X509_free(certs); + kossl->OPENSSL_sk_free(certs); if (!p7) return sslErrToRc(); @@ -192,14 +183,14 @@ KSMIMECrypto::rc KSMIMECryptoPrivate::checkSignature(BIO *clearText, X509_STORE *dummystore = kossl->X509_STORE_new(); if (kossl->PKCS7_verify(p7, NULL, dummystore, in, out, PKCS7_NOVERIFY)) { STACK_OF(X509) *signers = kossl->PKCS7_get0_signers(p7, 0, PKCS7_NOVERIFY); - int num = sk_X509_num(signers); + int num = kossl->OPENSSL_sk_num(signers); for(int n=0; n<num; n++) { - KSSLCertificate *signer = KSSLCertificate::fromX509(sk_X509_value(signers, n)); + KSSLCertificate *signer = KSSLCertificate::fromX509(reinterpret_cast<X509*>(kossl->OPENSSL_sk_value(signers, n))); recip.append(signer); } - sk_X509_free(signers); + kossl->OPENSSL_sk_free(signers); rc = KSMIMECrypto::KSC_R_OK; } else { rc = sslErrToRc(); @@ -236,13 +227,14 @@ KSMIMECrypto::rc KSMIMECryptoPrivate::decryptMessage(BIO *cipherText, void KSMIMECryptoPrivate::MemBIOToQByteArray(BIO *src, TQByteArray &dest) { char *buf; - long len = BIO_get_mem_data(src, &buf); + long len = kossl->BIO_get_mem_data(src, &buf); dest.assign(buf, len); /* Now this goes quite a bit into openssl internals. We assume that openssl uses malloc() (it does in default config) and rip out the buffer. */ - reinterpret_cast<BUF_MEM *>(src->ptr)->data = NULL; + void *ptr = kossl->BIO_get_data(src); + reinterpret_cast<BUF_MEM *>(ptr)->data = NULL; } @@ -422,3 +414,4 @@ KSMIMECrypto::rc KSMIMECrypto::decryptMessage(const TQByteArray &cipherText, return KSC_R_NO_SSL; #endif } + |