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

Side by Side Diff: crypto/scoped_openssl_types.h

Issue 419673006: [webcrypto] Implement RSA-OAEP using BoringSSL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix typo Created 6 years, 4 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 | « content/content_child.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CRYPTO_SCOPED_OPENSSL_TYPES_H_ 5 #ifndef CRYPTO_SCOPED_OPENSSL_TYPES_H_
6 #define CRYPTO_SCOPED_OPENSSL_TYPES_H_ 6 #define CRYPTO_SCOPED_OPENSSL_TYPES_H_
7 7
8 #include <openssl/bio.h> 8 #include <openssl/bio.h>
9 #include <openssl/bn.h> 9 #include <openssl/bn.h>
10 #include <openssl/dsa.h> 10 #include <openssl/dsa.h>
(...skipping 13 matching lines...) Expand all
24 struct OpenSSLDestroyer { 24 struct OpenSSLDestroyer {
25 void operator()(Type* ptr) const { Destroyer(ptr); } 25 void operator()(Type* ptr) const { Destroyer(ptr); }
26 }; 26 };
27 27
28 template <typename PointerType, void (*Destroyer)(PointerType*)> 28 template <typename PointerType, void (*Destroyer)(PointerType*)>
29 struct ScopedOpenSSL { 29 struct ScopedOpenSSL {
30 typedef scoped_ptr<PointerType, OpenSSLDestroyer<PointerType, Destroyer> > 30 typedef scoped_ptr<PointerType, OpenSSLDestroyer<PointerType, Destroyer> >
31 Type; 31 Type;
32 }; 32 };
33 33
34 struct OpenSSLFree {
35 void operator()(uint8_t* ptr) const { OPENSSL_free(ptr); }
36 };
37
34 // Several typedefs are provided for crypto-specific primitives, for 38 // Several typedefs are provided for crypto-specific primitives, for
35 // short-hand and prevalence. Note that OpenSSL types related to X.509 are 39 // short-hand and prevalence. Note that OpenSSL types related to X.509 are
36 // intentionally not included, as crypto/ does not generally deal with 40 // intentionally not included, as crypto/ does not generally deal with
37 // certificates or PKI. 41 // certificates or PKI.
38 typedef ScopedOpenSSL<BIGNUM, BN_free>::Type ScopedBIGNUM; 42 typedef ScopedOpenSSL<BIGNUM, BN_free>::Type ScopedBIGNUM;
39 typedef ScopedOpenSSL<EC_KEY, EC_KEY_free>::Type ScopedEC_KEY; 43 typedef ScopedOpenSSL<EC_KEY, EC_KEY_free>::Type ScopedEC_KEY;
40 typedef ScopedOpenSSL<BIO, BIO_free_all>::Type ScopedBIO; 44 typedef ScopedOpenSSL<BIO, BIO_free_all>::Type ScopedBIO;
41 typedef ScopedOpenSSL<DSA, DSA_free>::Type ScopedDSA; 45 typedef ScopedOpenSSL<DSA, DSA_free>::Type ScopedDSA;
42 typedef ScopedOpenSSL<ECDSA_SIG, ECDSA_SIG_free>::Type ScopedECDSA_SIG; 46 typedef ScopedOpenSSL<ECDSA_SIG, ECDSA_SIG_free>::Type ScopedECDSA_SIG;
43 typedef ScopedOpenSSL<EC_KEY, EC_KEY_free>::Type ScopedEC_KEY; 47 typedef ScopedOpenSSL<EC_KEY, EC_KEY_free>::Type ScopedEC_KEY;
44 typedef ScopedOpenSSL<EVP_MD_CTX, EVP_MD_CTX_destroy>::Type ScopedEVP_MD_CTX; 48 typedef ScopedOpenSSL<EVP_MD_CTX, EVP_MD_CTX_destroy>::Type ScopedEVP_MD_CTX;
45 typedef ScopedOpenSSL<EVP_PKEY, EVP_PKEY_free>::Type ScopedEVP_PKEY; 49 typedef ScopedOpenSSL<EVP_PKEY, EVP_PKEY_free>::Type ScopedEVP_PKEY;
50 typedef ScopedOpenSSL<EVP_PKEY_CTX, EVP_PKEY_CTX_free>::Type ScopedEVP_PKEY_CTX;
46 typedef ScopedOpenSSL<RSA, RSA_free>::Type ScopedRSA; 51 typedef ScopedOpenSSL<RSA, RSA_free>::Type ScopedRSA;
47 52
53 // The bytes must have been allocated with OPENSSL_malloc.
54 typedef scoped_ptr<uint8_t, OpenSSLFree> ScopedOpenSSLBytes;
55
48 } // namespace crypto 56 } // namespace crypto
49 57
50 #endif // CRYPTO_SCOPED_OPENSSL_TYPES_H_ 58 #endif // CRYPTO_SCOPED_OPENSSL_TYPES_H_
OLDNEW
« no previous file with comments | « content/content_child.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698