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

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: New Win method & unittests 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 "base/openssl_util.h"
12 #include "net/base/x509_certificate.h"
13
14 namespace net {
15
16 bool TestRootCerts::Add(X509Certificate* certificate) {
17 if (!X509_STORE_add_cert(X509Certificate::cert_store(),
18 certificate->os_cert_handle())) {
19 unsigned long error_code = ERR_peek_error();
20 if (ERR_GET_LIB(error_code) != ERR_LIB_X509 ||
21 ERR_GET_REASON(error_code) != X509_R_CERT_ALREADY_IN_HASH_TABLE) {
22 base::ClearOpenSSLERRStack();
23 return false;
24 }
25 ERR_clear_error();
26 }
27
28 empty_ = false;
29 return true;
30 }
31
32 void TestRootCerts::Clear() {
33 if (empty_)
34 return;
35
36 X509Certificate::ResetStore();
37 empty_ = true;
38 }
39
40 bool TestRootCerts::IsEmpty() const {
41 return empty_;
42 }
43
44 TestRootCerts::TestRootCerts() : empty_(true) {}
45
46 TestRootCerts::~TestRootCerts() {}
47
48 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698