blob: ded8beb8b8f70086ce4b46e86e5d9ef866383b3a (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
--- openssl/digest.cpp.orig 2015-10-11 02:32:36 UTC
+++ openssl/digest.cpp
@@ -37,20 +37,30 @@ void Digest::set(const char *type)
hashtype = (void *)EVP_get_digestbyname(type);
if(hashtype) {
+#if OPENSSL_VERSION_NUMBER >= 0x10100005L
+ context = EVP_MD_CTX_new();
+#else
context = new EVP_MD_CTX;
EVP_MD_CTX_init((EVP_MD_CTX *)context);
+#endif
EVP_DigestInit_ex((EVP_MD_CTX *)context, (const EVP_MD *)hashtype, NULL);
}
}
void Digest::release(void)
{
+#if OPENSSL_VERSION_NUMBER < 0x10100005L
if(context)
EVP_MD_CTX_cleanup((EVP_MD_CTX *)context);
+#endif
if(context) {
+#if OPENSSL_VERSION_NUMBER >= 0x10100005L
+ EVP_MD_CTX_free((EVP_MD_CTX *)context);
+#else
memset(context, 0, sizeof(EVP_MD_CTX));
delete (EVP_MD_CTX *)context;
+#endif
context = NULL;
}
@@ -71,8 +81,12 @@ void Digest::reset(void)
{
if(!context) {
if(hashtype) {
+#if OPENSSL_VERSION_NUMBER >= 0x10100005L
+ context = EVP_MD_CTX_new();
+#else
context = new EVP_MD_CTX;
EVP_MD_CTX_init((EVP_MD_CTX *)context);
+#endif
}
else
return;
|