Remove message_key from PacketInfo.
This commit is contained in:
parent
00258ccb4c
commit
31f778e040
@ -7,7 +7,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "td/utils/common.h"
|
#include "td/utils/common.h"
|
||||||
#include "td/utils/UInt.h"
|
|
||||||
|
|
||||||
namespace td {
|
namespace td {
|
||||||
namespace mtproto {
|
namespace mtproto {
|
||||||
@ -16,7 +15,6 @@ struct PacketInfo {
|
|||||||
enum { Common, EndToEnd } type = Common;
|
enum { Common, EndToEnd } type = Common;
|
||||||
uint64 auth_key_id{0};
|
uint64 auth_key_id{0};
|
||||||
uint32 message_ack{0};
|
uint32 message_ack{0};
|
||||||
UInt128 message_key;
|
|
||||||
|
|
||||||
uint64 salt{0};
|
uint64 salt{0};
|
||||||
uint64 session_id{0};
|
uint64 session_id{0};
|
||||||
|
@ -362,19 +362,13 @@ void Transport::write_crypto_impl(int X, const Storer &storer, const AuthKey &au
|
|||||||
Random::secure_bytes(pad.ubegin(), pad.size());
|
Random::secure_bytes(pad.ubegin(), pad.size());
|
||||||
MutableSlice to_encrypt = MutableSlice(header->encrypt_begin(), pad.uend());
|
MutableSlice to_encrypt = MutableSlice(header->encrypt_begin(), pad.uend());
|
||||||
|
|
||||||
if (info->version == 1) {
|
|
||||||
std::tie(info->message_ack, info->message_key) = calc_message_ack_and_key(*header, data_size);
|
|
||||||
} else {
|
|
||||||
std::tie(info->message_ack, info->message_key) = calc_message_key2(auth_key, X, to_encrypt);
|
|
||||||
}
|
|
||||||
|
|
||||||
header->message_key = info->message_key;
|
|
||||||
|
|
||||||
UInt256 aes_key;
|
UInt256 aes_key;
|
||||||
UInt256 aes_iv;
|
UInt256 aes_iv;
|
||||||
if (info->version == 1) {
|
if (info->version == 1) {
|
||||||
|
std::tie(info->message_ack, header->message_key) = calc_message_ack_and_key(*header, data_size);
|
||||||
KDF(auth_key.key(), header->message_key, X, &aes_key, &aes_iv);
|
KDF(auth_key.key(), header->message_key, X, &aes_key, &aes_iv);
|
||||||
} else {
|
} else {
|
||||||
|
std::tie(info->message_ack, header->message_key) = calc_message_key2(auth_key, X, to_encrypt);
|
||||||
KDF2(auth_key.key(), header->message_key, X, &aes_key, &aes_iv);
|
KDF2(auth_key.key(), header->message_key, X, &aes_key, &aes_iv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user