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
201e2dea
Commit
201e2dea
authored
Aug 29, 2014
by
vvaltman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
generate random_id with secure_random
parent
7147cf13
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
6 deletions
+13
-6
queries.c
queries.c
+13
-6
No files found.
queries.c
View file @
201e2dea
...
@@ -1570,7 +1570,9 @@ static void send_part (struct send_file *f, void *callback, void *callback_extra
...
@@ -1570,7 +1570,9 @@ static void send_part (struct send_file *f, void *callback, void *callback_extra
out_string
(
"audio"
);
out_string
(
"audio"
);
}
}
out_long
(
-
lrand48
()
*
(
1ll
<<
32
)
-
lrand48
());
long
long
r
;
tglt_secure_random
(
&
r
,
8
);
out_long
(
r
);
tglq_send_query
(
tgl_state
.
DC_working
,
packet_ptr
-
packet_buffer
,
packet_buffer
,
&
send_file_methods
,
0
,
callback
,
callback_extra
);
tglq_send_query
(
tgl_state
.
DC_working
,
packet_ptr
-
packet_buffer
,
packet_buffer
,
&
send_file_methods
,
0
,
callback
,
callback_extra
);
}
else
{
}
else
{
struct
tgl_message
*
M
=
talloc0
(
sizeof
(
*
M
));
struct
tgl_message
*
M
=
talloc0
(
sizeof
(
*
M
));
...
@@ -1581,7 +1583,8 @@ static void send_part (struct send_file *f, void *callback, void *callback_extra
...
@@ -1581,7 +1583,8 @@ static void send_part (struct send_file *f, void *callback, void *callback_extra
tgl_peer_t
*
P
=
tgl_peer_get
(
f
->
to_id
);
tgl_peer_t
*
P
=
tgl_peer_get
(
f
->
to_id
);
assert
(
P
);
assert
(
P
);
out_long
(
P
->
encr_chat
.
access_hash
);
out_long
(
P
->
encr_chat
.
access_hash
);
long
long
r
=
-
lrand48
()
*
(
1ll
<<
32
)
-
lrand48
();
long
long
r
;
tglt_secure_random
(
&
r
,
8
);
out_long
(
r
);
out_long
(
r
);
encr_start
();
encr_start
();
out_int
(
CODE_decrypted_message
);
out_int
(
CODE_decrypted_message
);
...
@@ -1715,7 +1718,7 @@ void _tgl_do_send_photo (enum tgl_message_media_type type, tgl_peer_id_t to_id,
...
@@ -1715,7 +1718,7 @@ void _tgl_do_send_photo (enum tgl_message_media_type type, tgl_peer_id_t to_id,
return
;
return
;
}
}
f
->
id
=
lrand48
()
*
(
1ll
<<
32
)
+
lrand48
(
);
tglt_secure_random
(
&
f
->
id
,
8
);
f
->
to_id
=
to_id
;
f
->
to_id
=
to_id
;
switch
(
type
)
{
switch
(
type
)
{
case
tgl_message_media_photo
:
case
tgl_message_media_photo
:
...
@@ -1821,7 +1824,9 @@ void tgl_do_forward_message (tgl_peer_id_t id, int n, void (*callback)(void *cal
...
@@ -1821,7 +1824,9 @@ void tgl_do_forward_message (tgl_peer_id_t id, int n, void (*callback)(void *cal
out_int
(
CODE_messages_forward_message
);
out_int
(
CODE_messages_forward_message
);
out_peer_id
(
id
);
out_peer_id
(
id
);
out_int
(
n
);
out_int
(
n
);
out_long
(
lrand48
()
*
(
1ll
<<
32
)
+
lrand48
());
long
long
r
;
tglt_secure_random
(
&
r
,
8
);
out_long
(
r
);
tglq_send_query
(
tgl_state
.
DC_working
,
packet_ptr
-
packet_buffer
,
packet_buffer
,
&
fwd_msg_methods
,
0
,
callback
,
callback_extra
);
tglq_send_query
(
tgl_state
.
DC_working
,
packet_ptr
-
packet_buffer
,
packet_buffer
,
&
fwd_msg_methods
,
0
,
callback
,
callback_extra
);
}
}
/* }}} */
/* }}} */
...
@@ -2414,7 +2419,9 @@ void tgl_do_add_contact (const char *phone, int phone_len, const char *first_nam
...
@@ -2414,7 +2419,9 @@ void tgl_do_add_contact (const char *phone, int phone_len, const char *first_nam
out_int
(
CODE_vector
);
out_int
(
CODE_vector
);
out_int
(
1
);
out_int
(
1
);
out_int
(
CODE_input_phone_contact
);
out_int
(
CODE_input_phone_contact
);
out_long
(
lrand48
()
*
(
1ll
<<
32
)
+
lrand48
());
long
long
r
;
tglt_secure_random
(
&
r
,
8
);
out_long
(
r
);
out_cstring
(
phone
,
phone_len
);
out_cstring
(
phone
,
phone_len
);
out_cstring
(
first_name
,
first_name_len
);
out_cstring
(
first_name
,
first_name_len
);
out_cstring
(
last_name
,
last_name_len
);
out_cstring
(
last_name
,
last_name_len
);
...
...
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