fixes build with ancient openssl

Sat, 04 Feb 2017 14:03:32 +0100

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sat, 04 Feb 2017 14:03:32 +0100
changeset 261
f60d742a62a0
parent 260
26f5f817429e
child 262
e2579b63595a

fixes build with ancient openssl

dav/db.c file | annotate | diff | comparison | revisions
libidav/crypto.c file | annotate | diff | comparison | revisions
libidav/resource.c file | annotate | diff | comparison | revisions
--- a/dav/db.c	Sat Feb 04 12:41:11 2017 +0100
+++ b/dav/db.c	Sat Feb 04 14:03:32 2017 +0100
@@ -279,7 +279,7 @@
         }
         
         if(res->skipped) {
-            r = xmlTextWriterStartElement(writer, "skipped");
+            r = xmlTextWriterStartElement(writer, BAD_CAST "skipped");
             r += xmlTextWriterEndElement(writer);
             if(r < 0) {
                 fprintf(stderr, "Cannot write skipped\n");
--- a/libidav/crypto.c	Sat Feb 04 12:41:11 2017 +0100
+++ b/libidav/crypto.c	Sat Feb 04 14:03:32 2017 +0100
@@ -34,6 +34,24 @@
 #include <libidav/utils.h>
 #include "crypto.h"
 
+#if OPENSSL_VERSION_NUMBER < 10000000
+
+static EVP_CIPHER_CTX* create_evp_cipher_ctx() {
+    EVP_CIPHER_CTX *ctx = malloc(sizeof(EVP_CIPHER_CTX));
+    EVP_CIPHER_CTX_init(ctx);
+    return ctx;
+}
+
+static void free_evp_cipher_ctx(EVP_CIPHER_CTX *ctx) {
+    EVP_CIPHER_CTX_cleanup(ctx);
+    free(ctx);
+}
+
+#define EVP_CIPHER_CTX_new() create_evp_cipher_ctx()
+#define EVP_CIPHER_CTX_free(ctx) free_evp_cipher_ctx(ctx)
+
+#endif
+
 AESDecrypter* aes_decrypter_new(DavKey *key, void *stream, dav_write_func write_func) {
     AESDecrypter *dec = calloc(1, sizeof(AESDecrypter));
     SHA256_Init(&dec->sha256);
--- a/libidav/resource.c	Sat Feb 04 12:41:11 2017 +0100
+++ b/libidav/resource.c	Sat Feb 04 14:03:32 2017 +0100
@@ -1022,7 +1022,6 @@
     curl_easy_getinfo (handle, CURLINFO_RESPONSE_CODE, &status);
     if(ret == CURLE_OK && (status >= 200 && status < 300)) {
         dav_remove_lock(sn, res->path, lock);
-        return 0;
     } else {
         dav_session_set_error(sn, ret, status);
         return 1;

mercurial