summaryrefslogtreecommitdiffstats
path: root/chromium/net/quic/crypto/scoped_evp_cipher_ctx.h
blob: ec0fd51b92ad4e24bb2ddadb4b391f4c66a1342b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef NET_QUIC_CRYPTO_SCOPED_EVP_CIPHER_CTX_H_
#define NET_QUIC_CRYPTO_SCOPED_EVP_CIPHER_CTX_H_

typedef struct evp_cipher_ctx_st EVP_CIPHER_CTX;

namespace net {

// TODO(wtc): this is the same as the ScopedCipherCTX class defined in
// crypto/encryptor_openssl.cc.  Eliminate the duplicate code.
// crypto::ScopedOpenSSL is not suitable for EVP_CIPHER_CTX because
// there are no EVP_CIPHER_CTX_create and EVP_CIPHER_CTX_destroy
// functions.
class ScopedEVPCipherCtx {
 public:
  ScopedEVPCipherCtx();
  ~ScopedEVPCipherCtx();

  EVP_CIPHER_CTX* get() const;

 private:
  EVP_CIPHER_CTX* const ctx_;
};

}  // namespace net

#endif  // NET_QUIC_CRYPTO_SCOPED_EVP_CIPHER_CTX_H_