OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef NET_QUIC_CRYPTO_SCOPED_EVP_CIPHER_CTX_H_ |
| 6 #define NET_QUIC_CRYPTO_SCOPED_EVP_CIPHER_CTX_H_ |
| 7 |
| 8 #include <openssl/evp.h> |
| 9 |
| 10 #include "base/logging.h" |
| 11 |
| 12 namespace net { |
| 13 |
| 14 class ScopedEVPCipherCtx { |
| 15 public: |
| 16 ScopedEVPCipherCtx() { |
| 17 EVP_CIPHER_CTX_init(&ctx_); |
| 18 } |
| 19 |
| 20 ~ScopedEVPCipherCtx() { |
| 21 int rv = EVP_CIPHER_CTX_cleanup(&ctx_); |
| 22 DCHECK_EQ(rv, 1); |
| 23 } |
| 24 |
| 25 EVP_CIPHER_CTX* get() { return &ctx_; } |
| 26 |
| 27 private: |
| 28 EVP_CIPHER_CTX ctx_; |
| 29 }; |
| 30 |
| 31 } // namespace net |
| 32 |
| 33 #endif // NET_QUIC_CRYPTO_SCOPED_EVP_CIPHER_CTX_H_ |
OLD | NEW |