Avi Drissman | 201a9a83 | 2022-09-13 19:39:25 | [diff] [blame] | 1 | // Copyright 2020 The Chromium Authors |
Michael Ershov | 1c50ac95 | 2020-12-02 21:01:17 | [diff] [blame] | 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" |
Michael Ershov | d9a627e | 2021-11-03 13:55:27 | [diff] [blame] | 11 | #include "crypto/scoped_nss_types.h" |
Michael Ershov | 1c50ac95 | 2020-12-02 21:01:17 | [diff] [blame] | 12 | |
| 13 | namespace crypto { |
| 14 | |
Michael Ershov | d9a627e | 2021-11-03 13:55:27 | [diff] [blame] | 15 | // Loads chaps module for this NSS session. Should be called on a worker thread. |
Michael Ershov | 1c50ac95 | 2020-12-02 21:01:17 | [diff] [blame] | 16 | CRYPTO_EXPORT SECMODModule* LoadChaps(); |
| 17 | |
Michael Ershov | d9a627e | 2021-11-03 13:55:27 | [diff] [blame] | 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 | |
Jun Ishiguro | a140469 | 2023-09-19 00:02:46 | [diff] [blame] | 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 | |
Michael Ershov | d9a627e | 2021-11-03 13:55:27 | [diff] [blame] | 27 | // Returns true if chaps is the module to which |slot| is attached. Should be |
| 28 | // called on a worker thread. |
Michael Ershov | 1c50ac95 | 2020-12-02 21:01:17 | [diff] [blame] | 29 | CRYPTO_EXPORT bool IsSlotProvidedByChaps(PK11SlotInfo* slot); |
| 30 | |
| 31 | } // namespace crypto |
| 32 | |
| 33 | #endif // CRYPTO_CHAPS_SUPPORT_H_ |