Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Unified Diff: crypto/encryptor.h

Issue 10216004: Add a warning about Decrypt() being used as a padding oracle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Improve comment Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: crypto/encryptor.h
===================================================================
--- crypto/encryptor.h (revision 133713)
+++ crypto/encryptor.h (working copy)
@@ -70,6 +70,14 @@
bool Encrypt(const base::StringPiece& plaintext, std::string* ciphertext);
// Decrypts |ciphertext| into |plaintext|. |ciphertext| must not be empty.
+ //
+ // WARNING: In CBC mode, Decrypt() returns false if it detects the padding
+ // in the decrypted plaintext is wrong. Padding errors can result from
+ // tampered ciphertext or a wrong decryption key. But successful decryption
+ // does not imply the authenticity of the data. The caller of Decrypt()
+ // must either authenticate the ciphertext before decrypting it, or take
+ // care to not report decryption failure. Otherwise it could inadvertently
+ // be used as a padding oracle to attack the cryptosystem.
bool Decrypt(const base::StringPiece& ciphertext, std::string* plaintext);
// Sets the counter value when in CTR mode. Currently only 128-bits
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698