Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
tg
Commits
3c6423aa
Commit
3c6423aa
authored
Jan 24, 2014
by
vysheng
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #42 from antma/master
AES_KEY structure clean up
parents
bc8e97cd
8b4085ff
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
mtproto-common.c
mtproto-common.c
+2
-0
queries.c
queries.c
+5
-4
structures.c
structures.c
+1
-0
No files found.
mtproto-common.c
View file @
3c6423aa
...
...
@@ -348,6 +348,7 @@ void init_aes_unauth (const char server_nonce[16], const char hidden_client_nonc
}
else
{
AES_set_decrypt_key
(
aes_key_raw
,
32
*
8
,
&
aes_key
);
}
memset
(
aes_key_raw
,
0
,
sizeof
(
aes_key_raw
));
}
void
init_aes_auth
(
char
auth_key
[
192
],
char
msg_key
[
16
],
int
encrypt
)
{
...
...
@@ -387,6 +388,7 @@ void init_aes_auth (char auth_key[192], char msg_key[16], int encrypt) {
}
else
{
AES_set_decrypt_key
(
aes_key_raw
,
32
*
8
,
&
aes_key
);
}
memset
(
aes_key_raw
,
0
,
sizeof
(
aes_key_raw
));
}
int
pad_aes_encrypt
(
char
*
from
,
int
from_len
,
char
*
to
,
int
size
)
{
...
...
queries.c
View file @
3c6423aa
...
...
@@ -746,6 +746,7 @@ char *encrypt_decrypted_message (struct secret_chat *E) {
AES_KEY
aes_key
;
AES_set_encrypt_key
(
key
,
256
,
&
aes_key
);
AES_ige_encrypt
((
void
*
)
encr_ptr
,
(
void
*
)
encr_ptr
,
4
*
(
encr_end
-
encr_ptr
),
&
aes_key
,
iv
,
1
);
memset
(
&
aes_key
,
0
,
sizeof
(
aes_key
));
return
(
void
*
)
msg_key
;
}
...
...
@@ -1290,15 +1291,14 @@ void send_part (struct send_file *f) {
if
(
f
->
encr
)
{
if
(
x
&
15
)
{
assert
(
f
->
offset
==
f
->
size
);
if
(
x
&
15
)
{
secure_random
(
buf
+
x
,
(
-
x
)
&
15
);
x
=
(
x
+
15
)
&
~
15
;
}
secure_random
(
buf
+
x
,
(
-
x
)
&
15
);
x
=
(
x
+
15
)
&
~
15
;
}
AES_KEY
aes_key
;
AES_set_encrypt_key
(
f
->
key
,
256
,
&
aes_key
);
AES_ige_encrypt
((
void
*
)
buf
,
(
void
*
)
buf
,
x
,
&
aes_key
,
f
->
iv
,
1
);
memset
(
&
aes_key
,
0
,
sizeof
(
aes_key
));
}
out_cstring
(
buf
,
x
);
if
(
verbosity
>=
2
)
{
...
...
@@ -1803,6 +1803,7 @@ int download_on_answer (struct query *q) {
AES_KEY
aes_key
;
AES_set_decrypt_key
(
D
->
key
,
256
,
&
aes_key
);
AES_ige_encrypt
(
ptr
,
ptr
,
len
,
&
aes_key
,
D
->
iv
,
0
);
memset
(
&
aes_key
,
0
,
sizeof
(
aes_key
));
if
(
len
>
D
->
size
-
D
->
offset
)
{
len
=
D
->
size
-
D
->
offset
;
}
...
...
structures.c
View file @
3c6423aa
...
...
@@ -1376,6 +1376,7 @@ int decrypt_encrypted_message (struct secret_chat *E) {
AES_KEY
aes_key
;
AES_set_decrypt_key
(
key
,
256
,
&
aes_key
);
AES_ige_encrypt
((
void
*
)
decr_ptr
,
(
void
*
)
decr_ptr
,
4
*
(
decr_end
-
decr_ptr
),
&
aes_key
,
iv
,
0
);
memset
(
&
aes_key
,
0
,
sizeof
(
aes_key
));
int
x
=
*
(
decr_ptr
);
if
(
x
<
0
||
(
x
&
3
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment