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

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

Issue 137553004: NSS Cros multiprofile: trust roots added by a profile shouldn't apply to other profiles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: expanded test, found one problem Created 6 years, 11 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "net/cert/cert_verify_proc_chromeos.h"
6
7 // NSS doesn't currently define CERT_LIST_TAIL.
8 // See https://bugzilla.mozilla.org/show_bug.cgi?id=962413
9 #ifndef CERT_LIST_TAIL
10 #define CERT_LIST_TAIL(l) ((CERTCertListNode *)PR_LIST_TAIL(&l->list))
11 #endif
12
13 namespace net {
14
15 CertVerifyProcChromeOS::CertVerifyProcChromeOS()
16 : CertVerifyProcNSS(InitializeCERTChainVerifyCallback()) {}
17
18 CertVerifyProcChromeOS::CertVerifyProcChromeOS(
19 crypto::ScopedPK11Slot public_slot,
20 crypto::ScopedPK11Slot private_slot)
21 : CertVerifyProcNSS(InitializeCERTChainVerifyCallback()) {
22 profile_filter_.Init(public_slot.Pass(), private_slot.Pass());
23 }
24
25 CertVerifyProcChromeOS::~CertVerifyProcChromeOS() {}
26
27 CERTChainVerifyCallback*
28 CertVerifyProcChromeOS::InitializeCERTChainVerifyCallback() {
29 chain_verify_callback_.isChainValid =
30 &CertVerifyProcChromeOS::IsChainValidFunc;
31 chain_verify_callback_.isChainValidArg = static_cast<void*>(this);
32 return &chain_verify_callback_;
33 }
34
35 // static
36 SECStatus CertVerifyProcChromeOS::IsChainValidFunc(
37 void* is_chain_valid_arg,
38 const CERTCertList* current_chain,
39 PRBool* chain_ok) {
40 CertVerifyProcChromeOS* that =
41 static_cast<CertVerifyProcChromeOS*>(is_chain_valid_arg);
42 CERTCertificate* cert = CERT_LIST_TAIL(current_chain)->cert;
43 // TODO(mattm): If crbug.com/334384 is fixed to allow setting trust
44 // properly when the same cert is in multiple slots, this would also need
45 // updating to check the per-slot trust values.
46 *chain_ok = that->profile_filter_.IsCertAllowed(cert) ? PR_TRUE : PR_FALSE;
47 return SECSuccess;
48 }
49
50 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698