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

Unified Diff: content/child/webcrypto/platform_crypto_openssl.cc

Issue 406693004: Revert "Switch to BoringSSL." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | « chrome/chrome_common.gypi ('k') | content/content_child.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/webcrypto/platform_crypto_openssl.cc
diff --git a/content/child/webcrypto/platform_crypto_openssl.cc b/content/child/webcrypto/platform_crypto_openssl.cc
index 83140538d86cfc8a96ba3c36f418b300d2bcd10d..89212ea55b201472c878c2e6edfe1431ed913223 100644
--- a/content/child/webcrypto/platform_crypto_openssl.cc
+++ b/content/child/webcrypto/platform_crypto_openssl.cc
@@ -53,10 +53,12 @@ class SymKey : public Key {
namespace {
const EVP_CIPHER* GetAESCipherByKeyLength(unsigned int key_length_bytes) {
- // OpenSSL supports AES CBC ciphers for only 2 key lengths: 128, 256 bits
+ // OpenSSL supports AES CBC ciphers for only 3 key lengths: 128, 192, 256 bits
switch (key_length_bytes) {
case 16:
return EVP_aes_128_cbc();
+ case 24:
+ return EVP_aes_192_cbc();
case 32:
return EVP_aes_256_cbc();
default:
@@ -437,8 +439,7 @@ Status EncryptDecryptAesGcm(EncryptOrDecrypt mode,
crypto::ScopedOpenSSL<EVP_AEAD_CTX, EVP_AEAD_CTX_cleanup>::Type ctx_cleanup(
&ctx);
- size_t len;
- int ok;
+ ssize_t len;
if (mode == DECRYPT) {
if (data.byte_length() < tag_length_bytes)
@@ -446,34 +447,32 @@ Status EncryptDecryptAesGcm(EncryptOrDecrypt mode,
buffer->resize(data.byte_length() - tag_length_bytes);
- ok = EVP_AEAD_CTX_open(&ctx,
- Uint8VectorStart(buffer),
- &len,
- buffer->size(),
- iv.bytes(),
- iv.byte_length(),
- data.bytes(),
- data.byte_length(),
- additional_data.bytes(),
- additional_data.byte_length());
+ len = EVP_AEAD_CTX_open(&ctx,
+ Uint8VectorStart(buffer),
+ buffer->size(),
+ iv.bytes(),
+ iv.byte_length(),
+ data.bytes(),
+ data.byte_length(),
+ additional_data.bytes(),
+ additional_data.byte_length());
} else {
// No need to check for unsigned integer overflow here (seal fails if
// the output buffer is too small).
buffer->resize(data.byte_length() + tag_length_bytes);
- ok = EVP_AEAD_CTX_seal(&ctx,
- Uint8VectorStart(buffer),
- &len,
- buffer->size(),
- iv.bytes(),
- iv.byte_length(),
- data.bytes(),
- data.byte_length(),
- additional_data.bytes(),
- additional_data.byte_length());
+ len = EVP_AEAD_CTX_seal(&ctx,
+ Uint8VectorStart(buffer),
+ buffer->size(),
+ iv.bytes(),
+ iv.byte_length(),
+ data.bytes(),
+ data.byte_length(),
+ additional_data.bytes(),
+ additional_data.byte_length());
}
- if (!ok)
+ if (len < 0)
return Status::OperationError();
buffer->resize(len);
return Status::Success();
« no previous file with comments | « chrome/chrome_common.gypi ('k') | content/content_child.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698