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

Unified Diff: content/child/webcrypto/openssl/aes_gcm_openssl.cc

Issue 401153002: Switch to BoringSSL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase across DEPS change 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/common/net/BUILD.gn ('k') | content/child/webcrypto/openssl/rsa_key_openssl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/webcrypto/openssl/aes_gcm_openssl.cc
diff --git a/content/child/webcrypto/openssl/aes_gcm_openssl.cc b/content/child/webcrypto/openssl/aes_gcm_openssl.cc
index de47dd8026dd019ccad32c6b4806f77c4761f4dc..0bc927bafb161498be7844a9013f9be6b0ed34b7 100644
--- a/content/child/webcrypto/openssl/aes_gcm_openssl.cc
+++ b/content/child/webcrypto/openssl/aes_gcm_openssl.cc
@@ -71,7 +71,8 @@ Status AesGcmEncryptDecrypt(EncryptOrDecrypt mode,
crypto::ScopedOpenSSL<EVP_AEAD_CTX, EVP_AEAD_CTX_cleanup>::Type ctx_cleanup(
&ctx);
- ssize_t len;
+ size_t len;
+ int ok;
if (mode == DECRYPT) {
if (data.byte_length() < tag_length_bytes)
@@ -79,32 +80,34 @@ Status AesGcmEncryptDecrypt(EncryptOrDecrypt mode,
buffer->resize(data.byte_length() - tag_length_bytes);
- 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());
+ 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());
} 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);
- 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());
+ 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());
}
- if (len < 0)
+ if (!ok)
return Status::OperationError();
buffer->resize(len);
return Status::Success();
« no previous file with comments | « chrome/common/net/BUILD.gn ('k') | content/child/webcrypto/openssl/rsa_key_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698