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

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

Issue 1028873002: Use uint32_t to hold return values from ERR_get_error() and ERR_peek_error(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « net/cert/test_root_certs_openssl.cc ('k') | net/tools/flip_server/spdy_ssl.cc » ('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"
11 11
12 using base::StringPiece; 12 using base::StringPiece;
13 13
14 namespace net { 14 namespace net {
15 15
16 namespace { 16 namespace {
17 17
18 // Clear OpenSSL error stack. 18 // Clear OpenSSL error stack.
19 void ClearOpenSslErrors() { 19 void ClearOpenSslErrors() {
20 while (ERR_get_error()) {} 20 while (ERR_get_error()) {}
21 } 21 }
22 22
23 // In debug builds only, log OpenSSL error stack. Then clear OpenSSL error 23 // In debug builds only, log OpenSSL error stack. Then clear OpenSSL error
24 // stack. 24 // stack.
25 void DLogOpenSslErrors() { 25 void DLogOpenSslErrors() {
26 #ifdef NDEBUG 26 #ifdef NDEBUG
27 ClearOpenSslErrors(); 27 ClearOpenSslErrors();
28 #else 28 #else
29 while (unsigned long error = ERR_get_error()) { 29 while (uint32_t error = ERR_get_error()) {
30 char buf[120]; 30 char buf[120];
31 ERR_error_string_n(error, buf, arraysize(buf)); 31 ERR_error_string_n(error, buf, arraysize(buf));
32 DLOG(ERROR) << "OpenSSL error: " << buf; 32 DLOG(ERROR) << "OpenSSL error: " << buf;
33 } 33 }
34 #endif 34 #endif
35 } 35 }
36 36
37 } // namespace 37 } // namespace
38 38
39 AeadBaseDecrypter::AeadBaseDecrypter(const EVP_AEAD* aead_alg, 39 AeadBaseDecrypter::AeadBaseDecrypter(const EVP_AEAD* aead_alg,
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 StringPiece AeadBaseDecrypter::GetNoncePrefix() const { 129 StringPiece AeadBaseDecrypter::GetNoncePrefix() const {
130 if (nonce_prefix_size_ == 0) { 130 if (nonce_prefix_size_ == 0) {
131 return StringPiece(); 131 return StringPiece();
132 } 132 }
133 return StringPiece(reinterpret_cast<const char*>(nonce_prefix_), 133 return StringPiece(reinterpret_cast<const char*>(nonce_prefix_),
134 nonce_prefix_size_); 134 nonce_prefix_size_);
135 } 135 }
136 136
137 } // namespace net 137 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/test_root_certs_openssl.cc ('k') | net/tools/flip_server/spdy_ssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698