diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-02-03 11:13:12 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-02-03 11:13:12 -0500 |
commit | 27582325dc691f02c41612a258483a73f2e0e000 (patch) | |
tree | 61314753c73f7ee49a2f94cff54a86f2ad6d7733 /src/test/test_crypto.c | |
parent | 957cdb54699937818b539c75e413e88760ee34cd (diff) | |
download | tor-27582325dc691f02c41612a258483a73f2e0e000.tar.gz tor-27582325dc691f02c41612a258483a73f2e0e000.zip |
Make Tor build happily with OpenSSL master and libressl.
Also tested with 1.0.0t and 1.0.2f.
Closes ticket 19784.
Closes most of 17921. (Still need to make some tests pass.)
Diffstat (limited to 'src/test/test_crypto.c')
-rw-r--r-- | src/test/test_crypto.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c index fb21f3ad09..3244c210e6 100644 --- a/src/test/test_crypto.c +++ b/src/test/test_crypto.c @@ -1108,6 +1108,11 @@ test_crypto_digests(void *arg) crypto_pk_free(k); } +#ifndef OPENSSL_1_1_API +#define EVP_ENCODE_CTX_new() tor_malloc_zero(sizeof(EVP_ENCODE_CTX)) +#define EVP_ENCODE_CTX_free(ctx) tor_free(ctx) +#endif + /** Encode src into dest with OpenSSL's EVP Encode interface, returning the * length of the encoded data in bytes. */ @@ -1115,12 +1120,13 @@ static int base64_encode_evp(char *dest, char *src, size_t srclen) { const unsigned char *s = (unsigned char*)src; - EVP_ENCODE_CTX ctx; + EVP_ENCODE_CTX *ctx = EVP_ENCODE_CTX_new(); int len, ret; - EVP_EncodeInit(&ctx); - EVP_EncodeUpdate(&ctx, (unsigned char *)dest, &len, s, (int)srclen); - EVP_EncodeFinal(&ctx, (unsigned char *)(dest + len), &ret); + EVP_EncodeInit(ctx); + EVP_EncodeUpdate(ctx, (unsigned char *)dest, &len, s, (int)srclen); + EVP_EncodeFinal(ctx, (unsigned char *)(dest + len), &ret); + EVP_ENCODE_CTX_free(ctx); return ret+ len; } |