OLD | NEW |
(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 |
OLD | NEW |