diff options
author | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-25 00:27:43 +0000 |
---|---|---|
committer | wtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-25 00:27:43 +0000 |
commit | ef0677461317a62669425e562a59c9a6e27cbe29 (patch) | |
tree | a124bd43452dc50b1b1e25b78cc3df60f6f32b8b /crypto | |
parent | 488d87a60b0404972c96fc4e5dbdf5b6c55cee9e (diff) | |
download | chromium_src-ef0677461317a62669425e562a59c9a6e27cbe29.zip chromium_src-ef0677461317a62669425e562a59c9a6e27cbe29.tar.gz chromium_src-ef0677461317a62669425e562a59c9a6e27cbe29.tar.bz2 |
Add a warning about Decrypt() being used as a padding oracle.
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
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/encryptor.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/crypto/encryptor.h b/crypto/encryptor.h index 6b23619..8a27a90 100644 --- a/crypto/encryptor.h +++ b/crypto/encryptor.h @@ -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. @@ -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 |