]> git.pld-linux.org Git - packages/kdelibs.git/blob - kdelibs-3.5.10-ossl-1.x.patch
- release 24
[packages/kdelibs.git] / kdelibs-3.5.10-ossl-1.x.patch
1 diff -up kdelibs-3.5.10/kio/kssl/kopenssl.cc.ossl-1.x kdelibs-3.5.10/kio/kssl/kopenssl.cc
2 --- kdelibs-3.5.10/kio/kssl/kopenssl.cc.ossl-1.x        2009-09-04 23:10:53.000000000 +0200
3 +++ kdelibs-3.5.10/kio/kssl/kopenssl.cc 2009-09-04 23:10:53.000000000 +0200
4 @@ -96,9 +96,14 @@ static int  (*K_BIO_write) (BIO *b, cons
5  static int (*K_PEM_ASN1_write_bio) (int (*)(),const char *,BIO *,char *,
6                                     const EVP_CIPHER *,unsigned char *,int ,
7                                              pem_password_cb *, void *) = 0L;
8 +#if OPENSSL_VERSION_NUMBER >= 0x10000000L
9 +static int (*K_ASN1_item_i2d_fp)(ASN1_ITEM *,FILE *,unsigned char *) = 0L;
10 +static ASN1_ITEM *K_NETSCAPE_X509_it = 0L;
11 +#else
12  static ASN1_METHOD* (*K_X509_asn1_meth) (void) = 0L;
13  static int (*K_ASN1_i2d_fp)(int (*)(),FILE *,unsigned char *) = 0L;
14  static int (*K_i2d_ASN1_HEADER)(ASN1_HEADER *, unsigned char **) = 0L;
15 +#endif
16  static int (*K_X509_print_fp)  (FILE *, X509*) = 0L;
17  static int (*K_i2d_PKCS12)  (PKCS12*, unsigned char**) = 0L;
18  static int (*K_i2d_PKCS12_fp)  (FILE *, PKCS12*) = 0L;
19 @@ -430,9 +435,14 @@ KConfig *cfg;
20        K_BIO_ctrl = (long (*) (BIO *,int,long,void *)) _cryptoLib->symbol("BIO_ctrl");
21        K_BIO_write = (int (*) (BIO *b, const void *data, int len)) _cryptoLib->symbol("BIO_write");
22        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");
23 +#if OPENSSL_VERSION_NUMBER >= 0x10000000L
24 +      K_ASN1_item_i2d_fp = (int (*)(ASN1_ITEM *, FILE*, unsigned char *)) _cryptoLib->symbol("ASN1_item_i2d_fp");
25 +      K_NETSCAPE_X509_it = (ASN1_ITEM *) _cryptoLib->symbol("NETSCAPE_X509_it");
26 +#else
27        K_X509_asn1_meth = (ASN1_METHOD* (*)(void)) _cryptoLib->symbol("X509_asn1_meth");
28        K_ASN1_i2d_fp = (int (*)(int (*)(), FILE*, unsigned char *)) _cryptoLib->symbol("ASN1_i2d_fp");
29        K_i2d_ASN1_HEADER = (int (*)(ASN1_HEADER *, unsigned char **)) _cryptoLib->symbol("i2d_ASN1_HEADER");
30 +#endif
31        K_X509_print_fp = (int (*)(FILE*, X509*)) _cryptoLib->symbol("X509_print_fp");
32        K_i2d_PKCS12 = (int (*)(PKCS12*, unsigned char**)) _cryptoLib->symbol("i2d_PKCS12");
33        K_i2d_PKCS12_fp = (int (*)(FILE *, PKCS12*)) _cryptoLib->symbol("i2d_PKCS12_fp");
34 @@ -594,7 +604,7 @@ KConfig *cfg;
35        K_SSL_set_session = (int (*)(SSL*,SSL_SESSION*)) _sslLib->symbol("SSL_set_session");
36        K_d2i_SSL_SESSION = (SSL_SESSION* (*)(SSL_SESSION**,unsigned char**, long)) _sslLib->symbol("d2i_SSL_SESSION");
37        K_i2d_SSL_SESSION = (int (*)(SSL_SESSION*,unsigned char**)) _sslLib->symbol("i2d_SSL_SESSION");
38 -      K_SSL_get_ciphers = (STACK *(*)(const SSL*)) _sslLib->symbol("SSL_get_ciphers");
39 +      K_SSL_get_ciphers = (STACK_OF(SSL_CIPHER) *(*)(const SSL*)) _sslLib->symbol("SSL_get_ciphers");
40  #endif
41  
42  
43 @@ -982,7 +992,13 @@ int KOpenSSLProxy::PEM_write_bio_X509(BI
44     else return -1;
45  }
46  
47 -
48 +#if OPENSSL_VERSION_NUMBER >= 0x10000000L
49 +int KOpenSSLProxy::ASN1_i2d_fp(FILE *out,unsigned char *x) {
50 +   if (K_ASN1_item_i2d_fp && K_NETSCAPE_X509_it)
51 +        return (K_ASN1_item_i2d_fp)(K_NETSCAPE_X509_it, out, x);
52 +   else return -1;
53 +}
54 +#else
55  ASN1_METHOD *KOpenSSLProxy::X509_asn1_meth(void) {
56     if (K_X509_asn1_meth) return (K_X509_asn1_meth)();
57     else return 0L;
58 @@ -994,7 +1010,7 @@ int KOpenSSLProxy::ASN1_i2d_fp(FILE *out
59          return (K_ASN1_i2d_fp)((int (*)())K_i2d_ASN1_HEADER, out, x);
60     else return -1;
61  }
62 -
63 +#endif
64  
65  int KOpenSSLProxy::X509_print(FILE *fp, X509 *x) {
66     if (K_X509_print_fp) return (K_X509_print_fp)(fp, x);
67 diff -up kdelibs-3.5.10/kio/kssl/kopenssl.h.ossl-1.x kdelibs-3.5.10/kio/kssl/kopenssl.h
68 --- kdelibs-3.5.10/kio/kssl/kopenssl.h.ossl-1.x 2006-07-22 10:16:39.000000000 +0200
69 +++ kdelibs-3.5.10/kio/kssl/kopenssl.h  2009-09-04 23:10:53.000000000 +0200
70 @@ -48,6 +48,9 @@ class KOpenSSLProxyPrivate;
71  #include <openssl/stack.h>
72  #include <openssl/bn.h>
73  #undef crypt
74 +#if OPENSSL_VERSION_NUMBER >= 0x10000000L
75 +#define STACK _STACK
76 +#endif
77  #endif
78  
79  #include <kstaticdeleter.h>
80 @@ -446,12 +449,12 @@ public:
81      */
82     int PEM_write_bio_X509(BIO *bp, X509 *x);
83  
84 -
85 +#if OPENSSL_VERSION_NUMBER < 0x10000000L
86     /*
87      *   X509_asn1_meth - used for netscape output
88      */
89     ASN1_METHOD *X509_asn1_meth();
90 -
91 +#endif
92  
93     /*
94      *   ASN1_i2d_fp - used for netscape output
95 @@ -531,6 +534,9 @@ public:
96      */
97     void sk_free(STACK *s);
98  
99 +#if OPENSSL_VERSION_NUMBER >= 0x10000000L
100 +   void sk_free(void *s) { return sk_free(reinterpret_cast<STACK*>(s)); }
101 +#endif
102  
103     /* 
104      *  Number of elements in the stack
105 @@ -543,6 +549,9 @@ public:
106      */
107     char *sk_value(STACK *s, int n);
108  
109 +#if OPENSSL_VERSION_NUMBER >= 0x10000000L
110 +   char *sk_value(void *s, int n) { return sk_value(reinterpret_cast<STACK*>(s), n); }
111 +#endif
112  
113     /* 
114      *  Create a new stack
115 @@ -555,6 +564,9 @@ public:
116      */
117     int sk_push(STACK *s, char *d);
118  
119 +#if OPENSSL_VERSION_NUMBER >= 0x10000000L
120 +   int sk_push(void *s, void *d) { return sk_push(reinterpret_cast<STACK*>(s), reinterpret_cast<char*>(d)); }
121 +#endif
122  
123     /* 
124      *  Duplicate the stack
125 diff -up kdelibs-3.5.10/kio/kssl/ksmimecrypto.cc.ossl-1.x kdelibs-3.5.10/kio/kssl/ksmimecrypto.cc
126 --- kdelibs-3.5.10/kio/kssl/ksmimecrypto.cc.ossl-1.x    2005-10-10 17:05:44.000000000 +0200
127 +++ kdelibs-3.5.10/kio/kssl/ksmimecrypto.cc     2009-09-04 23:10:53.000000000 +0200
128 @@ -87,7 +87,7 @@ KSMIMECryptoPrivate::KSMIMECryptoPrivate
129  
130  
131  STACK_OF(X509) *KSMIMECryptoPrivate::certsToX509(QPtrList<KSSLCertificate> &certs) {
132 -    STACK_OF(X509) *x509 = sk_new(NULL);
133 +    STACK_OF(X509) *x509 = reinterpret_cast<STACK_OF(X509)*>(sk_new(NULL));
134      KSSLCertificate *cert = certs.first();
135      while(cert) {
136         sk_X509_push(x509, cert->getCert());
137 diff -up kdelibs-3.5.10/kio/kssl/ksslcertificate.cc.ossl-1.x kdelibs-3.5.10/kio/kssl/ksslcertificate.cc
138 --- kdelibs-3.5.10/kio/kssl/ksslcertificate.cc.ossl-1.x 2006-01-19 18:06:12.000000000 +0100
139 +++ kdelibs-3.5.10/kio/kssl/ksslcertificate.cc  2009-09-04 23:10:53.000000000 +0200
140 @@ -1003,17 +1003,31 @@ return qba;
141  QByteArray KSSLCertificate::toNetscape() {
142  QByteArray qba;
143  #ifdef KSSL_HAVE_SSL
144 -ASN1_HEADER ah;
145 -ASN1_OCTET_STRING os;
146 -KTempFile ktf;
147 +#if OPENSSL_VERSION_NUMBER >= 0x10000000L
148 +       NETSCAPE_X509 nx;
149 +       ASN1_OCTET_STRING hdr;
150 +#else
151 +   ASN1_HEADER ah;
152 +   ASN1_OCTET_STRING os;
153 +#endif
154 +       KTempFile ktf;
155  
156 -       os.data = (unsigned char *)NETSCAPE_CERT_HDR;
157 -       os.length = strlen(NETSCAPE_CERT_HDR);
158 -       ah.header = &os;
159 -       ah.data = (char *)getCert();
160 -       ah.meth = d->kossl->X509_asn1_meth();
161 +#if OPENSSL_VERSION_NUMBER >= 0x10000000L
162 +       hdr.data = (unsigned char *)NETSCAPE_CERT_HDR;
163 +       hdr.length = strlen(NETSCAPE_CERT_HDR);
164 +       nx.header = &hdr;
165 +       nx.cert = getCert();
166 +
167 +       d->kossl->ASN1_i2d_fp(ktf.fstream(),(unsigned char *)&nx);
168 +#else
169 +   os.data = (unsigned char *)NETSCAPE_CERT_HDR;
170 +   os.length = strlen(NETSCAPE_CERT_HDR);
171 +   ah.header = &os;
172 +   ah.data = (char *)getCert();
173 +   ah.meth = d->kossl->X509_asn1_meth();
174  
175 -       d->kossl->ASN1_i2d_fp(ktf.fstream(),(unsigned char *)&ah);
176 +   d->kossl->ASN1_i2d_fp(ktf.fstream(),(unsigned char *)&ah);
177 +#endif
178  
179         ktf.close();
180  
This page took 0.045747 seconds and 3 git commands to generate.