]> git.pld-linux.org Git - packages/srtp.git/blame - srtp-rename_functions.patch
- added ismacryp patch (include ISMAcryp functions even when using openssl for AES...
[packages/srtp.git] / srtp-rename_functions.patch
CommitLineData
49f7c35f
JK
1diff --git a/crypto/hash/hmac.c b/crypto/hash/hmac.c
2index 4f389fe..5ab81e5 100644
3--- a/crypto/hash/hmac.c
4+++ b/crypto/hash/hmac.c
5@@ -137,10 +137,10 @@ hmac_init(hmac_ctx_t *state, const uint8_t *key, int key_len) {
6 debug_print(mod_hmac, "ipad: %s", octet_string_hex_string(ipad, 64));
7
8 /* initialize sha1 context */
9- sha1_init(&state->init_ctx);
10+ srtp_sha1_init(&state->init_ctx);
11
12 /* hash ipad ^ key */
13- sha1_update(&state->init_ctx, ipad, 64);
14+ srtp_sha1_update(&state->init_ctx, ipad, 64);
15 memcpy(&state->ctx, &state->init_ctx, sizeof(sha1_ctx_t));
16
17 return err_status_ok;
18@@ -161,7 +161,7 @@ hmac_update(hmac_ctx_t *state, const uint8_t *message, int msg_octets) {
19 octet_string_hex_string(message, msg_octets));
20
21 /* hash message into sha1 context */
22- sha1_update(&state->ctx, message, msg_octets);
23+ srtp_sha1_update(&state->ctx, message, msg_octets);
24
25 return err_status_ok;
26 }
27@@ -179,7 +179,7 @@ hmac_compute(hmac_ctx_t *state, const void *message,
28
29 /* hash message, copy output into H */
30 hmac_update(state, (const uint8_t*)message, msg_octets);
31- sha1_final(&state->ctx, H);
32+ srtp_sha1_final(&state->ctx, H);
33
34 /*
35 * note that we don't need to debug_print() the input, since the
36@@ -189,16 +189,16 @@ hmac_compute(hmac_ctx_t *state, const void *message,
37 octet_string_hex_string((uint8_t *)H, 20));
38
39 /* re-initialize hash context */
40- sha1_init(&state->ctx);
41+ srtp_sha1_init(&state->ctx);
42
43 /* hash opad ^ key */
44- sha1_update(&state->ctx, (uint8_t *)state->opad, 64);
45+ srtp_sha1_update(&state->ctx, (uint8_t *)state->opad, 64);
46
47 /* hash the result of the inner hash */
48- sha1_update(&state->ctx, (uint8_t *)H, 20);
49+ srtp_sha1_update(&state->ctx, (uint8_t *)H, 20);
50
51 /* the result is returned in the array hash_value[] */
52- sha1_final(&state->ctx, hash_value);
53+ srtp_sha1_final(&state->ctx, hash_value);
54
55 /* copy hash_value to *result */
56 for (i=0; i < tag_len; i++)
57diff --git a/crypto/hash/sha1.c b/crypto/hash/sha1.c
58index b9a8d10..b1c9c8a 100644
59--- a/crypto/hash/sha1.c
60+++ b/crypto/hash/sha1.c
61@@ -74,12 +74,12 @@ uint32_t SHA_K2 = 0x8F1BBCDC; /* Kt for 40 <= t <= 59 */
62 uint32_t SHA_K3 = 0xCA62C1D6; /* Kt for 60 <= t <= 79 */
63
64 void
65-sha1(const uint8_t *msg, int octets_in_msg, uint32_t hash_value[5]) {
66+srtp_sha1(const uint8_t *msg, int octets_in_msg, uint32_t hash_value[5]) {
67 sha1_ctx_t ctx;
68
69- sha1_init(&ctx);
70- sha1_update(&ctx, msg, octets_in_msg);
71- sha1_final(&ctx, hash_value);
72+ srtp_sha1_init(&ctx);
73+ srtp_sha1_update(&ctx, msg, octets_in_msg);
74+ srtp_sha1_final(&ctx, hash_value);
75
76 }
77
78@@ -96,7 +96,7 @@ sha1(const uint8_t *msg, int octets_in_msg, uint32_t hash_value[5]) {
79 */
80
81 void
82-sha1_core(const uint32_t M[16], uint32_t hash_value[5]) {
83+srtp_sha1_core(const uint32_t M[16], uint32_t hash_value[5]) {
84 uint32_t H0;
85 uint32_t H1;
86 uint32_t H2;
87@@ -183,7 +183,7 @@ sha1_core(const uint32_t M[16], uint32_t hash_value[5]) {
88 }
89
90 void
91-sha1_init(sha1_ctx_t *ctx) {
92+srtp_sha1_init(sha1_ctx_t *ctx) {
93
94 /* initialize state vector */
95 ctx->H[0] = 0x67452301;
96@@ -201,7 +201,7 @@ sha1_init(sha1_ctx_t *ctx) {
97 }
98
99 void
100-sha1_update(sha1_ctx_t *ctx, const uint8_t *msg, int octets_in_msg) {
101+srtp_sha1_update(sha1_ctx_t *ctx, const uint8_t *msg, int octets_in_msg) {
102 int i;
103 uint8_t *buf = (uint8_t *)ctx->M;
104
105@@ -226,7 +226,7 @@ sha1_update(sha1_ctx_t *ctx, const uint8_t *msg, int octets_in_msg) {
106
107 debug_print(mod_sha1, "(update) running sha1_core()", NULL);
108
109- sha1_core(ctx->M, ctx->H);
110+ srtp_sha1_core(ctx->M, ctx->H);
111
112 } else {
113
114@@ -249,7 +249,7 @@ sha1_update(sha1_ctx_t *ctx, const uint8_t *msg, int octets_in_msg) {
115 */
116
117 void
118-sha1_final(sha1_ctx_t *ctx, uint32_t *output) {
119+srtp_sha1_final(sha1_ctx_t *ctx, uint32_t *output) {
120 uint32_t A, B, C, D, E, TEMP;
121 uint32_t W[80];
122 int i, t;
123diff --git a/crypto/include/sha1.h b/crypto/include/sha1.h
124index e3af4d4..af59b7e 100644
125--- a/crypto/include/sha1.h
126+++ b/crypto/include/sha1.h
d6631e47
JB
127@@ -72,18 +72,18 @@ typedef EVP_MD_CTX sha1_ctx_t;
128 *
129 */
130
131-static inline void sha1_init (sha1_ctx_t *ctx)
132+static inline void srtp_sha1_init (sha1_ctx_t *ctx)
133 {
134 EVP_MD_CTX_init(ctx);
135 EVP_DigestInit(ctx, EVP_sha1());
136 }
137
138-static inline void sha1_update (sha1_ctx_t *ctx, const uint8_t *M, int octets_in_msg)
139+static inline void srtp_sha1_update (sha1_ctx_t *ctx, const uint8_t *M, int octets_in_msg)
140 {
141 EVP_DigestUpdate(ctx, M, octets_in_msg);
142 }
143
144-static inline void sha1_final (sha1_ctx_t *ctx, uint32_t *output)
145+static inline void srtp_sha1_final (sha1_ctx_t *ctx, uint32_t *output)
146 {
147 unsigned int len = 0;
148
149@@ -107,7 +107,7 @@
49f7c35f
JK
150 */
151
152 void
153-sha1(const uint8_t *message, int octets_in_msg, uint32_t output[5]);
154+srtp_sha1(const uint8_t *message, int octets_in_msg, uint32_t output[5]);
155
156 /*
157 * sha1_init(&ctx) initializes the SHA1 context ctx
d6631e47 158@@ -121,13 +121,13 @@
49f7c35f
JK
159 */
160
161 void
162-sha1_init(sha1_ctx_t *ctx);
163+srtp_sha1_init(sha1_ctx_t *ctx);
164
165 void
166-sha1_update(sha1_ctx_t *ctx, const uint8_t *M, int octets_in_msg);
167+srtp_sha1_update(sha1_ctx_t *ctx, const uint8_t *M, int octets_in_msg);
168
169 void
170-sha1_final(sha1_ctx_t *ctx, uint32_t output[5]);
171+srtp_sha1_final(sha1_ctx_t *ctx, uint32_t output[5]);
172
173 /*
174 * The sha1_core function is INTERNAL to SHA-1, but it is declared
d6631e47 175@@ -145,7 +145,7 @@
49f7c35f
JK
176 */
177
178 void
179-sha1_core(const uint32_t M[16], uint32_t hash_value[5]);
180+srtp_sha1_core(const uint32_t M[16], uint32_t hash_value[5]);
d6631e47
JB
181
182 #endif /* else OPENSSL */
49f7c35f 183
49f7c35f
JK
184diff --git a/crypto/test/sha1_driver.c b/crypto/test/sha1_driver.c
185index 6036022..f29d76e 100644
186--- a/crypto/test/sha1_driver.c
187+++ b/crypto/test/sha1_driver.c
188@@ -107,9 +107,9 @@ sha1_test_case_validate(const hash_test_case_t *test_case) {
189 if (test_case->data_len > MAX_HASH_DATA_LEN)
190 return err_status_bad_param;
191
192- sha1_init(&ctx);
193- sha1_update(&ctx, test_case->data, test_case->data_len);
194- sha1_final(&ctx, hash_value);
195+ srtp_sha1_init(&ctx);
196+ srtp_sha1_update(&ctx, test_case->data, test_case->data_len);
197+ srtp_sha1_final(&ctx, hash_value);
198 if (0 == memcmp(test_case->hash, hash_value, 20)) {
199 #if VERBOSE
200 printf("PASSED: reference value: %s\n",
d6631e47
JB
201--- libsrtp-1.5.2/crypto/hash/hmac_ossl.c.orig 2015-03-11 15:02:12.000000000 +0100
202+++ libsrtp-1.5.2/crypto/hash/hmac_ossl.c 2015-07-05 20:23:10.490406837 +0200
203@@ -163,11 +163,11 @@ hmac_init (hmac_ctx_t *state, const uint
204 debug_print(mod_hmac, "ipad: %s", octet_string_hex_string(ipad, sizeof(ipad)));
205
206 /* initialize sha1 context */
207- sha1_init(&state->init_ctx);
208+ srtp_sha1_init(&state->init_ctx);
209 state->init_ctx_initialized = 1;
210
211 /* hash ipad ^ key */
212- sha1_update(&state->init_ctx, ipad, sizeof(ipad));
213+ srtp_sha1_update(&state->init_ctx, ipad, sizeof(ipad));
214 return (hmac_start(state));
215 }
216
217@@ -192,7 +192,7 @@ hmac_update (hmac_ctx_t *state, const ui
218 octet_string_hex_string(message, msg_octets));
219
220 /* hash message into sha1 context */
221- sha1_update(&state->ctx, message, msg_octets);
222+ srtp_sha1_update(&state->ctx, message, msg_octets);
223
224 return err_status_ok;
225 }
226@@ -211,8 +211,8 @@ hmac_compute (hmac_ctx_t *state, const v
227 }
228
229 /* hash message, copy output into H */
230- sha1_update(&state->ctx, message, msg_octets);
231- sha1_final(&state->ctx, H);
232+ srtp_sha1_update(&state->ctx, message, msg_octets);
233+ srtp_sha1_final(&state->ctx, H);
234
235 /*
236 * note that we don't need to debug_print() the input, since the
237@@ -222,16 +222,16 @@ hmac_compute (hmac_ctx_t *state, const v
238 octet_string_hex_string((uint8_t*)H, sizeof(H)));
239
240 /* re-initialize hash context */
241- sha1_init(&state->ctx);
242+ srtp_sha1_init(&state->ctx);
243
244 /* hash opad ^ key */
245- sha1_update(&state->ctx, (uint8_t*)state->opad, sizeof(state->opad));
246+ srtp_sha1_update(&state->ctx, (uint8_t*)state->opad, sizeof(state->opad));
247
248 /* hash the result of the inner hash */
249- sha1_update(&state->ctx, (uint8_t*)H, sizeof(H));
250+ srtp_sha1_update(&state->ctx, (uint8_t*)H, sizeof(H));
251
252 /* the result is returned in the array hash_value[] */
253- sha1_final(&state->ctx, hash_value);
254+ srtp_sha1_final(&state->ctx, hash_value);
255
256 /* copy hash_value to *result */
257 for (i = 0; i < tag_len; i++) {
This page took 0.058539 seconds and 4 git commands to generate.