cosmian_pkcs11_module/
lib.rs

1// Copyright 2025 Cosmian Tech SAS
2// Changes made to the original code are
3// licensed under the Business Source License version 1.1.
4//
5// Original code:
6// Copyright 2022 Google LLC
7//
8// Licensed under the Apache License, Version 2.0 (the "License");
9// you may not use this file except in compliance with the License.
10// You may obtain a copy of the License at
11//
12//      http://www.apache.org/licenses/LICENSE-2.0
13//
14// Unless required by applicable law or agreed to in writing, software
15// distributed under the License is distributed on an "AS IS" BASIS,
16// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17// See the License for the specific language governing permissions and
18// limitations under the License.
19
20#![deny(
21    // nonstandard_style,
22    refining_impl_trait,
23    future_incompatible,
24    keyword_idents,
25    let_underscore,
26    unused,
27    unsafe_op_in_unsafe_fn,
28    clippy::all,
29    clippy::suspicious,
30    clippy::complexity,
31    clippy::perf,
32    clippy::style,
33    clippy::pedantic,
34    // clippy::cargo,
35    // clippy::nursery,
36
37    // restriction lints
38    clippy::unwrap_used,
39    clippy::get_unwrap,
40    clippy::expect_used,
41    clippy::indexing_slicing,
42    // clippy::missing_asserts_for_indexing,
43    clippy::unwrap_in_result,
44    clippy::assertions_on_result_states,
45    clippy::panic,
46    clippy::panic_in_result_fn,
47    clippy::renamed_function_params,
48    clippy::verbose_file_reads,
49    clippy::str_to_string,
50    clippy::string_to_string,
51    clippy::unreachable,
52    // clippy::as_conversions,
53    clippy::print_stdout,
54    clippy::empty_structs_with_brackets,
55    clippy::unseparated_literal_suffix,
56    clippy::map_err_ignore,
57    clippy::redundant_clone,
58)]
59#![allow(
60    non_snake_case, // case come from C
61    clippy::missing_safety_doc,
62    clippy::missing_errors_doc,
63)]
64
65pub mod core;
66mod error;
67mod objects_store;
68pub mod pkcs11;
69mod sessions;
70#[cfg(test)]
71#[expect(
72    clippy::panic_in_result_fn,
73    clippy::unwrap_used,
74    clippy::indexing_slicing
75)]
76mod tests;
77pub mod traits;
78mod utils;
79
80use error::result::MResultHelper;
81pub use error::{ModuleError, ModuleResult};
82pub use utils::{test_decrypt, test_encrypt, test_generate_key};