-
Notifications
You must be signed in to change notification settings - Fork 0
/
openssl.patch
114 lines (108 loc) · 2.24 KB
/
openssl.patch
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
--- ./openssl/crypto/aes/asm/aes-armv4.pl 2016-03-12 16:02:43.000000000 +0000
+++ ./openssl/crypto/aes/asm/aes-armv4.pl_diff 2016-03-12 16:42:59.000000000 +0000
@@ -52,6 +52,11 @@
$code=<<___;
#include "arm_arch.h"
+
+#ifdef AES_TRIG
+.extern digitalWrite
+#endif /* AES_TRIG */
+
.text
.code 32
@@ -169,6 +174,17 @@
AES_encrypt:
sub r3,pc,#8 @ AES_encrypt
stmdb sp!,{r1,r4-r12,lr}
+
+ #ifdef AES_TRIG
+ @@ triggering
+ stmdb sp!,{r0-r12,lr}
+ mov r0, #0
+ mov r1, #1
+ bl digitalWrite
+ ldmia sp!,{r0-r12,lr}
+ @@ triggering
+ #endif /* AES_TRIG */
+
mov $rounds,r0 @ inp
mov $key,r2
sub $tbl,r3,#AES_encrypt-AES_Te @ Te
@@ -257,6 +273,17 @@
strb $t3,[$rounds,#14]
strb $s3,[$rounds,#15]
#endif
+
+ #ifdef AES_TRIG
+ @@ triggering
+ stmdb sp!,{r0-r12,lr}
+ mov r0, #0
+ mov r1, #0
+ bl digitalWrite
+ ldmia sp!,{r0-r12,lr}
+ @@ triggering
+ #endif /* AES_TRIG */
+
#if __ARM_ARCH__>=5
ldmia sp!,{r4-r12,pc}
#else
@@ -885,6 +912,17 @@
AES_decrypt:
sub r3,pc,#8 @ AES_decrypt
stmdb sp!,{r1,r4-r12,lr}
+
+ #ifdef AES_TRIG
+ @@ triggering
+ stmdb sp!,{r0-r12,lr}
+ mov r0, #0
+ mov r1, #1
+ bl digitalWrite
+ ldmia sp!,{r0-r12,lr}
+ @@ triggering
+ #endif /* AES_TRIG */
+
mov $rounds,r0 @ inp
mov $key,r2
sub $tbl,r3,#AES_decrypt-AES_Td @ Td
@@ -976,6 +1014,17 @@
#if __ARM_ARCH__>=5
ldmia sp!,{r4-r12,pc}
#else
+
+ #ifdef AES_TRIG
+ @@ triggering
+ stmdb sp!,{r0-r12,lr}
+ mov r0, #0
+ mov r1, #0
+ bl digitalWrite
+ ldmia sp!,{r0-r12,lr}
+ @@ triggering
+ #endif /* AES_TRIG */
+
ldmia sp!,{r4-r12,lr}
tst lr,#1
moveq pc,lr @ be binary compatible with V4, yet
--- ./openssl/crypto/conf/conf_lib.c 2016-03-11 17:36:23.000000000 +0000
+++ ./openssl/crypto/conf/conf_lib.c_diff 2016-03-12 16:12:23.000000000 +0000
@@ -64,6 +64,11 @@
#include <openssl/conf_api.h>
#include <openssl/lhash.h>
+#ifdef AES_TRIG
+// Header for GPIO functions
+#include <wiringPi.h>
+#endif /* AES_TRIG */
+
const char CONF_version[] = "CONF" OPENSSL_VERSION_PTEXT;
static CONF_METHOD *default_CONF_method = NULL;
@@ -229,6 +234,13 @@
{
CONF *ret;
+ #ifdef AES_TRIG
+ // Setup GPIO
+ wiringPiSetup ();
+ pinMode(0, OUTPUT);
+ #endif /* AES_TRIG */
+
+
if (meth == NULL)
meth = NCONF_default();