xref: /aosp_15_r20/external/cronet/crypto/chaps_support.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1*6777b538SAndroid Build Coastguard Worker // Copyright 2020 The Chromium Authors
2*6777b538SAndroid Build Coastguard Worker // Use of this source code is governed by a BSD-style license that can be
3*6777b538SAndroid Build Coastguard Worker // found in the LICENSE file.
4*6777b538SAndroid Build Coastguard Worker 
5*6777b538SAndroid Build Coastguard Worker #ifndef CRYPTO_CHAPS_SUPPORT_H_
6*6777b538SAndroid Build Coastguard Worker #define CRYPTO_CHAPS_SUPPORT_H_
7*6777b538SAndroid Build Coastguard Worker 
8*6777b538SAndroid Build Coastguard Worker #include <secmodt.h>
9*6777b538SAndroid Build Coastguard Worker 
10*6777b538SAndroid Build Coastguard Worker #include "crypto/crypto_export.h"
11*6777b538SAndroid Build Coastguard Worker #include "crypto/scoped_nss_types.h"
12*6777b538SAndroid Build Coastguard Worker 
13*6777b538SAndroid Build Coastguard Worker namespace crypto {
14*6777b538SAndroid Build Coastguard Worker 
15*6777b538SAndroid Build Coastguard Worker // Loads chaps module for this NSS session. Should be called on a worker thread.
16*6777b538SAndroid Build Coastguard Worker CRYPTO_EXPORT SECMODModule* LoadChaps();
17*6777b538SAndroid Build Coastguard Worker 
18*6777b538SAndroid Build Coastguard Worker // Returns a slot with `slot_id` from the `chaps_module`. Should be called on a
19*6777b538SAndroid Build Coastguard Worker // worker thread.
20*6777b538SAndroid Build Coastguard Worker CRYPTO_EXPORT ScopedPK11Slot GetChapsSlot(SECMODModule* chaps_module,
21*6777b538SAndroid Build Coastguard Worker                                           CK_SLOT_ID slot_id);
22*6777b538SAndroid Build Coastguard Worker 
23*6777b538SAndroid Build Coastguard Worker // Returns true if the given module is the Chaps module. Should be called on a
24*6777b538SAndroid Build Coastguard Worker // worker thread.
25*6777b538SAndroid Build Coastguard Worker CRYPTO_EXPORT bool IsChapsModule(SECMODModule* pk11_module);
26*6777b538SAndroid Build Coastguard Worker 
27*6777b538SAndroid Build Coastguard Worker // Returns true if chaps is the module to which |slot| is attached. Should be
28*6777b538SAndroid Build Coastguard Worker // called on a worker thread.
29*6777b538SAndroid Build Coastguard Worker CRYPTO_EXPORT bool IsSlotProvidedByChaps(PK11SlotInfo* slot);
30*6777b538SAndroid Build Coastguard Worker 
31*6777b538SAndroid Build Coastguard Worker }  // namespace crypto
32*6777b538SAndroid Build Coastguard Worker 
33*6777b538SAndroid Build Coastguard Worker #endif  // CRYPTO_CHAPS_SUPPORT_H_
34