summarylogtreecommitdiffstats
path: root/libtgvoip-2.patch
blob: 61fa35b80dd600262575eb5f9f04b7817b5e3eec (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
From f2e246c1bfd456646880f4df8062337a53407343 Mon Sep 17 00:00:00 2001
From: Nicholas Guriev <guriev-ns@ya.ru>
Date: Thu, 6 Jul 2017 23:19:12 +0300
Subject: [PATCH 1/2] Remove deprecated call of AES_ctr128_encrypt

 * The AES_ctr128_encrypt function is not available in OpenSSL 1.1.0
   without a special compiler flag
 * Fix a small misspelling
---
 VoIPController.cpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/VoIPController.cpp b/VoIPController.cpp
index 78e9e4b..c81673f 100644
--- a/VoIPController.cpp
+++ b/VoIPController.cpp
@@ -102,6 +102,7 @@ bool VoIPController::didInitWin32TimeScale = false;
 #ifndef TGVOIP_USE_CUSTOM_CRYPTO
 #include <openssl/sha.h>
 #include <openssl/aes.h>
+#include <openssl/modes.h>
 #include <openssl/rand.h>
 
 void tgvoip_openssl_aes_ige_encrypt(uint8_t* in, uint8_t* out, size_t length, uint8_t* key, uint8_t* iv){
@@ -131,7 +132,7 @@ void tgvoip_openssl_sha256(uint8_t* msg, size_t len, uint8_t* output){
 void tgvoip_openssl_aes_ctr_encrypt(uint8_t* inout, size_t length, uint8_t* key, uint8_t* iv, uint8_t* ecount, uint32_t* num){
 	AES_KEY akey;
 	AES_set_encrypt_key(key, 32*8, &akey);
-	AES_ctr128_encrypt(inout, inout, length, &akey, iv, ecount, num);
+	CRYPTO_ctr128_encrypt(inout, inout, length, &akey, iv, ecount, num, (block128_f) AES_encrypt);
 }
 
 voip_crypto_functions_t VoIPController::crypto={
@@ -1142,7 +1143,7 @@ simpleAudioBlock random_id:long random_bytes:string raw_data:string = DecryptedA
 					if(!micMuted){
 						audioInput->Start();
 						if(!audioInput->IsInitialized()){
-							LOGE("Erorr initializing audio capture");
+							LOGE("Error initializing audio capture");
 							lastError=TGVOIP_ERROR_AUDIO_IO;
 
 							SetState(STATE_FAILED);
@@ -1150,7 +1151,7 @@ simpleAudioBlock random_id:long random_bytes:string raw_data:string = DecryptedA
 						}
 					}
 					if(!audioOutput->IsInitialized()){
-						LOGE("Erorr initializing audio playback");
+						LOGE("Error initializing audio playback");
 						lastError=TGVOIP_ERROR_AUDIO_IO;
 
 						SetState(STATE_FAILED);

From b0c6da9bdc68fd692d3a4e620a75e7f4ef10555b Mon Sep 17 00:00:00 2001
From: Nicholas Guriev <guriev-ns@ya.ru>
Date: Fri, 8 Dec 2017 23:16:12 +0300
Subject: [PATCH 2/2] Add extern "C" wrapper

It perhaps fixes build failure against ancient OpenSSL.

See also: https://github.com/openssl/openssl/commit/17e80c6
---
 VoIPController.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/VoIPController.cpp b/VoIPController.cpp
index c81673f..1003e50 100644
--- a/VoIPController.cpp
+++ b/VoIPController.cpp
@@ -100,10 +100,12 @@ bool VoIPController::didInitWin32TimeScale = false;
 #define SHA256_LENGTH 32
 
 #ifndef TGVOIP_USE_CUSTOM_CRYPTO
+extern "C" {
 #include <openssl/sha.h>
 #include <openssl/aes.h>
 #include <openssl/modes.h>
 #include <openssl/rand.h>
+}
 
 void tgvoip_openssl_aes_ige_encrypt(uint8_t* in, uint8_t* out, size_t length, uint8_t* key, uint8_t* iv){
 	AES_KEY akey;