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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
From bb1d0d7eb49078d1e27bbe28a6dd57eded3114fe Mon Sep 17 00:00:00 2001
From: Ariadne Conill <ariadne@dereferenced.org>
Date: Tue, 25 Feb 2020 21:03:37 +0000
Subject: [PATCH] isoping: support openssl 1.1
---
cmds/isoping.cc | 14 +++++++-------
cmds/isoping.h | 2 +-
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git cmds/isoping.cc cmds/isoping.cc
index 8cf6142..5e3958b 100644
--- cmds/isoping.cc
+++ cmds/isoping.cc
@@ -166,11 +166,11 @@ Sessions::Sessions()
cookie_epoch(0),
last_secret_update_time(0) {
NewRandomCookieSecret();
- EVP_MD_CTX_init(&digest_context);
+ digest_context = EVP_MD_CTX_new();
}
Sessions::~Sessions() {
- EVP_MD_CTX_cleanup(&digest_context);
+ EVP_MD_CTX_free(digest_context);
}
bool Sessions::CalculateCookie(Packet *p, struct sockaddr_storage *remoteaddr,
@@ -188,18 +188,18 @@ bool Sessions::CalculateCookieWithSecret(Packet *p,
fprintf(stderr, "Tried to create cookie for a non-handshake packet\n");
return false;
}
- if (!EVP_DigestInit_ex(&digest_context, md, NULL)) {
+ if (!EVP_DigestInit_ex(digest_context, md, NULL)) {
fprintf(stderr, "Unable to initialize hash digest\n");
return false;
}
// Hash the data
- EVP_DigestUpdate(&digest_context, secret, secret_len);
- EVP_DigestUpdate(&digest_context, &p->usec_per_pkt, sizeof(p->usec_per_pkt));
- EVP_DigestUpdate(&digest_context, remoteaddr, remoteaddr_len);
+ EVP_DigestUpdate(digest_context, secret, secret_len);
+ EVP_DigestUpdate(digest_context, &p->usec_per_pkt, sizeof(p->usec_per_pkt));
+ EVP_DigestUpdate(digest_context, remoteaddr, remoteaddr_len);
unsigned int digest_size = 0;
- EVP_DigestFinal_ex(&digest_context, p->data.handshake.cookie, &digest_size);
+ EVP_DigestFinal_ex(digest_context, p->data.handshake.cookie, &digest_size);
if (digest_size != COOKIE_SIZE) {
fprintf(stderr, "Invalid digest size %d for cookie; expected %d\n",
digest_size, COOKIE_SIZE);
diff --git cmds/isoping.h cmds/isoping.h
index 45c9bef..58723c7 100644
--- cmds/isoping.h
+++ cmds/isoping.h
@@ -176,7 +176,7 @@ class Sessions {
size_t secret_len);
// Fields required for calculating and verifying cookies.
- EVP_MD_CTX digest_context;
+ EVP_MD_CTX *digest_context;
const EVP_MD *md;
std::mt19937_64 rng;
uint32_t cookie_epoch;
--
2.25.1
|