df995a003d
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/libssh?expand=0&rev=d54088acd3a6df64c2b48b502a614e33
46 lines
1.3 KiB
Diff
46 lines
1.3 KiB
Diff
From 607c671f67de2443e39ef571122c0c0e0d150e3a Mon Sep 17 00:00:00 2001
|
|
From: Jakub Jelen <jjelen@redhat.com>
|
|
Date: Sat, 5 Nov 2016 16:52:41 +0100
|
|
Subject: [PATCH] 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>
|
|
---
|
|
src/libcrypto.c | 11 ++++++-----
|
|
1 file 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;
|
|
}
|
|
--
|
|
2.13.5
|
|
|