weidai11 / cryptopp

free C++ class library of cryptographic schemes
https://cryptopp.com
Other
4.67k stars 1.47k forks source link

Documentation bug #1188

Closed KevinKealy closed 1 year ago

KevinKealy commented 1 year ago

Crypto++ Issue Report

Thanks for taking the time to report an issue. Reporting issues helps us improve stability and reliability for all users, so it is a valuable contribution.

Please do not ask questions in the bug tracker. Please ask questions on the Crypto++ Users List at http://groups.google.com/forum/#!forum/cryptopp-users.

Please do not ask questions about unsupported build systems, like Autotools, CMake, Conan and NuGet. They are other people's projects. We don't know anything about them.

Please do not ask questions at Stack Overflow. We do not patrol Stack Overflow. We will not be able to answer your question.

There is a wiki page with information on filing useful bug reports. If you have some time please visit http://www.cryptopp.com/wiki/Bug_Report on the wiki. The executive summary is:

The bug report pertains to the Documentation on the wiki on the Modes of operation page.

https://cryptopp.com/wiki/Modes_of_Operation

We can see a repetition of the EAX documentation mode of operation in the GCM case below.

EAX EAX mode uses an initialization vector. You should use SetKeyWithIV instead of SetKey. For more details on the mode see CCM on the wiki.

SecByteBlock key(AES::DEFAULT_KEYLENGTH), iv(AES::BLOCKSIZE); std::memset(key, 0, key.size()); std::memset(iv, 0, iv.size());

CCM::Encryption encryptor; encryptor.SetKeyWithIV(key, key.size(), iv); GCM EAX mode uses an initialization vector. You should use SetKeyWithIV instead of SetKey. For more details on the mode see CCM on the wiki.

SecByteBlock key(AES::DEFAULT_KEYLENGTH), iv(AES::BLOCKSIZE); std::memset(key, 0, key.size()); std::memset(iv, 0, iv.size());

CCM::Encryption encryptor; encryptor.SetKeyWithIV(key, key.size(), iv);

noloader commented 1 year ago

Thanks @KevinKealy.

It looks like there were a few copy/paste errors on that page.