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

Side by Side Diff: net/cert/x509_util_openssl.cc

Issue 948543002: Convert crypto::ScopedOpenSSL to type aliases. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « net/cert/x509_certificate_openssl.cc ('k') | net/cert/x509_util_openssl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "net/cert/x509_util_openssl.h" 5 #include "net/cert/x509_util_openssl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <openssl/asn1.h> 8 #include <openssl/asn1.h>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/strings/string_piece.h" 12 #include "base/strings/string_piece.h"
13 #include "base/strings/string_util.h" 13 #include "base/strings/string_util.h"
14 #include "crypto/ec_private_key.h" 14 #include "crypto/ec_private_key.h"
15 #include "crypto/openssl_util.h" 15 #include "crypto/openssl_util.h"
16 #include "crypto/rsa_private_key.h" 16 #include "crypto/rsa_private_key.h"
17 #include "crypto/scoped_openssl_types.h" 17 #include "crypto/scoped_openssl_types.h"
18 #include "net/cert/x509_cert_types.h" 18 #include "net/cert/x509_cert_types.h"
19 #include "net/cert/x509_util.h" 19 #include "net/cert/x509_util.h"
20 #include "net/ssl/scoped_openssl_types.h" 20 #include "net/ssl/scoped_openssl_types.h"
21 21
22 namespace net { 22 namespace net {
23 23
24 namespace { 24 namespace {
25 25
26 typedef crypto::ScopedOpenSSL<ASN1_INTEGER, ASN1_INTEGER_free>::Type 26 using ScopedASN1_INTEGER =
27 ScopedASN1_INTEGER; 27 crypto::ScopedOpenSSL<ASN1_INTEGER, ASN1_INTEGER_free>;
28 typedef crypto::ScopedOpenSSL<ASN1_OCTET_STRING, ASN1_OCTET_STRING_free>::Type 28 using ScopedASN1_OCTET_STRING =
29 ScopedASN1_OCTET_STRING; 29 crypto::ScopedOpenSSL<ASN1_OCTET_STRING, ASN1_OCTET_STRING_free>;
30 typedef crypto::ScopedOpenSSL<ASN1_STRING, ASN1_STRING_free>::Type 30 using ScopedASN1_STRING = crypto::ScopedOpenSSL<ASN1_STRING, ASN1_STRING_free>;
31 ScopedASN1_STRING; 31 using ScopedASN1_TIME = crypto::ScopedOpenSSL<ASN1_TIME, ASN1_TIME_free>;
32 typedef crypto::ScopedOpenSSL<ASN1_TIME, ASN1_TIME_free>::Type ScopedASN1_TIME; 32 using ScopedX509_EXTENSION =
33 typedef crypto::ScopedOpenSSL<X509_EXTENSION, X509_EXTENSION_free>::Type 33 crypto::ScopedOpenSSL<X509_EXTENSION, X509_EXTENSION_free>;
34 ScopedX509_EXTENSION; 34 using ScopedX509_NAME = crypto::ScopedOpenSSL<X509_NAME, X509_NAME_free>;
35 typedef crypto::ScopedOpenSSL<X509_NAME, X509_NAME_free>::Type ScopedX509_NAME;
36 35
37 const EVP_MD* ToEVP(x509_util::DigestAlgorithm alg) { 36 const EVP_MD* ToEVP(x509_util::DigestAlgorithm alg) {
38 switch (alg) { 37 switch (alg) {
39 case x509_util::DIGEST_SHA1: 38 case x509_util::DIGEST_SHA1:
40 return EVP_sha1(); 39 return EVP_sha1();
41 case x509_util::DIGEST_SHA256: 40 case x509_util::DIGEST_SHA256:
42 return EVP_sha256(); 41 return EVP_sha256();
43 } 42 }
44 return NULL; 43 return NULL;
45 } 44 }
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 internal_cache = new_cache.get(); 412 internal_cache = new_cache.get();
414 X509_set_ex_data(x509, x509_der_cache_index, new_cache.release()); 413 X509_set_ex_data(x509, x509_der_cache_index, new_cache.release());
415 } 414 }
416 *der_cache = base::StringPiece(internal_cache->data); 415 *der_cache = base::StringPiece(internal_cache->data);
417 return true; 416 return true;
418 } 417 }
419 418
420 } // namespace x509_util 419 } // namespace x509_util
421 420
422 } // namespace net 421 } // namespace net
OLDNEW
« no previous file with comments | « net/cert/x509_certificate_openssl.cc ('k') | net/cert/x509_util_openssl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698