if test "$http" != "yes" ; then
http="no"
fi
-cat > $TMPC << EOF
-#include <curl/curl.h>
-#include <openssl/hmac.h>
-
-int main(int argc, char **argv)
-{
- CURL *curl;
- HMAC_CTX *ctx;
-
- curl = curl_easy_init();
- curl_easy_cleanup(curl);
-
- ctx = HMAC_CTX_new();
- HMAC_CTX_reset(ctx);
- HMAC_CTX_free(ctx);
- return 0;
-}
-EOF
-if test "$disable_http" != "yes" && compile_prog "" "-lcurl -lssl -lcrypto" "curl"; then
- LIBS="-lcurl -lssl -lcrypto $LIBS"
+if test "$disable_http" != "yes" && $(pkg-config --exists libcurl openssl); then
+ if $(pkg-config --atleast-version=1.1.0 openssl); then
+ output_sym "CONFIG_HAVE_OPAQUE_HMAC_CTX"
+ fi
+ LIBS="$(pkg-config --libs libcurl openssl) $LIBS"
http="yes"
fi
print_config "http engine" "$http"
}
static void _hmac(unsigned char *md, void *key, int key_len, char *data) {
+#ifndef CONFIG_HAVE_OPAQUE_HMAC_CTX
+ HMAC_CTX _ctx;
+#endif
HMAC_CTX *ctx;
unsigned int hmac_len;
+#ifdef CONFIG_HAVE_OPAQUE_HMAC_CTX
ctx = HMAC_CTX_new();
+#else
+ ctx = &_ctx;
+#endif
HMAC_Init_ex(ctx, key, key_len, EVP_sha256(), NULL);
HMAC_Update(ctx, (unsigned char*)data, strlen(data));
HMAC_Final(ctx, md, &hmac_len);
+#ifdef CONFIG_HAVE_OPAQUE_HMAC_CTX
HMAC_CTX_free(ctx);
+#else
+ HMAC_CTX_cleanup(ctx);
+#endif
}
static int _curl_trace(CURL *handle, curl_infotype type,
{
struct http_data *http = NULL;
struct http_options *o = td->eo;
- int r;
+
/* allocate engine specific structure to deal with libhttp. */
http = calloc(1, sizeof(*http));
if (!http) {
return 0;
cleanup:
fio_http_cleanup(td);
- return r;
+ return 1;
}
static int fio_http_open(struct thread_data *td, struct fio_file *f)