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

Side by Side Diff: net/quic/crypto/scoped_evp_cipher_ctx.h

Issue 14816006: Land Recent QUIC changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added missing NET_PRIVATE_EXPORT to QuicWallTime Created 7 years, 7 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
« no previous file with comments | « net/quic/crypto/quic_random.cc ('k') | net/quic/crypto/strike_register.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 #ifndef NET_QUIC_CRYPTO_SCOPED_EVP_CIPHER_CTX_H_ 5 #ifndef NET_QUIC_CRYPTO_SCOPED_EVP_CIPHER_CTX_H_
6 #define NET_QUIC_CRYPTO_SCOPED_EVP_CIPHER_CTX_H_ 6 #define NET_QUIC_CRYPTO_SCOPED_EVP_CIPHER_CTX_H_
7 7
8 #include <openssl/evp.h> 8 #include <openssl/evp.h>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
11 11
12 namespace net { 12 namespace net {
13 13
14 // TODO(wtc): this is the same as the ScopedCipherCTX class defined in 14 // TODO(wtc): this is the same as the ScopedCipherCTX class defined in
15 // crypto/encryptor_openssl.cc. Eliminate the duplicate code. 15 // crypto/encryptor_openssl.cc. Eliminate the duplicate code.
16 // crypto::ScopedOpenSSL is not suitable for EVP_CIPHER_CTX because 16 // crypto::ScopedOpenSSL is not suitable for EVP_CIPHER_CTX because
17 // there are no EVP_CIPHER_CTX_create and EVP_CIPHER_CTX_destroy 17 // there are no EVP_CIPHER_CTX_create and EVP_CIPHER_CTX_destroy
18 // functions. 18 // functions.
19 class ScopedEVPCipherCtx { 19 class ScopedEVPCipherCtx {
20 public: 20 public:
21 ScopedEVPCipherCtx() { 21 ScopedEVPCipherCtx() { EVP_CIPHER_CTX_init(&ctx_); }
22 EVP_CIPHER_CTX_init(&ctx_);
23 }
24 22
25 ~ScopedEVPCipherCtx() { 23 ~ScopedEVPCipherCtx() {
26 int rv = EVP_CIPHER_CTX_cleanup(&ctx_); 24 int rv = EVP_CIPHER_CTX_cleanup(&ctx_);
27 DCHECK_EQ(rv, 1); 25 DCHECK_EQ(rv, 1);
28 } 26 }
29 27
30 EVP_CIPHER_CTX* get() { return &ctx_; } 28 EVP_CIPHER_CTX* get() { return &ctx_; }
31 29
32 private: 30 private:
33 EVP_CIPHER_CTX ctx_; 31 EVP_CIPHER_CTX ctx_;
34 }; 32 };
35 33
36 } // namespace net 34 } // namespace net
37 35
38 #endif // NET_QUIC_CRYPTO_SCOPED_EVP_CIPHER_CTX_H_ 36 #endif // NET_QUIC_CRYPTO_SCOPED_EVP_CIPHER_CTX_H_
OLDNEW
« no previous file with comments | « net/quic/crypto/quic_random.cc ('k') | net/quic/crypto/strike_register.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698