summaryrefslogtreecommitdiff
path: root/dev-util/radare2/files/radare2-5.2.0-ssl-build.patch
blob: 8701adb626646878a18600b0258e826c9795fed9 (plain)
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
From 7273429e4ba85318f0da2ae03ecc154834aaa73b Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyfox@gentoo.org>
Date: Mon, 12 Apr 2021 23:48:09 +0100
Subject: [PATCH] state.c: fix --with-openssl build

Build failure happens at:

```
$ ./configure --with-openssl && make
....
state.c: In function 'r_hash_do_hmac_sha256':
state.c:155:19: error: 'r_SHA256_BLOCK_LENGTH' undeclared (first use in this function); did you mean 'SHA256_BLOCK_LENGTH'?
  155 |         ut8 bskey[r_SHA256_BLOCK_LENGTH]; // block-sized key
      |                   ^~~~~~~~~~~~~~~~~~~~~
      |                   SHA256_BLOCK_LENGTH
```

The change defines r2_.* aliases for openssl implementation.
---
 libr/hash/state.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/libr/hash/state.c b/libr/hash/state.c
index 6f3ae6b4c..93adafc81 100644
--- a/libr/hash/state.c
+++ b/libr/hash/state.c
@@ -7,6 +7,24 @@
 #include <openssl/md4.h>
 #include <openssl/md5.h>
 #include <openssl/sha.h>
+
+#  define r_SHA256_BLOCK_LENGTH SHA256_BLOCK_LENGTH
+
+#  define r_SHA1_Init           SHA1_Init
+#  define r_SHA1_Update         SHA1_Update
+#  define r_SHA1_Final          SHA1_Final
+
+#  define r_SHA256_Init         SHA256_Init
+#  define r_SHA256_Update       SHA256_Update
+#  define r_SHA256_Final        SHA256_Final
+
+#  define r_SHA384_Init         SHA384_Init
+#  define r_SHA384_Update       SHA384_Update
+#  define r_SHA384_Final        SHA384_Final
+
+#  define r_SHA512_Init         SHA512_Init
+#  define r_SHA512_Update       SHA512_Update
+#  define r_SHA512_Final        SHA512_Final
 #else
 #include "md4.h"
 #include "md5.h"
-- 
2.31.1