Hello community, here is the log from the commit of package s3backer for openSUSE:Factory checked in at 2016-07-27 16:13:11 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/s3backer (Old) and /work/SRC/openSUSE:Factory/.s3backer.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "s3backer" Changes: -------- --- /work/SRC/openSUSE:Factory/s3backer/s3backer.changes 2015-09-09 20:21:09.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.s3backer.new/s3backer.changes 2016-07-27 16:13:19.000000000 +0200 @@ -1,0 +2,8 @@ +Mon Jul 25 18:59:39 UTC 2016 - [email protected] + +- Update to release 1.4.3 + + Add support for STANDARD_IA storage class (issue #59) + + Set "Accept-Encoding" header appropriately (issue #48) + + Fix build issue with OpenSSL 1.1.0 (issue #64) + +------------------------------------------------------------------- Old: ---- s3backer-1.4.2.tar.gz New: ---- s3backer-1.4.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ s3backer.spec ++++++ --- /var/tmp/diff_new_pack.eqXzqL/_old 2016-07-27 16:13:20.000000000 +0200 +++ /var/tmp/diff_new_pack.eqXzqL/_new 2016-07-27 16:13:20.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package s3backer # -# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright 2008 Archie L. Cobbs. # # All modifications and additions to the file contributed by third parties @@ -18,7 +18,7 @@ Name: s3backer -Version: 1.4.2 +Version: 1.4.3 Release: 0 Summary: FUSE-based single file backing store via Amazon S3 License: GPL-2.0+ ++++++ s3backer-1.4.2.tar.gz -> s3backer-1.4.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/s3backer-1.4.2/CHANGES new/s3backer-1.4.3/CHANGES --- old/s3backer-1.4.2/CHANGES 2015-09-01 16:45:24.000000000 +0200 +++ new/s3backer-1.4.3/CHANGES 2016-07-25 20:55:00.000000000 +0200 @@ -1,3 +1,9 @@ +Version 1.4.3 released July 25, 2016 + + - Add support for STANDARD_IA storage class (issue #59) + - Set "Accept-Encoding" header appropriately (issue #48) + - Fix build issue with OpenSSL 1.1.0 (issue #64) + Version 1.4.2 released September 1, 2015 - Update license to fix OpenSSL vs. GPL conflict diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/s3backer-1.4.2/Makefile.am new/s3backer-1.4.3/Makefile.am --- old/s3backer-1.4.2/Makefile.am 2015-09-01 16:45:24.000000000 +0200 +++ new/s3backer-1.4.3/Makefile.am 2016-07-22 22:15:35.000000000 +0200 @@ -70,6 +70,7 @@ reset.c \ s3b_config.c \ test_io.c \ + sslcompat.c \ gitrev.c tester_SOURCES= tester.c \ @@ -83,6 +84,7 @@ reset.c \ s3b_config.c \ test_io.c \ + sslcompat.c \ gitrev.c AM_CFLAGS= $(FUSE_CFLAGS) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/s3backer-1.4.2/Makefile.in new/s3backer-1.4.3/Makefile.in --- old/s3backer-1.4.2/Makefile.in 2015-09-01 16:51:03.000000000 +0200 +++ new/s3backer-1.4.3/Makefile.in 2016-07-25 20:55:35.000000000 +0200 @@ -139,14 +139,14 @@ block_part.$(OBJEXT) dcache.$(OBJEXT) ec_protect.$(OBJEXT) \ erase.$(OBJEXT) fuse_ops.$(OBJEXT) hash.$(OBJEXT) \ http_io.$(OBJEXT) reset.$(OBJEXT) s3b_config.$(OBJEXT) \ - test_io.$(OBJEXT) gitrev.$(OBJEXT) + test_io.$(OBJEXT) sslcompat.$(OBJEXT) gitrev.$(OBJEXT) s3backer_OBJECTS = $(am_s3backer_OBJECTS) s3backer_LDADD = $(LDADD) am_tester_OBJECTS = tester.$(OBJEXT) block_cache.$(OBJEXT) \ block_part.$(OBJEXT) dcache.$(OBJEXT) ec_protect.$(OBJEXT) \ erase.$(OBJEXT) hash.$(OBJEXT) http_io.$(OBJEXT) \ reset.$(OBJEXT) s3b_config.$(OBJEXT) test_io.$(OBJEXT) \ - gitrev.$(OBJEXT) + sslcompat.$(OBJEXT) gitrev.$(OBJEXT) tester_OBJECTS = $(am_tester_OBJECTS) tester_LDADD = $(LDADD) AM_V_P = $(am__v_P_@AM_V@) @@ -375,6 +375,7 @@ reset.c \ s3b_config.c \ test_io.c \ + sslcompat.c \ gitrev.c tester_SOURCES = tester.c \ @@ -388,6 +389,7 @@ reset.c \ s3b_config.c \ test_io.c \ + sslcompat.c \ gitrev.c AM_CFLAGS = $(FUSE_CFLAGS) @@ -519,6 +521,7 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/s3b_config.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sslcompat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_io.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tester.Po@am__quote@ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/s3backer-1.4.2/configure new/s3backer-1.4.3/configure --- old/s3backer-1.4.2/configure 2015-09-01 16:51:03.000000000 +0200 +++ new/s3backer-1.4.3/configure 2016-07-25 20:55:36.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for s3backer FUSE filesystem backed by Amazon S3 1.4.2. +# Generated by GNU Autoconf 2.69 for s3backer FUSE filesystem backed by Amazon S3 1.4.3. # # Report bugs to <https://github.com/archiecobbs/s3backer>. # @@ -580,8 +580,8 @@ # Identity of this package. PACKAGE_NAME='s3backer FUSE filesystem backed by Amazon S3' PACKAGE_TARNAME='s3backer' -PACKAGE_VERSION='1.4.2' -PACKAGE_STRING='s3backer FUSE filesystem backed by Amazon S3 1.4.2' +PACKAGE_VERSION='1.4.3' +PACKAGE_STRING='s3backer FUSE filesystem backed by Amazon S3 1.4.3' PACKAGE_BUGREPORT='https://github.com/archiecobbs/s3backer' PACKAGE_URL='' @@ -1279,7 +1279,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures s3backer FUSE filesystem backed by Amazon S3 1.4.2 to adapt to many kinds of systems. +\`configure' configures s3backer FUSE filesystem backed by Amazon S3 1.4.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1345,7 +1345,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of s3backer FUSE filesystem backed by Amazon S3 1.4.2:";; + short | recursive ) echo "Configuration of s3backer FUSE filesystem backed by Amazon S3 1.4.3:";; esac cat <<\_ACEOF @@ -1446,7 +1446,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -s3backer FUSE filesystem backed by Amazon S3 configure 1.4.2 +s3backer FUSE filesystem backed by Amazon S3 configure 1.4.3 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1794,7 +1794,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by s3backer FUSE filesystem backed by Amazon S3 $as_me 1.4.2, which was +It was created by s3backer FUSE filesystem backed by Amazon S3 $as_me 1.4.3, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2657,7 +2657,7 @@ # Define the identity of the package. PACKAGE='s3backer' - VERSION='1.4.2' + VERSION='1.4.3' cat >>confdefs.h <<_ACEOF @@ -5386,7 +5386,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by s3backer FUSE filesystem backed by Amazon S3 $as_me 1.4.2, which was +This file was extended by s3backer FUSE filesystem backed by Amazon S3 $as_me 1.4.3, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5452,7 +5452,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -s3backer FUSE filesystem backed by Amazon S3 config.status 1.4.2 +s3backer FUSE filesystem backed by Amazon S3 config.status 1.4.3 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/s3backer-1.4.2/configure.ac new/s3backer-1.4.3/configure.ac --- old/s3backer-1.4.2/configure.ac 2015-09-01 16:48:10.000000000 +0200 +++ new/s3backer-1.4.3/configure.ac 2016-07-25 20:55:00.000000000 +0200 @@ -32,7 +32,7 @@ # this exception statement from all source files in the program, then # also delete it here. -AC_INIT([s3backer FUSE filesystem backed by Amazon S3], [1.4.2], [https://github.com/archiecobbs/s3backer], [s3backer]) +AC_INIT([s3backer FUSE filesystem backed by Amazon S3], [1.4.3], [https://github.com/archiecobbs/s3backer], [s3backer]) AC_CONFIG_AUX_DIR(scripts) AM_INIT_AUTOMAKE(foreign) dnl AM_MAINTAINER_MODE diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/s3backer-1.4.2/gitrev.c new/s3backer-1.4.3/gitrev.c --- old/s3backer-1.4.2/gitrev.c 2015-09-01 16:51:09.000000000 +0200 +++ new/s3backer-1.4.3/gitrev.c 2016-07-25 20:55:47.000000000 +0200 @@ -1 +1 @@ -const char *const s3backer_version = "1.4.2"; +const char *const s3backer_version = "1.4.3"; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/s3backer-1.4.2/http_io.c new/s3backer-1.4.3/http_io.c --- old/s3backer-1.4.2/http_io.c 2015-09-01 16:45:24.000000000 +0200 +++ new/s3backer-1.4.3/http_io.c 2016-07-25 20:55:00.000000000 +0200 @@ -51,6 +51,7 @@ #define AUTH_HEADER "Authorization" #define CTYPE_HEADER "Content-Type" #define CONTENT_ENCODING_HEADER "Content-Encoding" +#define ACCEPT_ENCODING_HEADER "Accept-Encoding" #define ETAG_HEADER "ETag" #define CONTENT_ENCODING_DEFLATE "deflate" #define CONTENT_ENCODING_ENCRYPT "encrypt" @@ -58,8 +59,6 @@ #define ACL_HEADER "x-amz-acl" #define CONTENT_SHA256_HEADER "x-amz-content-sha256" #define STORAGE_CLASS_HEADER "x-amz-storage-class" -#define SCLASS_STANDARD "STANDARD" -#define SCLASS_REDUCED_REDUNDANCY "REDUCED_REDUNDANCY" #define FILE_SIZE_HEADER "x-amz-meta-s3backer-filesize" #define BLOCK_SIZE_HEADER "x-amz-meta-s3backer-blocksize" #define HMAC_HEADER "x-amz-meta-s3backer-hmac" @@ -839,6 +838,7 @@ char content[_POSIX_HOST_NAME_MAX + DATE_BUF_SIZE + 32]; u_char md5[MD5_DIGEST_LENGTH]; char md5buf[MD5_DIGEST_LENGTH * 2 + 1]; + const char *storage_class; MD5_CTX ctx; /* Reset I/O info */ @@ -877,8 +877,10 @@ io.headers = http_io_add_header(io.headers, "%s: %s", ACL_HEADER, config->accessType); /* Add storage class header (if needed) */ - if (config->rrs) - io.headers = http_io_add_header(io.headers, "%s: %s", STORAGE_CLASS_HEADER, SCLASS_REDUCED_REDUNDANCY); + storage_class = config->storage_class != NULL ? + config->storage_class : config->rrs ? STORAGE_CLASS_REDUCED_REDUNDANCY : NULL; + if (storage_class != NULL) + io.headers = http_io_add_header(io.headers, "%s: %s", STORAGE_CLASS_HEADER, storage_class); /* Add Authorization header */ if ((r = http_io_add_auth(priv, &io, now, io.src, io.buf_size)) != 0) @@ -1036,6 +1038,7 @@ struct http_io_private *const priv = s3b->data; struct http_io_conf *const config = priv->config; char urlbuf[URL_BUF_SIZE(config)]; + char accepted_encodings[64]; const time_t now = time(NULL); int encrypted = 0; struct http_io io; @@ -1102,6 +1105,14 @@ io.headers = http_io_add_header(io.headers, "%s: \"%s\"", header, md5buf); } + /* Set Accept-Encoding header */ + snprintf(accepted_encodings, sizeof(accepted_encodings), "%s", CONTENT_ENCODING_DEFLATE); + if (config->encryption != NULL) { + snprintf(accepted_encodings + strlen(accepted_encodings), sizeof(accepted_encodings) - strlen(accepted_encodings), + ", %s-%s", CONTENT_ENCODING_ENCRYPT, config->encryption); + } + io.headers = http_io_add_header(io.headers, "%s: %s", ACCEPT_ENCODING_HEADER, accepted_encodings); + /* Add Authorization header */ if ((r = http_io_add_auth(priv, &io, now, NULL, 0)) != 0) goto fail; @@ -1344,6 +1355,7 @@ u_char md5[MD5_DIGEST_LENGTH]; const time_t now = time(NULL); void *encoded_buf = NULL; + const char *storage_class; struct http_io io; int compressed = 0; int encrypted = 0; @@ -1513,8 +1525,9 @@ io.headers = http_io_add_header(io.headers, "%s: \"%s\"", HMAC_HEADER, hmacbuf); /* Add storage class header (if needed) */ - if (config->rrs) - io.headers = http_io_add_header(io.headers, "%s: %s", STORAGE_CLASS_HEADER, SCLASS_REDUCED_REDUNDANCY); + storage_class = config->storage_class != NULL ? config->storage_class : config->rrs ? STORAGE_CLASS_REDUCED_REDUNDANCY : NULL; + if (storage_class != NULL) + io.headers = http_io_add_header(io.headers, "%s: %s", STORAGE_CLASS_HEADER, storage_class); /* Add Authorization header */ if ((r = http_io_add_auth(priv, &io, now, io.src, io.buf_size)) != 0) @@ -1840,7 +1853,7 @@ const char *qmark; size_t resource_len; u_int hmac_len; - HMAC_CTX hmac_ctx; + HMAC_CTX* hmac_ctx = NULL; int i; int r; @@ -1851,22 +1864,23 @@ pthread_mutex_unlock(&priv->mutex); /* Initialize HMAC */ - HMAC_CTX_init(&hmac_ctx); - HMAC_Init_ex(&hmac_ctx, access_key, strlen(access_key), EVP_sha1(), NULL); + hmac_ctx = HMAC_CTX_new(); + assert(NULL != hmac_ctx); + HMAC_Init_ex(hmac_ctx, access_key, strlen(access_key), EVP_sha1(), NULL); #if DEBUG_AUTHENTICATION *sigbuf = '\0'; #endif /* Sign initial stuff */ - HMAC_Update(&hmac_ctx, (const u_char *)io->method, strlen(io->method)); - HMAC_Update(&hmac_ctx, (const u_char *)"\n", 1); + HMAC_Update(hmac_ctx, (const u_char *)io->method, strlen(io->method)); + HMAC_Update(hmac_ctx, (const u_char *)"\n", 1); #if DEBUG_AUTHENTICATION snprintf(sigbuf + strlen(sigbuf), sizeof(sigbuf) - strlen(sigbuf), "%s\n", io->method); #endif - update_hmac_from_header(&hmac_ctx, io, MD5_HEADER, 1, sigbuf, sizeof(sigbuf)); - update_hmac_from_header(&hmac_ctx, io, CTYPE_HEADER, 1, sigbuf, sizeof(sigbuf)); - update_hmac_from_header(&hmac_ctx, io, HTTP_DATE_HEADER, 1, sigbuf, sizeof(sigbuf)); + update_hmac_from_header(hmac_ctx, io, MD5_HEADER, 1, sigbuf, sizeof(sigbuf)); + update_hmac_from_header(hmac_ctx, io, CTYPE_HEADER, 1, sigbuf, sizeof(sigbuf)); + update_hmac_from_header(hmac_ctx, io, HTTP_DATE_HEADER, 1, sigbuf, sizeof(sigbuf)); /* Get x-amz headers sorted by name */ for (header = io->headers, num_amz_hdrs = 0; header != NULL; header = header->next) { @@ -1886,24 +1900,23 @@ /* Sign x-amz headers (in sorted order) */ for (i = 0; i < num_amz_hdrs; i++) - update_hmac_from_header(&hmac_ctx, io, amz_hdrs[i], 0, sigbuf, sizeof(sigbuf)); + update_hmac_from_header(hmac_ctx, io, amz_hdrs[i], 0, sigbuf, sizeof(sigbuf)); /* Get resource */ resource = config->vhost ? io->url + strlen(config->baseURL) - 1 : io->url + strlen(config->baseURL) + strlen(config->bucket); resource_len = (qmark = strchr(resource, '?')) != NULL ? qmark - resource : strlen(resource); /* Sign final stuff */ - HMAC_Update(&hmac_ctx, (const u_char *)"/", 1); - HMAC_Update(&hmac_ctx, (const u_char *)config->bucket, strlen(config->bucket)); - HMAC_Update(&hmac_ctx, (const u_char *)resource, resource_len); + HMAC_Update(hmac_ctx, (const u_char *)"/", 1); + HMAC_Update(hmac_ctx, (const u_char *)config->bucket, strlen(config->bucket)); + HMAC_Update(hmac_ctx, (const u_char *)resource, resource_len); #if DEBUG_AUTHENTICATION snprintf(sigbuf + strlen(sigbuf), sizeof(sigbuf) - strlen(sigbuf), "/%s%.*s", config->bucket, resource_len, resource); #endif /* Finish up */ - HMAC_Final(&hmac_ctx, hmac, &hmac_len); + HMAC_Final(hmac_ctx, hmac, &hmac_len); assert(hmac_len == SHA_DIGEST_LENGTH); - HMAC_CTX_cleanup(&hmac_ctx); /* Base64-encode result */ http_io_base64_encode(authbuf, sizeof(authbuf), hmac, hmac_len); @@ -1925,7 +1938,7 @@ /* Clean up */ if (amz_hdrs != NULL) free(amz_hdrs); - HMAC_CTX_cleanup(&hmac_ctx); + HMAC_CTX_free(hmac_ctx); return r; } @@ -1956,8 +1969,8 @@ size_t query_params_len; u_int header_names_length; u_int num_sorted_hdrs; - EVP_MD_CTX hash_ctx; - HMAC_CTX hmac_ctx; + EVP_MD_CTX* hash_ctx; + HMAC_CTX* hmac_ctx = NULL; #if DEBUG_AUTHENTICATION char sigbuf[1024]; #endif @@ -1972,8 +1985,7 @@ int i; /* Initialize */ - EVP_MD_CTX_init(&hash_ctx); - HMAC_CTX_init(&hmac_ctx); + hash_ctx = EVP_MD_CTX_new(); /* Snapshot current credentials */ pthread_mutex_lock(&priv->mutex); @@ -2004,10 +2016,10 @@ /****** Hash Payload and Add Header ******/ - EVP_DigestInit_ex(&hash_ctx, EVP_sha256(), NULL); + EVP_DigestInit_ex(hash_ctx, EVP_sha256(), NULL); if (payload != NULL) - EVP_DigestUpdate(&hash_ctx, payload, plen); - EVP_DigestFinal_ex(&hash_ctx, payload_hash, &payload_hash_len); + EVP_DigestUpdate(hash_ctx, payload, plen); + EVP_DigestFinal_ex(hash_ctx, payload_hash, &payload_hash_len); http_io_prhex(payload_hash_buf, payload_hash, payload_hash_len); io->headers = http_io_add_header(io->headers, "%s: %s", CONTENT_SHA256_HEADER, payload_hash_buf); @@ -2024,7 +2036,7 @@ #endif /* Reset hash */ - EVP_DigestInit_ex(&hash_ctx, EVP_sha256(), NULL); + EVP_DigestInit_ex(hash_ctx, EVP_sha256(), NULL); /* Sort headers by (lowercase) name; add "Host" header manually - special case because cURL adds it, not us */ snprintf(hosthdr, sizeof(hosthdr), "host:%.*s", (int)host_len, host); @@ -2041,22 +2053,22 @@ qsort(sorted_hdrs, num_sorted_hdrs, sizeof(*sorted_hdrs), http_io_strcasecmp_ptr); /* Request method */ - EVP_DigestUpdate(&hash_ctx, (const u_char *)io->method, strlen(io->method)); - EVP_DigestUpdate(&hash_ctx, (const u_char *)"\n", 1); + EVP_DigestUpdate(hash_ctx, (const u_char *)io->method, strlen(io->method)); + EVP_DigestUpdate(hash_ctx, (const u_char *)"\n", 1); #if DEBUG_AUTHENTICATION snprintf(sigbuf + strlen(sigbuf), sizeof(sigbuf) - strlen(sigbuf), "%s\n", io->method); #endif /* Canonical URI */ - EVP_DigestUpdate(&hash_ctx, (const u_char *)uripath, uripath_len); - EVP_DigestUpdate(&hash_ctx, (const u_char *)"\n", 1); + EVP_DigestUpdate(hash_ctx, (const u_char *)uripath, uripath_len); + EVP_DigestUpdate(hash_ctx, (const u_char *)"\n", 1); #if DEBUG_AUTHENTICATION snprintf(sigbuf + strlen(sigbuf), sizeof(sigbuf) - strlen(sigbuf), "%.*s\n", (int)uripath_len, uripath); #endif /* Canonical query string */ - EVP_DigestUpdate(&hash_ctx, (const u_char *)query_params, query_params_len); - EVP_DigestUpdate(&hash_ctx, (const u_char *)"\n", 1); + EVP_DigestUpdate(hash_ctx, (const u_char *)query_params, query_params_len); + EVP_DigestUpdate(hash_ctx, (const u_char *)"\n", 1); #if DEBUG_AUTHENTICATION snprintf(sigbuf + strlen(sigbuf), sizeof(sigbuf) - strlen(sigbuf), "%.*s\n", (int)query_params_len, query_params); #endif @@ -2075,7 +2087,7 @@ goto fail; } lcase = tolower(*s); - EVP_DigestUpdate(&hash_ctx, (const u_char *)&lcase, 1); + EVP_DigestUpdate(hash_ctx, (const u_char *)&lcase, 1); #if DEBUG_AUTHENTICATION snprintf(sigbuf + strlen(sigbuf), sizeof(sigbuf) - strlen(sigbuf), "%c", lcase); #endif @@ -2083,13 +2095,13 @@ } while (*s++ != ':'); while (isspace(*s)) s++; - EVP_DigestUpdate(&hash_ctx, (const u_char *)s, strlen(s)); - EVP_DigestUpdate(&hash_ctx, (const u_char *)"\n", 1); + EVP_DigestUpdate(hash_ctx, (const u_char *)s, strlen(s)); + EVP_DigestUpdate(hash_ctx, (const u_char *)"\n", 1); #if DEBUG_AUTHENTICATION snprintf(sigbuf + strlen(sigbuf), sizeof(sigbuf) - strlen(sigbuf), "%s\n", s); #endif } - EVP_DigestUpdate(&hash_ctx, (const u_char *)"\n", 1); + EVP_DigestUpdate(hash_ctx, (const u_char *)"\n", 1); #if DEBUG_AUTHENTICATION snprintf(sigbuf + strlen(sigbuf), sizeof(sigbuf) - strlen(sigbuf), "\n"); #endif @@ -2111,20 +2123,20 @@ } *p++ = '\0'; assert(p <= header_names + header_names_length); - EVP_DigestUpdate(&hash_ctx, (const u_char *)header_names, strlen(header_names)); - EVP_DigestUpdate(&hash_ctx, (const u_char *)"\n", 1); + EVP_DigestUpdate(hash_ctx, (const u_char *)header_names, strlen(header_names)); + EVP_DigestUpdate(hash_ctx, (const u_char *)"\n", 1); #if DEBUG_AUTHENTICATION snprintf(sigbuf + strlen(sigbuf), sizeof(sigbuf) - strlen(sigbuf), "%s\n", header_names); #endif /* Hashed payload */ - EVP_DigestUpdate(&hash_ctx, (const u_char *)payload_hash_buf, strlen(payload_hash_buf)); + EVP_DigestUpdate(hash_ctx, (const u_char *)payload_hash_buf, strlen(payload_hash_buf)); #if DEBUG_AUTHENTICATION snprintf(sigbuf + strlen(sigbuf), sizeof(sigbuf) - strlen(sigbuf), "%s", payload_hash_buf); #endif /* Get canonical request hash as a string */ - EVP_DigestFinal_ex(&hash_ctx, creq_hash, &creq_hash_len); + EVP_DigestFinal_ex(hash_ctx, creq_hash, &creq_hash_len); http_io_prhex(creq_hash_buf, creq_hash, creq_hash_len); #if DEBUG_AUTHENTICATION @@ -2135,34 +2147,36 @@ /****** Derive Signing Key ******/ /* Do nested HMAC's */ - HMAC_Init_ex(&hmac_ctx, access_key, strlen(access_key), EVP_sha256(), NULL); + hmac_ctx = HMAC_CTX_new(); + assert(NULL != hmac_ctx); + HMAC_Init_ex(hmac_ctx, access_key, strlen(access_key), EVP_sha256(), NULL); #if DEBUG_AUTHENTICATION (*config->log)(LOG_DEBUG, "auth: access_key = \"%s\"", access_key); #endif - HMAC_Update(&hmac_ctx, (const u_char *)datebuf, 8); - HMAC_Final(&hmac_ctx, hmac, &hmac_len); + HMAC_Update(hmac_ctx, (const u_char *)datebuf, 8); + HMAC_Final(hmac_ctx, hmac, &hmac_len); assert(hmac_len <= sizeof(hmac)); #if DEBUG_AUTHENTICATION http_io_prhex(hmac_buf, hmac, hmac_len); (*config->log)(LOG_DEBUG, "auth: HMAC[%.8s] = %s", datebuf, hmac_buf); #endif - HMAC_Init_ex(&hmac_ctx, hmac, hmac_len, EVP_sha256(), NULL); - HMAC_Update(&hmac_ctx, (const u_char *)config->region, strlen(config->region)); - HMAC_Final(&hmac_ctx, hmac, &hmac_len); + HMAC_Init_ex(hmac_ctx, hmac, hmac_len, EVP_sha256(), NULL); + HMAC_Update(hmac_ctx, (const u_char *)config->region, strlen(config->region)); + HMAC_Final(hmac_ctx, hmac, &hmac_len); #if DEBUG_AUTHENTICATION http_io_prhex(hmac_buf, hmac, hmac_len); (*config->log)(LOG_DEBUG, "auth: HMAC[%s] = %s", config->region, hmac_buf); #endif - HMAC_Init_ex(&hmac_ctx, hmac, hmac_len, EVP_sha256(), NULL); - HMAC_Update(&hmac_ctx, (const u_char *)S3_SERVICE_NAME, strlen(S3_SERVICE_NAME)); - HMAC_Final(&hmac_ctx, hmac, &hmac_len); + HMAC_Init_ex(hmac_ctx, hmac, hmac_len, EVP_sha256(), NULL); + HMAC_Update(hmac_ctx, (const u_char *)S3_SERVICE_NAME, strlen(S3_SERVICE_NAME)); + HMAC_Final(hmac_ctx, hmac, &hmac_len); #if DEBUG_AUTHENTICATION http_io_prhex(hmac_buf, hmac, hmac_len); (*config->log)(LOG_DEBUG, "auth: HMAC[%s] = %sn", S3_SERVICE_NAME, hmac_buf); #endif - HMAC_Init_ex(&hmac_ctx, hmac, hmac_len, EVP_sha256(), NULL); - HMAC_Update(&hmac_ctx, (const u_char *)SIGNATURE_TERMINATOR, strlen(SIGNATURE_TERMINATOR)); - HMAC_Final(&hmac_ctx, hmac, &hmac_len); + HMAC_Init_ex(hmac_ctx, hmac, hmac_len, EVP_sha256(), NULL); + HMAC_Update(hmac_ctx, (const u_char *)SIGNATURE_TERMINATOR, strlen(SIGNATURE_TERMINATOR)); + HMAC_Final(hmac_ctx, hmac, &hmac_len); #if DEBUG_AUTHENTICATION http_io_prhex(hmac_buf, hmac, hmac_len); (*config->log)(LOG_DEBUG, "auth: HMAC[%s] = %s", SIGNATURE_TERMINATOR, hmac_buf); @@ -2173,34 +2187,34 @@ #if DEBUG_AUTHENTICATION *sigbuf = '\0'; #endif - HMAC_Init_ex(&hmac_ctx, hmac, hmac_len, EVP_sha256(), NULL); - HMAC_Update(&hmac_ctx, (const u_char *)SIGNATURE_ALGORITHM, strlen(SIGNATURE_ALGORITHM)); - HMAC_Update(&hmac_ctx, (const u_char *)"\n", 1); + HMAC_Init_ex(hmac_ctx, hmac, hmac_len, EVP_sha256(), NULL); + HMAC_Update(hmac_ctx, (const u_char *)SIGNATURE_ALGORITHM, strlen(SIGNATURE_ALGORITHM)); + HMAC_Update(hmac_ctx, (const u_char *)"\n", 1); #if DEBUG_AUTHENTICATION snprintf(sigbuf + strlen(sigbuf), sizeof(sigbuf) - strlen(sigbuf), "%s\n", SIGNATURE_ALGORITHM); #endif - HMAC_Update(&hmac_ctx, (const u_char *)datebuf, strlen(datebuf)); - HMAC_Update(&hmac_ctx, (const u_char *)"\n", 1); + HMAC_Update(hmac_ctx, (const u_char *)datebuf, strlen(datebuf)); + HMAC_Update(hmac_ctx, (const u_char *)"\n", 1); #if DEBUG_AUTHENTICATION snprintf(sigbuf + strlen(sigbuf), sizeof(sigbuf) - strlen(sigbuf), "%s\n", datebuf); #endif - HMAC_Update(&hmac_ctx, (const u_char *)datebuf, 8); - HMAC_Update(&hmac_ctx, (const u_char *)"/", 1); - HMAC_Update(&hmac_ctx, (const u_char *)config->region, strlen(config->region)); - HMAC_Update(&hmac_ctx, (const u_char *)"/", 1); - HMAC_Update(&hmac_ctx, (const u_char *)S3_SERVICE_NAME, strlen(S3_SERVICE_NAME)); - HMAC_Update(&hmac_ctx, (const u_char *)"/", 1); - HMAC_Update(&hmac_ctx, (const u_char *)SIGNATURE_TERMINATOR, strlen(SIGNATURE_TERMINATOR)); - HMAC_Update(&hmac_ctx, (const u_char *)"\n", 1); + HMAC_Update(hmac_ctx, (const u_char *)datebuf, 8); + HMAC_Update(hmac_ctx, (const u_char *)"/", 1); + HMAC_Update(hmac_ctx, (const u_char *)config->region, strlen(config->region)); + HMAC_Update(hmac_ctx, (const u_char *)"/", 1); + HMAC_Update(hmac_ctx, (const u_char *)S3_SERVICE_NAME, strlen(S3_SERVICE_NAME)); + HMAC_Update(hmac_ctx, (const u_char *)"/", 1); + HMAC_Update(hmac_ctx, (const u_char *)SIGNATURE_TERMINATOR, strlen(SIGNATURE_TERMINATOR)); + HMAC_Update(hmac_ctx, (const u_char *)"\n", 1); #if DEBUG_AUTHENTICATION snprintf(sigbuf + strlen(sigbuf), sizeof(sigbuf) - strlen(sigbuf), "%.8s/%s/%s/%s\n", datebuf, config->region, S3_SERVICE_NAME, SIGNATURE_TERMINATOR); #endif - HMAC_Update(&hmac_ctx, (const u_char *)creq_hash_buf, strlen(creq_hash_buf)); + HMAC_Update(hmac_ctx, (const u_char *)creq_hash_buf, strlen(creq_hash_buf)); #if DEBUG_AUTHENTICATION snprintf(sigbuf + strlen(sigbuf), sizeof(sigbuf) - strlen(sigbuf), "%s", creq_hash_buf); #endif - HMAC_Final(&hmac_ctx, hmac, &hmac_len); + HMAC_Final(hmac_ctx, hmac, &hmac_len); http_io_prhex(hmac_buf, hmac, hmac_len); #if DEBUG_AUTHENTICATION @@ -2222,8 +2236,8 @@ if (sorted_hdrs != NULL) free(sorted_hdrs); free(header_names); - EVP_MD_CTX_cleanup(&hash_ctx); - HMAC_CTX_cleanup(&hmac_ctx); + EVP_MD_CTX_free(hash_ctx); + HMAC_CTX_free(hmac_ctx); return r; } @@ -2512,7 +2526,7 @@ http_io_crypt(struct http_io_private *priv, s3b_block_t block_num, int enc, const u_char *src, u_int len, u_char *dest) { u_char ivec[EVP_MAX_IV_LENGTH]; - EVP_CIPHER_CTX ctx; + EVP_CIPHER_CTX* ctx; u_int total_len; char blockbuf[EVP_MAX_IV_LENGTH]; int clen; @@ -2527,34 +2541,35 @@ assert(EVP_MAX_IV_LENGTH >= MD5_DIGEST_LENGTH); /* Initialize cipher context */ - EVP_CIPHER_CTX_init(&ctx); + ctx = EVP_CIPHER_CTX_new(); + EVP_CIPHER_CTX_init(ctx); /* Generate initialization vector by encrypting the block number using previously generated IV */ memset(blockbuf, 0, sizeof(blockbuf)); snprintf(blockbuf, sizeof(blockbuf), "%0*jx", S3B_BLOCK_NUM_DIGITS, (uintmax_t)block_num); /* Initialize cipher for IV generation */ - r = EVP_EncryptInit_ex(&ctx, priv->cipher, NULL, priv->ivkey, priv->ivkey); + r = EVP_EncryptInit_ex(ctx, priv->cipher, NULL, priv->ivkey, priv->ivkey); assert(r == 1); - EVP_CIPHER_CTX_set_padding(&ctx, 0); + EVP_CIPHER_CTX_set_padding(ctx, 0); /* Encrypt block number to get IV for bulk encryption */ - r = EVP_EncryptUpdate(&ctx, ivec, &clen, (const u_char *)blockbuf, EVP_CIPHER_CTX_block_size(&ctx)); - assert(r == 1 && clen == EVP_CIPHER_CTX_block_size(&ctx)); - r = EVP_EncryptFinal_ex(&ctx, NULL, &clen); + r = EVP_EncryptUpdate(ctx, ivec, &clen, (const u_char *)blockbuf, EVP_CIPHER_CTX_block_size(ctx)); + assert(r == 1 && clen == EVP_CIPHER_CTX_block_size(ctx)); + r = EVP_EncryptFinal_ex(ctx, NULL, &clen); assert(r == 1 && clen == 0); /* Re-initialize cipher for bulk data encryption */ - assert(EVP_CIPHER_CTX_block_size(&ctx) == EVP_CIPHER_CTX_iv_length(&ctx)); - r = EVP_CipherInit_ex(&ctx, priv->cipher, NULL, priv->key, ivec, enc); + assert(EVP_CIPHER_CTX_block_size(ctx) == EVP_CIPHER_CTX_iv_length(ctx)); + r = EVP_CipherInit_ex(ctx, priv->cipher, NULL, priv->key, ivec, enc); assert(r == 1); - EVP_CIPHER_CTX_set_padding(&ctx, 1); + EVP_CIPHER_CTX_set_padding(ctx, 1); /* Encrypt/decrypt */ - r = EVP_CipherUpdate(&ctx, dest, &clen, src, (int)len); + r = EVP_CipherUpdate(ctx, dest, &clen, src, (int)len); assert(r == 1 && clen >= 0); total_len = (u_int)clen; - r = EVP_CipherFinal_ex(&ctx, dest + total_len, &clen); + r = EVP_CipherFinal_ex(ctx, dest + total_len, &clen); assert(r == 1 && clen >= 0); total_len += (u_int)clen; @@ -2569,7 +2584,7 @@ #endif /* Done */ - EVP_CIPHER_CTX_cleanup(&ctx); + EVP_CIPHER_CTX_free(ctx); return total_len; } @@ -2579,18 +2594,19 @@ const char *const ciphername = EVP_CIPHER_name(priv->cipher); char blockbuf[64]; u_int hmac_len; - HMAC_CTX ctx; + HMAC_CTX* ctx; /* Sign the block number, the name of the encryption algorithm, and the block data */ snprintf(blockbuf, sizeof(blockbuf), "%0*jx", S3B_BLOCK_NUM_DIGITS, (uintmax_t)block_num); - HMAC_CTX_init(&ctx); - HMAC_Init_ex(&ctx, (const u_char *)priv->key, priv->keylen, EVP_sha1(), NULL); - HMAC_Update(&ctx, (const u_char *)blockbuf, strlen(blockbuf)); - HMAC_Update(&ctx, (const u_char *)ciphername, strlen(ciphername)); - HMAC_Update(&ctx, (const u_char *)src, len); - HMAC_Final(&ctx, (u_char *)hmac, &hmac_len); + ctx = HMAC_CTX_new(); + assert(NULL != ctx); + HMAC_Init_ex(ctx, (const u_char *)priv->key, priv->keylen, EVP_sha1(), NULL); + HMAC_Update(ctx, (const u_char *)blockbuf, strlen(blockbuf)); + HMAC_Update(ctx, (const u_char *)ciphername, strlen(ciphername)); + HMAC_Update(ctx, (const u_char *)src, len); + HMAC_Final(ctx, (u_char *)hmac, &hmac_len); assert(hmac_len == SHA_DIGEST_LENGTH); - HMAC_CTX_cleanup(&ctx); + HMAC_CTX_free(ctx); } static void diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/s3backer-1.4.2/http_io.h new/s3backer-1.4.3/http_io.h --- old/s3backer-1.4.2/http_io.h 2015-09-01 16:45:24.000000000 +0200 +++ new/s3backer-1.4.3/http_io.h 2016-07-22 22:15:35.000000000 +0200 @@ -42,6 +42,11 @@ #define AUTH_VERSION_AWS2 "aws2" #define AUTH_VERSION_AWS4 "aws4" +/* Storage classes */ +#define STORAGE_CLASS_STANDARD "STANDARD" +#define STORAGE_CLASS_STANDARD_IA "STANDARD_IA" +#define STORAGE_CLASS_REDUCED_REDUNDANCY "REDUCED_REDUNDANCY" + /* Configuration info structure for http_io store */ struct http_io_conf { char *accessId; @@ -49,6 +54,7 @@ char *iam_token; const char *accessType; const char *ec2iam_role; + const char *storage_class; const char *authVersion; const char *baseURL; const char *region; @@ -62,7 +68,7 @@ int debug; int debug_http; int quiet; - int rrs; // reduced redundancy storage + int rrs; // reduced redundancy storage (backward compat.) int compress; // zlib compression level int vhost; // use virtual host style URL u_int *nonzero_bitmap; // is set to NULL by http_io_create() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/s3backer-1.4.2/s3b_config.c new/s3backer-1.4.3/s3b_config.c --- old/s3backer-1.4.2/s3b_config.c 2015-09-01 16:45:24.000000000 +0200 +++ new/s3backer-1.4.3/s3b_config.c 2016-07-22 22:15:35.000000000 +0200 @@ -383,6 +383,10 @@ .value= 1 }, { + .templ= "--storageClass=%s", + .offset= offsetof(struct s3b_config, http_io.storage_class), + }, + { .templ= "--ssl", .offset= offsetof(struct s3b_config, ssl), .value= 1 @@ -991,6 +995,15 @@ } } + /* Check storage class */ + if (config.http_io.storage_class != NULL + && strcmp(config.http_io.storage_class, STORAGE_CLASS_STANDARD) != 0 + && strcmp(config.http_io.storage_class, STORAGE_CLASS_STANDARD_IA) != 0 + && strcmp(config.http_io.storage_class, STORAGE_CLASS_REDUCED_REDUNDANCY) != 0) { + warnx("invalid storage class `%s'", config.http_io.storage_class); + return -1; + } + /* Set default or custom region */ if (config.http_io.region == NULL) config.http_io.region = S3BACKER_DEFAULT_REGION; @@ -1696,10 +1709,11 @@ fprintf(stderr, "\t--%-27s %s\n", "readOnly", "Return `Read-only file system' error for write attempts"); fprintf(stderr, "\t--%-27s %s\n", "region=region", "Specify AWS region"); fprintf(stderr, "\t--%-27s %s\n", "reset-mounted-flag", "Reset `already mounted' flag in the filesystem"); - fprintf(stderr, "\t--%-27s %s\n", "rrs", "Target written blocks for Reduced Redundancy Storage"); + fprintf(stderr, "\t--%-27s %s\n", "rrs", "Target written blocks for Reduced Redundancy Storage (deprecated)"); fprintf(stderr, "\t--%-27s %s\n", "size=SIZE", "File size (with optional suffix 'K', 'M', 'G', etc.)"); fprintf(stderr, "\t--%-27s %s\n", "ssl", "Enable SSL"); fprintf(stderr, "\t--%-27s %s\n", "statsFilename=NAME", "Name of statistics file in filesystem"); + fprintf(stderr, "\t--%-27s %s\n", "storageClass=TYPE", "Specify storage class for written blocks"); fprintf(stderr, "\t--%-27s %s\n", "test", "Run in local test mode (bucket is a directory)"); fprintf(stderr, "\t--%-27s %s\n", "timeout=SECONDS", "Max time allowed for one HTTP operation"); fprintf(stderr, "\t--%-27s %s\n", "timeout=SECONDS", "Specify HTTP operation timeout"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/s3backer-1.4.2/s3backer.1 new/s3backer-1.4.3/s3backer.1 --- old/s3backer-1.4.2/s3backer.1 2015-09-01 16:45:24.000000000 +0200 +++ new/s3backer-1.4.3/s3backer.1 2016-07-22 22:15:35.000000000 +0200 @@ -727,7 +727,8 @@ But see also BUGS below. .Pp .It Fl \-rrs -When writing blocks, specify Reduced Redundancy Storage. +Deprecated; equivalent to +.Fl \-storageClass=REDUCED_REDUNDANCY . .It Fl \-size=SIZE Specify the size (in bytes) of the backed file to be exported by the filesystem. The size may have an optional suffix 'K' for kilobytes, 'M' for megabytes, 'G' for gigabytes, 'T' for terabytes, 'E' for exabytes, 'Z' for zettabytes, or 'Y' for yottabytes. @@ -751,6 +752,17 @@ filesystem. A value of empty string disables the appearance of this file. Default is `stats'. +.It Fl \-storageClass=TYPE +Specify storage class. +.Pp +Valid values are: +.Pa STANDARD , +.Pa STANDARD_IA , +and +.Pa REDUCED_REDUNDANCY . +.Pp +The default is +.Pa STANDARD . .It Fl \-test Operate in local test mode. Filesystem blocks are stored as regular files in the directory diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/s3backer-1.4.2/s3backer.h new/s3backer-1.4.3/s3backer.h --- old/s3backer-1.4.2/s3backer.h 2015-09-01 16:45:24.000000000 +0200 +++ new/s3backer-1.4.3/s3backer.h 2016-07-22 22:15:35.000000000 +0200 @@ -225,3 +225,10 @@ /* gitrev.c */ extern const char *const s3backer_version; +/* Issue #64 OpenSSL 1.1.0 compatibility - sslcompat.c */ +#if OPENSSL_VERSION_NUMBER < 0x10100000L +HMAC_CTX *HMAC_CTX_new(void); +void HMAC_CTX_free(HMAC_CTX *ctx); +EVP_MD_CTX *EVP_MD_CTX_new(void); +void EVP_MD_CTX_free(EVP_MD_CTX *ctx); +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/s3backer-1.4.2/s3backer.spec new/s3backer-1.4.3/s3backer.spec --- old/s3backer-1.4.2/s3backer.spec 2015-09-01 16:51:09.000000000 +0200 +++ new/s3backer-1.4.3/s3backer.spec 2016-07-25 20:55:44.000000000 +0200 @@ -29,7 +29,7 @@ # Name: s3backer -Version: 1.4.2 +Version: 1.4.3 Release: 1 License: GNU General Public License, Version 2 Summary: FUSE-based single file backing store via Amazon S3 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/s3backer-1.4.2/sslcompat.c new/s3backer-1.4.3/sslcompat.c --- old/s3backer-1.4.2/sslcompat.c 1970-01-01 01:00:00.000000000 +0100 +++ new/s3backer-1.4.3/sslcompat.c 2016-07-22 22:15:35.000000000 +0200 @@ -0,0 +1,83 @@ +/* + * s3backer - FUSE-based single file backing store via Amazon S3 + * + * Copyright 2008-2011 Archie L. Cobbs <[email protected]> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + * + * In addition, as a special exception, the copyright holders give + * permission to link the code of portions of this program with the + * OpenSSL library under certain conditions as described in each + * individual source file, and distribute linked combinations including + * the two. + * + * You must obey the GNU General Public License in all respects for all + * of the code used other than OpenSSL. If you modify file(s) with this + * exception, you may extend this exception to your version of the + * file(s), but you are not obligated to do so. If you do not wish to do + * so, delete this exception statement from your version. If you delete + * this exception statement from all source files in the program, then + * also delete it here. + */ + +#include "s3backer.h" + +/* Issue #64 OpenSSL 1.1.0 compatibility */ +#if OPENSSL_VERSION_NUMBER < 0x10100000L + +/* + * OpenSSL does not allow for HMAC_CTX or EVP_MD_CTX to be allocated on the + * stack. Instead it provides a set of _new and _free functions for dynamic + * allocation that do not exist in the older versions of the library. For + * older OpenSSL versions we provide our own implementations of these missing + * functions. + */ + +HMAC_CTX *HMAC_CTX_new(void) +{ + HMAC_CTX *ctx = OPENSSL_malloc(sizeof(*ctx)); + if (ctx != NULL) { + HMAC_CTX_init(ctx); + } + return ctx; +} + +void HMAC_CTX_free(HMAC_CTX *ctx) +{ + if (ctx != NULL) { + HMAC_CTX_cleanup(ctx); + OPENSSL_free(ctx); + } +} + +EVP_MD_CTX *EVP_MD_CTX_new(void) +{ + EVP_MD_CTX *ctx = OPENSSL_malloc(sizeof(*ctx)); + if (NULL != ctx) { + EVP_MD_CTX_init(ctx); + } + return ctx; +} + +void EVP_MD_CTX_free(EVP_MD_CTX *ctx) +{ + if (ctx != NULL) { + EVP_MD_CTX_cleanup(ctx); + OPENSSL_free(ctx); + } +} + +#endif
