Ticket #25628: kdelibs-3.5.10-ossl-1.x.patch

File kdelibs-3.5.10-ossl-1.x.patch, 7.0 KB (added by macports.org@…, 14 years ago)

KDELibs ASN1_METHOD patch

  • kdelibs-3.5.10/kio/kssl/kopenssl.cc

    diff -up kdelibs-3.5.10/kio/kssl/kopenssl.cc.ossl-1.x kdelibs-3.5.10/kio/kssl/kopenssl.cc
    old new static int (*K_BIO_write) (BIO *b, cons 
    9696static int (*K_PEM_ASN1_write_bio) (int (*)(),const char *,BIO *,char *,
    9797                                   const EVP_CIPHER *,unsigned char *,int ,
    9898                                            pem_password_cb *, void *) = 0L;
     99#if OPENSSL_VERSION_NUMBER >= 0x10000000L
     100static int (*K_ASN1_item_i2d_fp)(ASN1_ITEM *,FILE *,unsigned char *) = 0L;
     101static ASN1_ITEM *K_NETSCAPE_X509_it = 0L;
     102#else
    99103static ASN1_METHOD* (*K_X509_asn1_meth) (void) = 0L;
    100104static int (*K_ASN1_i2d_fp)(int (*)(),FILE *,unsigned char *) = 0L;
    101105static int (*K_i2d_ASN1_HEADER)(ASN1_HEADER *, unsigned char **) = 0L;
     106#endif
    102107static int (*K_X509_print_fp)  (FILE *, X509*) = 0L;
    103108static int (*K_i2d_PKCS12)  (PKCS12*, unsigned char**) = 0L;
    104109static int (*K_i2d_PKCS12_fp)  (FILE *, PKCS12*) = 0L;
    KConfig *cfg; 
    430435      K_BIO_ctrl = (long (*) (BIO *,int,long,void *)) _cryptoLib->symbol("BIO_ctrl");
    431436      K_BIO_write = (int (*) (BIO *b, const void *data, int len)) _cryptoLib->symbol("BIO_write");
    432437      K_PEM_ASN1_write_bio = (int (*)(int (*)(), const char *,BIO*, char*, const EVP_CIPHER *, unsigned char *, int, pem_password_cb *, void *)) _cryptoLib->symbol("PEM_ASN1_write_bio");
     438#if OPENSSL_VERSION_NUMBER >= 0x10000000L
     439      K_ASN1_item_i2d_fp = (int (*)(ASN1_ITEM *, FILE*, unsigned char *)) _cryptoLib->symbol("ASN1_item_i2d_fp");
     440      K_NETSCAPE_X509_it = (ASN1_ITEM *) _cryptoLib->symbol("NETSCAPE_X509_it");
     441#else
    433442      K_X509_asn1_meth = (ASN1_METHOD* (*)(void)) _cryptoLib->symbol("X509_asn1_meth");
    434443      K_ASN1_i2d_fp = (int (*)(int (*)(), FILE*, unsigned char *)) _cryptoLib->symbol("ASN1_i2d_fp");
    435444      K_i2d_ASN1_HEADER = (int (*)(ASN1_HEADER *, unsigned char **)) _cryptoLib->symbol("i2d_ASN1_HEADER");
     445#endif
    436446      K_X509_print_fp = (int (*)(FILE*, X509*)) _cryptoLib->symbol("X509_print_fp");
    437447      K_i2d_PKCS12 = (int (*)(PKCS12*, unsigned char**)) _cryptoLib->symbol("i2d_PKCS12");
    438448      K_i2d_PKCS12_fp = (int (*)(FILE *, PKCS12*)) _cryptoLib->symbol("i2d_PKCS12_fp");
    KConfig *cfg; 
    594604      K_SSL_set_session = (int (*)(SSL*,SSL_SESSION*)) _sslLib->symbol("SSL_set_session");
    595605      K_d2i_SSL_SESSION = (SSL_SESSION* (*)(SSL_SESSION**,unsigned char**, long)) _sslLib->symbol("d2i_SSL_SESSION");
    596606      K_i2d_SSL_SESSION = (int (*)(SSL_SESSION*,unsigned char**)) _sslLib->symbol("i2d_SSL_SESSION");
    597       K_SSL_get_ciphers = (STACK *(*)(const SSL*)) _sslLib->symbol("SSL_get_ciphers");
     607      K_SSL_get_ciphers = (STACK_OF(SSL_CIPHER) *(*)(const SSL*)) _sslLib->symbol("SSL_get_ciphers");
    598608#endif
    599609
    600610
    int KOpenSSLProxy::PEM_write_bio_X509(BI 
    982992   else return -1;
    983993}
    984994
    985 
     995#if OPENSSL_VERSION_NUMBER >= 0x10000000L
     996int KOpenSSLProxy::ASN1_i2d_fp(FILE *out,unsigned char *x) {
     997   if (K_ASN1_item_i2d_fp && K_NETSCAPE_X509_it)
     998        return (K_ASN1_item_i2d_fp)(K_NETSCAPE_X509_it, out, x);
     999   else return -1;
     1000}
     1001#else
    9861002ASN1_METHOD *KOpenSSLProxy::X509_asn1_meth(void) {
    9871003   if (K_X509_asn1_meth) return (K_X509_asn1_meth)();
    9881004   else return 0L;
    int KOpenSSLProxy::ASN1_i2d_fp(FILE *out 
    9941010        return (K_ASN1_i2d_fp)((int (*)())K_i2d_ASN1_HEADER, out, x);
    9951011   else return -1;
    9961012}
    997 
     1013#endif
    9981014
    9991015int KOpenSSLProxy::X509_print(FILE *fp, X509 *x) {
    10001016   if (K_X509_print_fp) return (K_X509_print_fp)(fp, x);
  • kdelibs-3.5.10/kio/kssl/kopenssl.h

    diff -up kdelibs-3.5.10/kio/kssl/kopenssl.h.ossl-1.x kdelibs-3.5.10/kio/kssl/kopenssl.h
    old new class KOpenSSLProxyPrivate; 
    4848#include <openssl/stack.h>
    4949#include <openssl/bn.h>
    5050#undef crypt
     51#if OPENSSL_VERSION_NUMBER >= 0x10000000L
     52#define STACK _STACK
     53#endif
    5154#endif
    5255
    5356#include <kstaticdeleter.h>
    public: 
    446449    */
    447450   int PEM_write_bio_X509(BIO *bp, X509 *x);
    448451
    449 
     452#if OPENSSL_VERSION_NUMBER < 0x10000000L
    450453   /*
    451454    *   X509_asn1_meth - used for netscape output
    452455    */
    453456   ASN1_METHOD *X509_asn1_meth();
    454 
     457#endif
    455458
    456459   /*
    457460    *   ASN1_i2d_fp - used for netscape output
    public: 
    531534    */
    532535   void sk_free(STACK *s);
    533536
     537#if OPENSSL_VERSION_NUMBER >= 0x10000000L
     538   void sk_free(void *s) { return sk_free(reinterpret_cast<STACK*>(s)); }
     539#endif
    534540
    535541   /*
    536542    *  Number of elements in the stack
    public: 
    543549    */
    544550   char *sk_value(STACK *s, int n);
    545551
     552#if OPENSSL_VERSION_NUMBER >= 0x10000000L
     553   char *sk_value(void *s, int n) { return sk_value(reinterpret_cast<STACK*>(s), n); }
     554#endif
    546555
    547556   /*
    548557    *  Create a new stack
    public: 
    555564    */
    556565   int sk_push(STACK *s, char *d);
    557566
     567#if OPENSSL_VERSION_NUMBER >= 0x10000000L
     568   int sk_push(void *s, void *d) { return sk_push(reinterpret_cast<STACK*>(s), reinterpret_cast<char*>(d)); }
     569#endif
    558570
    559571   /*
    560572    *  Duplicate the stack
  • kdelibs-3.5.10/kio/kssl/ksmimecrypto.cc

    diff -up kdelibs-3.5.10/kio/kssl/ksmimecrypto.cc.ossl-1.x kdelibs-3.5.10/kio/kssl/ksmimecrypto.cc
    old new KSMIMECryptoPrivate::KSMIMECryptoPrivate 
    8787
    8888
    8989STACK_OF(X509) *KSMIMECryptoPrivate::certsToX509(QPtrList<KSSLCertificate> &certs) {
    90     STACK_OF(X509) *x509 = sk_new(NULL);
     90    STACK_OF(X509) *x509 = reinterpret_cast<STACK_OF(X509)*>(sk_new(NULL));
    9191    KSSLCertificate *cert = certs.first();
    9292    while(cert) {
    9393        sk_X509_push(x509, cert->getCert());
  • kdelibs-3.5.10/kio/kssl/ksslcertificate.cc

    diff -up kdelibs-3.5.10/kio/kssl/ksslcertificate.cc.ossl-1.x kdelibs-3.5.10/kio/kssl/ksslcertificate.cc
    old new return qba; 
    10031003QByteArray KSSLCertificate::toNetscape() {
    10041004QByteArray qba;
    10051005#ifdef KSSL_HAVE_SSL
    1006 ASN1_HEADER ah;
    1007 ASN1_OCTET_STRING os;
    1008 KTempFile ktf;
     1006#if OPENSSL_VERSION_NUMBER >= 0x10000000L
     1007        NETSCAPE_X509 nx;
     1008        ASN1_OCTET_STRING hdr;
     1009#else
     1010   ASN1_HEADER ah;
     1011   ASN1_OCTET_STRING os;
     1012#endif
     1013        KTempFile ktf;
    10091014
    1010         os.data = (unsigned char *)NETSCAPE_CERT_HDR;
    1011         os.length = strlen(NETSCAPE_CERT_HDR);
    1012         ah.header = &os;
    1013         ah.data = (char *)getCert();
    1014         ah.meth = d->kossl->X509_asn1_meth();
     1015#if OPENSSL_VERSION_NUMBER >= 0x10000000L
     1016        hdr.data = (unsigned char *)NETSCAPE_CERT_HDR;
     1017        hdr.length = strlen(NETSCAPE_CERT_HDR);
     1018        nx.header = &hdr;
     1019        nx.cert = getCert();
     1020
     1021        d->kossl->ASN1_i2d_fp(ktf.fstream(),(unsigned char *)&nx);
     1022#else
     1023   os.data = (unsigned char *)NETSCAPE_CERT_HDR;
     1024   os.length = strlen(NETSCAPE_CERT_HDR);
     1025   ah.header = &os;
     1026   ah.data = (char *)getCert();
     1027   ah.meth = d->kossl->X509_asn1_meth();
    10151028
    1016         d->kossl->ASN1_i2d_fp(ktf.fstream(),(unsigned char *)&ah);
     1029   d->kossl->ASN1_i2d_fp(ktf.fstream(),(unsigned char *)&ah);
     1030#endif
    10171031
    10181032        ktf.close();
    10191033