Skip to content

Commit eaf21e2

Browse files
authored
Merge pull request #318 from Superhepper/dependencies
Updates depedencies
2 parents 07e0bb9 + e7a4f83 commit eaf21e2

File tree

3 files changed

+22
-14
lines changed

3 files changed

+22
-14
lines changed

tss-esapi/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ documentation = "https://docs.rs/crate/tss-esapi"
1414
[dependencies]
1515
bitfield = "0.13.2"
1616
serde = { version = "1.0.115", features = ["derive"] }
17-
mbox = "0.5.0"
17+
mbox = "0.6.0"
1818
log = "0.4.11"
19-
enumflags2 = "0.6.4"
19+
enumflags2 = "0.7.1"
2020
num-derive = "0.3.2"
2121
num-traits = "0.2.12"
2222
hostname-validator = "1.1.0"
@@ -26,8 +26,8 @@ tss-esapi-sys = { path = "../tss-esapi-sys", version = "0.2.0" }
2626
primal = "0.3.0"
2727

2828
[dev-dependencies]
29-
env_logger = "0.7.1"
30-
sha2 = "0.9.8"
29+
env_logger = "0.9.0"
30+
sha2 = "0.10.1"
3131

3232
[features]
3333
generate-bindings = ["tss-esapi-sys/generate-bindings"]

tss-esapi/src/context.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,10 @@ impl Context {
382382

383383
/// Returns a mutable reference to the native ESYS context handle.
384384
fn mut_context(&mut self) -> *mut ESYS_CONTEXT {
385-
self.esys_context.as_mut().unwrap().as_mut_ptr() // will only fail if called from Drop after .take()
385+
self.esys_context
386+
.as_mut()
387+
.map(MBox::<ESYS_CONTEXT>::as_mut_ptr)
388+
.unwrap() // will only fail if called from Drop after .take()
386389
}
387390

388391
/// Internal function for retrieving the ESYS session handle for
@@ -455,10 +458,16 @@ impl Drop for Context {
455458
error!("Not all handles have had their resources successfully released");
456459
}
457460

458-
let esys_context = self.esys_context.take().unwrap(); // should not fail based on how the context is initialised/used
459-
460461
// Close the context.
461-
unsafe { Esys_Finalize(&mut esys_context.into_raw()) };
462+
unsafe {
463+
Esys_Finalize(
464+
&mut self
465+
.esys_context
466+
.take()
467+
.map(MBox::<ESYS_CONTEXT>::into_raw)
468+
.unwrap(), // should not fail based on how the context is initialised/used
469+
)
470+
};
462471
info!("Context closed.");
463472
}
464473
}

tss-esapi/src/structures/pcr/slot.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
// Copyright 2022 Contributors to the Parsec project.
22
// SPDX-License-Identifier: Apache-2.0
33
use crate::{tss2_esys::TPM2_PCR_SELECT_MAX, Error, Result, WrapperErrorKind};
4-
use enumflags2::{BitFlags, _internal::RawBitFlags};
4+
use enumflags2::bitflags;
55
use log::error;
66
use num_derive::{FromPrimitive, ToPrimitive};
7-
use num_traits::FromPrimitive;
7+
use num_traits::{FromPrimitive, ToPrimitive};
88
use std::convert::TryFrom;
99

1010
/// Enum with the bit flag for each PCR slot.
11-
#[derive(
12-
FromPrimitive, ToPrimitive, BitFlags, Hash, Debug, Eq, PartialEq, Ord, PartialOrd, Clone, Copy,
13-
)]
11+
#[bitflags]
1412
#[repr(u32)]
13+
#[derive(FromPrimitive, ToPrimitive, Hash, Debug, Eq, PartialEq, Ord, PartialOrd, Clone, Copy)]
1514
pub enum PcrSlot {
1615
Slot0 = 0x0000_0001,
1716
Slot1 = 0x0000_0002,
@@ -49,7 +48,7 @@ pub enum PcrSlot {
4948

5049
impl From<PcrSlot> for u32 {
5150
fn from(pcr_slot: PcrSlot) -> u32 {
52-
pcr_slot.bits()
51+
pcr_slot.to_u32().unwrap()
5352
}
5453
}
5554

0 commit comments

Comments
 (0)