Skip to content

Commit

Permalink
Merged main to keep branch up-to-date.
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Smoot <[email protected]>
  • Loading branch information
mes5k committed Mar 24, 2024
2 parents d59ecb0 + ade6f06 commit d5b3597
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 19 deletions.
25 changes: 14 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion psa-crypto-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repository = "https://github.com/parallaxsecond/rust-psa-crypto"
rust-version = "1.66.0"

[build-dependencies]
bindgen = { version = "0.66.1", optional = true }
bindgen = { version = "0.69.4", optional = true }
cc = "1.0.59"
cmake = "0.1.44"
regex = "1.9.1"
Expand Down
1 change: 1 addition & 0 deletions psa-crypto-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#[allow(clippy::all)]
#[cfg(feature = "interface")]
mod psa_crypto_binding {
#![allow(unused_imports)]
include!(concat!(env!("OUT_DIR"), "/shim_bindings.rs"));
}

Expand Down
12 changes: 6 additions & 6 deletions psa-crypto/src/operations/cipher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ fn crypt(

let mut output_length = 0;
let mut output_length_finish = 0;
let mut inner_crypt = || {

let status = {
Status::from(unsafe {
psa_crypto_sys::psa_cipher_set_iv(&mut operation, iv.as_ptr(), iv.len())
})
Expand Down Expand Up @@ -62,16 +63,15 @@ fn crypt(

Ok(())
};
match inner_crypt() {
Ok(()) => (),

match status {
Ok(()) => Ok(output_length + output_length_finish),
Err(x) => {
Status::from(unsafe { psa_crypto_sys::psa_cipher_abort(&mut operation) })
.to_result()?;
return Err(x);
Err(x)
}
}

Ok(output_length + output_length_finish)
}

/// Encrypt a short message with a key
Expand Down
2 changes: 1 addition & 1 deletion psa-crypto/src/types/key_derivation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use super::key::Id;
#[cfg(feature = "operations")]
use super::status::{Error, Result, Status};
#[cfg(feature = "operations")]
use core::convert::{From, TryFrom};
use core::convert::TryFrom;

/// Key derivation operation for deriving keys from existing sources
#[derive(Debug, Clone, Copy)]
Expand Down

0 comments on commit d5b3597

Please sign in to comment.