Skip to content

Commit

Permalink
Add a warning about Decrypt() being used as a padding oracle.
Browse files Browse the repository at this point in the history
R=agl@chromium.org,rsleevi@chromium.org
BUG=124434
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10216004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133822 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
wtc@chromium.org committed Apr 25, 2012
1 parent 488d87a commit ef06774
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crypto/encryptor.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

Expand Down Expand Up @@ -70,6 +70,14 @@ class CRYPTO_EXPORT Encryptor {
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
Expand Down

0 comments on commit ef06774

Please sign in to comment.