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

Side by Side Diff: net/base/test_root_certs_openssl.cc

Issue 4646001: Implement LoadTemporaryRoot for Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/net/base
Patch Set: bulach and wtc feedback Created 10 years, 1 month 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
OLDNEW
(Empty)
1 // Copyright (c) 2010 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 #include "net/base/test_root_certs.h"
6
7 #include <openssl/err.h>
8 #include <openssl/x509v3.h>
9
10 #include "base/logging.h"
11 #include "net/base/openssl_util.h"
12 #include "net/base/x509_certificate.h"
13
14 namespace net {
15
16 bool TestRootCerts::Add(X509Certificate* certificate) {
17 OpenSSLInitSingleton* openssl_init = GetOpenSSLInitSingleton();
18
19 if (!X509_STORE_add_cert(openssl_init->x509_store(),
20 certificate->os_cert_handle())) {
21 unsigned long error_code = ERR_get_error();
22 if (ERR_GET_LIB(error_code) != ERR_LIB_X509 ||
23 ERR_GET_REASON(error_code) != X509_R_CERT_ALREADY_IN_HASH_TABLE) {
24 do {
25 LOG(ERROR) << "X509_STORE_add_cert error: " << error_code;
26 } while ((error_code = ERR_get_error()) != 0);
joth 2010/11/17 16:29:20 minor suggestion: you can now just call ClearOpenS
27 return false;
28 }
29 }
30
31 empty_ = false;
32 return true;
33 }
34
35 void TestRootCerts::Clear() {
36 OpenSSLInitSingleton* openssl_init = GetOpenSSLInitSingleton();
37 openssl_init->ReinitializeStore();
joth 2010/11/17 16:29:20 ah sorry I competely missed this when I sent the l
38 empty_ = true;
39 }
40
41 bool TestRootCerts::IsEmpty() const {
42 return empty_;
43 }
44
45 TestRootCerts::TestRootCerts()
46 : empty_(true) {}
bulach 2010/11/17 17:17:30 nit: \n}
Ryan Sleevi 2010/11/18 05:31:58 Looking at http://google-styleguide.googlecode.com
47
48 TestRootCerts::~TestRootCerts() {}
bulach 2010/11/17 17:17:30 nit: \n}
Ryan Sleevi 2010/11/18 05:31:58 Judging by http://crrev.com/61100 , I see the orig
49
50 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698