|
|
@ -1035,7 +1035,7 @@ decrypt(const std::string &ciphertext,
|
|
|
|
bool authenticated)
|
|
|
|
bool authenticated)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
const size_t prefix_size = sizeof(chacha8_iv)
|
|
|
|
const size_t prefix_size = sizeof(chacha_iv)
|
|
|
|
+ (authenticated ? sizeof(crypto::signature) : 0);
|
|
|
|
+ (authenticated ? sizeof(crypto::signature) : 0);
|
|
|
|
if (ciphertext.size() < prefix_size)
|
|
|
|
if (ciphertext.size() < prefix_size)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -1043,10 +1043,10 @@ decrypt(const std::string &ciphertext,
|
|
|
|
return {};
|
|
|
|
return {};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
crypto::chacha8_key key;
|
|
|
|
crypto::chacha_key key;
|
|
|
|
crypto::generate_chacha8_key(&skey, sizeof(skey), key);
|
|
|
|
crypto::generate_chacha_key(&skey, sizeof(skey), key);
|
|
|
|
|
|
|
|
|
|
|
|
const crypto::chacha8_iv &iv = *(const crypto::chacha8_iv*)&ciphertext[0];
|
|
|
|
const crypto::chacha_iv &iv = *(const crypto::chacha_iv*)&ciphertext[0];
|
|
|
|
|
|
|
|
|
|
|
|
std::string plaintext;
|
|
|
|
std::string plaintext;
|
|
|
|
|
|
|
|
|
|
|
|