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