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

Side by Side Diff: net/quic/crypto/aead_base_decrypter_openssl.cc

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef Created 5 years 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
« no previous file with comments | « net/quic/crypto/aead_base_decrypter_nss.cc ('k') | net/quic/crypto/aead_base_encrypter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_decrypter.h" 5 #include "net/quic/crypto/aead_base_decrypter.h"
6 6
7 #include <openssl/err.h> 7 #include <openssl/err.h>
8 #include <openssl/evp.h> 8 #include <openssl/evp.h>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 bool AeadBaseDecrypter::DecryptPacket(QuicPacketNumber packet_number, 80 bool AeadBaseDecrypter::DecryptPacket(QuicPacketNumber packet_number,
81 const StringPiece& associated_data, 81 const StringPiece& associated_data,
82 const StringPiece& ciphertext, 82 const StringPiece& ciphertext,
83 char* output, 83 char* output,
84 size_t* output_length, 84 size_t* output_length,
85 size_t max_output_length) { 85 size_t max_output_length) {
86 if (ciphertext.length() < auth_tag_size_) { 86 if (ciphertext.length() < auth_tag_size_) {
87 return false; 87 return false;
88 } 88 }
89 89
90 uint8 nonce[sizeof(nonce_prefix_) + sizeof(packet_number)]; 90 uint8_t nonce[sizeof(nonce_prefix_) + sizeof(packet_number)];
91 const size_t nonce_size = nonce_prefix_size_ + sizeof(packet_number); 91 const size_t nonce_size = nonce_prefix_size_ + sizeof(packet_number);
92 memcpy(nonce, nonce_prefix_, nonce_prefix_size_); 92 memcpy(nonce, nonce_prefix_, nonce_prefix_size_);
93 memcpy(nonce + nonce_prefix_size_, &packet_number, sizeof(packet_number)); 93 memcpy(nonce + nonce_prefix_size_, &packet_number, sizeof(packet_number));
94 if (!EVP_AEAD_CTX_open( 94 if (!EVP_AEAD_CTX_open(
95 ctx_.get(), reinterpret_cast<uint8_t*>(output), output_length, 95 ctx_.get(), reinterpret_cast<uint8_t*>(output), output_length,
96 max_output_length, reinterpret_cast<const uint8_t*>(nonce), 96 max_output_length, reinterpret_cast<const uint8_t*>(nonce),
97 nonce_size, reinterpret_cast<const uint8_t*>(ciphertext.data()), 97 nonce_size, reinterpret_cast<const uint8_t*>(ciphertext.data()),
98 ciphertext.size(), 98 ciphertext.size(),
99 reinterpret_cast<const uint8_t*>(associated_data.data()), 99 reinterpret_cast<const uint8_t*>(associated_data.data()),
100 associated_data.size())) { 100 associated_data.size())) {
(...skipping 11 matching lines...) Expand all
112 112
113 StringPiece AeadBaseDecrypter::GetNoncePrefix() const { 113 StringPiece AeadBaseDecrypter::GetNoncePrefix() const {
114 if (nonce_prefix_size_ == 0) { 114 if (nonce_prefix_size_ == 0) {
115 return StringPiece(); 115 return StringPiece();
116 } 116 }
117 return StringPiece(reinterpret_cast<const char*>(nonce_prefix_), 117 return StringPiece(reinterpret_cast<const char*>(nonce_prefix_),
118 nonce_prefix_size_); 118 nonce_prefix_size_);
119 } 119 }
120 120
121 } // namespace net 121 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/aead_base_decrypter_nss.cc ('k') | net/quic/crypto/aead_base_encrypter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698