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

Side by Side Diff: trunk/src/net/quic/crypto/aead_base_encrypter_openssl.cc

Issue 405503002: Revert 283813 "Switch to BoringSSL." (Closed) Base URL: svn://svn.chromium.org/chrome/
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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/quic/crypto/aead_base_encrypter.h" 5 #include "net/quic/crypto/aead_base_encrypter.h"
6 6
7 #include <openssl/err.h> 7 #include <openssl/err.h>
8 #include <openssl/evp.h> 8 #include <openssl/evp.h>
9 #include <string.h> 9 #include <string.h>
10 10
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 74 }
75 75
76 bool AeadBaseEncrypter::Encrypt(StringPiece nonce, 76 bool AeadBaseEncrypter::Encrypt(StringPiece nonce,
77 StringPiece associated_data, 77 StringPiece associated_data,
78 StringPiece plaintext, 78 StringPiece plaintext,
79 unsigned char* output) { 79 unsigned char* output) {
80 if (nonce.size() != nonce_prefix_size_ + sizeof(QuicPacketSequenceNumber)) { 80 if (nonce.size() != nonce_prefix_size_ + sizeof(QuicPacketSequenceNumber)) {
81 return false; 81 return false;
82 } 82 }
83 83
84 size_t len; 84 ssize_t len = EVP_AEAD_CTX_seal(
85 if (!EVP_AEAD_CTX_seal( 85 ctx_.get(), output, plaintext.size() + auth_tag_size_,
86 ctx_.get(), 86 reinterpret_cast<const uint8_t*>(nonce.data()), nonce.size(),
87 output, 87 reinterpret_cast<const uint8_t*>(plaintext.data()), plaintext.size(),
88 &len, 88 reinterpret_cast<const uint8_t*>(associated_data.data()),
89 plaintext.size() + auth_tag_size_, 89 associated_data.size());
90 reinterpret_cast<const uint8_t*>(nonce.data()), 90
91 nonce.size(), 91 if (len < 0) {
92 reinterpret_cast<const uint8_t*>(plaintext.data()),
93 plaintext.size(),
94 reinterpret_cast<const uint8_t*>(associated_data.data()),
95 associated_data.size())) {
96 DLogOpenSslErrors(); 92 DLogOpenSslErrors();
97 return false; 93 return false;
98 } 94 }
99 95
100 return true; 96 return true;
101 } 97 }
102 98
103 QuicData* AeadBaseEncrypter::EncryptPacket( 99 QuicData* AeadBaseEncrypter::EncryptPacket(
104 QuicPacketSequenceNumber sequence_number, 100 QuicPacketSequenceNumber sequence_number,
105 StringPiece associated_data, 101 StringPiece associated_data,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 139
144 StringPiece AeadBaseEncrypter::GetNoncePrefix() const { 140 StringPiece AeadBaseEncrypter::GetNoncePrefix() const {
145 if (nonce_prefix_size_ == 0) { 141 if (nonce_prefix_size_ == 0) {
146 return StringPiece(); 142 return StringPiece();
147 } 143 }
148 return StringPiece(reinterpret_cast<const char*>(nonce_prefix_), 144 return StringPiece(reinterpret_cast<const char*>(nonce_prefix_),
149 nonce_prefix_size_); 145 nonce_prefix_size_);
150 } 146 }
151 147
152 } // namespace net 148 } // namespace net
OLDNEW
« no previous file with comments | « trunk/src/net/quic/crypto/aead_base_decrypter_openssl.cc ('k') | trunk/src/net/socket/openssl_ssl_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698