summaryrefslogtreecommitdiffstats
path: root/net/quic/crypto/aead_base_encrypter_openssl.cc
diff options
context:
space:
mode:
Diffstat (limited to 'net/quic/crypto/aead_base_encrypter_openssl.cc')
-rw-r--r--net/quic/crypto/aead_base_encrypter_openssl.cc20
1 files changed, 12 insertions, 8 deletions
diff --git a/net/quic/crypto/aead_base_encrypter_openssl.cc b/net/quic/crypto/aead_base_encrypter_openssl.cc
index 9f053ab..7f2d3c6 100644
--- a/net/quic/crypto/aead_base_encrypter_openssl.cc
+++ b/net/quic/crypto/aead_base_encrypter_openssl.cc
@@ -81,14 +81,18 @@ bool AeadBaseEncrypter::Encrypt(StringPiece nonce,
return false;
}
- ssize_t len = EVP_AEAD_CTX_seal(
- ctx_.get(), output, plaintext.size() + auth_tag_size_,
- reinterpret_cast<const uint8_t*>(nonce.data()), nonce.size(),
- reinterpret_cast<const uint8_t*>(plaintext.data()), plaintext.size(),
- reinterpret_cast<const uint8_t*>(associated_data.data()),
- associated_data.size());
-
- if (len < 0) {
+ size_t len;
+ if (!EVP_AEAD_CTX_seal(
+ ctx_.get(),
+ output,
+ &len,
+ plaintext.size() + auth_tag_size_,
+ reinterpret_cast<const uint8_t*>(nonce.data()),
+ nonce.size(),
+ reinterpret_cast<const uint8_t*>(plaintext.data()),
+ plaintext.size(),
+ reinterpret_cast<const uint8_t*>(associated_data.data()),
+ associated_data.size())) {
DLogOpenSslErrors();
return false;
}