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 typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX; 9 10 namespace net { 11 12 // TODO(wtc): this is the same as the ScopedCipherCTX class defined in 13 // crypto/encryptor_openssl.cc. Eliminate the duplicate code. 14 // crypto::ScopedOpenSSL is not suitable for EVP_CIPHER_CTX because 15 // there are no EVP_CIPHER_CTX_create and EVP_CIPHER_CTX_destroy 16 // functions. 17 class ScopedEVPCipherCtx { 18 public: 19 ScopedEVPCipherCtx(); 20 ~ScopedEVPCipherCtx(); 21 22 EVP_CIPHER_CTX* get() const; 23 24 private: 25 EVP_CIPHER_CTX* const ctx_; 26 }; 27 28 } // namespace net 29 30 #endif // NET_QUIC_CRYPTO_SCOPED_EVP_CIPHER_CTX_H_ 31