#1000309 Package: libcrypto++8, function DefaultDecryptorWithMAC (modern algorithm)

Package:
libcrypto++8
Source:
libcrypto++
Description:
General purpose cryptographic library - shared library
Submitter:
Jurij Ivastsuk-Kienbaum
Date:
2021-11-22 13:57:03 UTC
Severity:
normal
#1000309#5
Date:
2021-11-21 09:05:09 UTC
From:
To:
Package: libcrypto++8:amd64  8.6.0-2

I am developing a program that encrypts and decrypts data using
libcrypto++ library.
Since the version libcrypto++5.7 the functionality of some functions has
changed.
I tested the new functions in the package libcrypto++8 (8.6.0-2) and
found a bug:

The tested functions are as follows:

DefaultEncryptorWithMac (modern algorithm)
DefaultDecryptorWithMac (modern algorithm)
LegacyEncryptorWithMac
LegacyDecryptorWithMac

For all my tests I used the same pseudo-code and always the same input-data:
------------------------------------------------------------------------------
Bytef* crypted_data;    //buffer filed with encrypted data 16432 byte
stringstream ost, oost;
unsigned int crypted_block_size = 16432;
string s_salt =
"T716cPzRRPXB43O0VJ7ByQKT6iDXehk6jxHEqfd2Frk53Mfn3h27lJF4HxFlA80uhlCBOkPGhEQb1ZORDNvdui6qAZdcdUYpNmI0AJIxmddHTUWy798Fywvlm3IXbhlg";
const char* c_salt = s_salt.c_str();
unsigned int i;

for (i = 0; i < crypted_block_size; i++)
{
     ost.put(crypted_data[i]);
}

DecryptFile(istream& ost, ostream& oost, const char* c_salt)
{
     FileSource f(ost, true, new DefaultDecryptorWithMAC(c_salt, new
FileSink(oost)));
}
------------------------------------------------------------------------------

Results:

Encyption: DefaultEncryptorWithMac (modern algorithm) works OK.
Decryption: DefaultDecryptorWithMac (modern algorithm) error: exception
'CryptoPP::KeyBadErr'
Encryption: LegacyEncryptorWithMac works OK.
Decription: LegacyDecryptorWithMac works OK.

I suggest that the, function DefaultDecryptorWithMAC (modern algorithm)
in libcrypto++8 be corrected.

Regards,
Jurij