aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJakub Jelen <jjelen@redhat.com>2016-11-05 16:52:41 +0100
committerAndreas Schneider <asn@cryptomilk.org>2016-11-07 11:46:41 +0100
commit607c671f67de2443e39ef571122c0c0e0d150e3a (patch)
tree468697e15a3e63497d7769a5830102bb314cde62 /src
parentcf1e808e2ffa1f26644fb5d2cb82a919f323deba (diff)
downloadlibssh-607c671f67de2443e39ef571122c0c0e0d150e3a.tar.gz
libssh-607c671f67de2443e39ef571122c0c0e0d150e3a.tar.xz
libssh-607c671f67de2443e39ef571122c0c0e0d150e3a.zip
libcrypto: Use a pointer for EVP_MD_CTX
This is for OpenSSL 1.1.0 support. Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src')
-rw-r--r--src/libcrypto.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libcrypto.c b/src/libcrypto.c
index 64c92eaa..622b4470 100644
--- a/src/libcrypto.c
+++ b/src/libcrypto.c
@@ -135,18 +135,19 @@ static const EVP_MD *nid_to_evpmd(int nid)
void evp(int nid, unsigned char *digest, int len, unsigned char *hash, unsigned int *hlen)
{
const EVP_MD *evp_md = nid_to_evpmd(nid);
- EVP_MD_CTX md;
+ EVP_MD_CTX *md = EVP_MD_CTX_new();
- EVP_DigestInit(&md, evp_md);
- EVP_DigestUpdate(&md, digest, len);
- EVP_DigestFinal(&md, hash, hlen);
+ EVP_DigestInit(md, evp_md);
+ EVP_DigestUpdate(md, digest, len);
+ EVP_DigestFinal(md, hash, hlen);
+ EVP_MD_CTX_free(md);
}
EVPCTX evp_init(int nid)
{
const EVP_MD *evp_md = nid_to_evpmd(nid);
- EVPCTX ctx = malloc(sizeof(EVP_MD_CTX));
+ EVPCTX ctx = EVP_MD_CTX_new();
if (ctx == NULL) {
return NULL;
}