Skip to main content

psa_crypto_sys/
lib.rs

1// Copyright 2020 Contributors to the Parsec project.
2// SPDX-License-Identifier: Apache-2.0
3
4//! # PSA Cryptography API Wrapper
5//!
6//! This crate provides abstraction over an implementation of the PSA Cryptography API.
7//! You can find the API
8//! [here](https://developer.arm.com/architectures/security-architectures/platform-security-architecture/documentation).
9
10#![no_std]
11// This one is hard to avoid.
12#![allow(clippy::multiple_crate_versions)]
13#![allow(clippy::missing_safety_doc)]
14// Respect the C API case
15#![allow(non_snake_case)]
16
17#[allow(
18    non_snake_case,
19    non_camel_case_types,
20    non_upper_case_globals,
21    dead_code,
22    trivial_casts
23)]
24#[allow(clippy::all)]
25#[allow(unknown_lints)] // unnecessary_transmutes is only present in 1.88+
26#[allow(unnecessary_transmutes)]
27#[cfg(feature = "interface")]
28mod psa_crypto_binding {
29    #![allow(unused_imports)]
30    include!(concat!(env!("OUT_DIR"), "/shim_bindings.rs"));
31}
32
33mod constants;
34#[cfg(feature = "interface")]
35mod extras;
36#[cfg(feature = "interface")]
37mod shim;
38mod types;
39
40pub use constants::*;
41pub use types::*;
42
43#[cfg(feature = "operations")]
44pub use psa_crypto_binding::{
45    psa_aead_decrypt, psa_aead_encrypt, psa_asymmetric_decrypt, psa_asymmetric_encrypt,
46    psa_cipher_abort, psa_cipher_decrypt_setup, psa_cipher_encrypt_setup, psa_cipher_finish,
47    psa_cipher_set_iv, psa_cipher_update, psa_close_key, psa_copy_key, psa_crypto_init,
48    psa_destroy_key, psa_export_key, psa_export_public_key, psa_generate_key, psa_generate_random,
49    psa_get_key_attributes, psa_hash_compare, psa_hash_compute, psa_import_key,
50    psa_key_derivation_abort, psa_key_derivation_input_bytes, psa_key_derivation_input_key,
51    psa_key_derivation_key_agreement, psa_key_derivation_output_key,
52    psa_key_derivation_set_capacity, psa_key_derivation_setup, psa_mac_compute, psa_mac_verify,
53    psa_open_key, psa_raw_key_agreement, psa_reset_key_attributes, psa_sign_hash, psa_verify_hash,
54};
55
56#[cfg(feature = "interface")]
57pub use psa_crypto_binding::{
58    psa_cipher_operation_t, psa_key_attributes_t, psa_key_derivation_operation_t,
59};
60
61// Secure Element Driver definitions
62#[cfg(feature = "interface")]
63pub use psa_crypto_binding::{
64    psa_drv_se_asymmetric_t, psa_drv_se_context_t, psa_drv_se_key_management_t, psa_drv_se_t,
65    psa_key_creation_method_t, psa_key_slot_number_t,
66};
67
68#[cfg(feature = "interface")]
69pub use extras::*;
70#[cfg(feature = "interface")]
71pub use shim::*;