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

Unified Diff: net/quic/crypto/scoped_evp_cipher_ctx.h

Issue 12623017: Add Aes128GcmEncrypter and Aes128GcmDecrypter (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix build errors. Add GetKey and GetNoncePrefix. Created 7 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 side-by-side diff with in-line comments
Download patch
Index: net/quic/crypto/scoped_evp_cipher_ctx.h
===================================================================
--- net/quic/crypto/scoped_evp_cipher_ctx.h (revision 0)
+++ net/quic/crypto/scoped_evp_cipher_ctx.h (revision 0)
@@ -0,0 +1,38 @@
+// 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_
+
+#include <openssl/evp.h>
+
+#include "base/logging.h"
+
+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() {
+ EVP_CIPHER_CTX_init(&ctx_);
+ }
+
+ ~ScopedEVPCipherCtx() {
+ int rv = EVP_CIPHER_CTX_cleanup(&ctx_);
+ DCHECK_EQ(rv, 1);
+ }
+
+ EVP_CIPHER_CTX* get() { return &ctx_; }
+
+ private:
+ EVP_CIPHER_CTX ctx_;
+};
+
+} // namespace net
+
+#endif // NET_QUIC_CRYPTO_SCOPED_EVP_CIPHER_CTX_H_
Property changes on: net/quic/crypto/scoped_evp_cipher_ctx.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« net/quic/crypto/aes_128_gcm_decrypter_test.cc ('K') | « net/quic/crypto/quic_encrypter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698