Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix clippy warnings #556

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ jobs:
- name: Run the tests
run: docker run -v $(pwd):/tmp/rust-tss-esapi -w /tmp/rust-tss-esapi/tss-esapi --security-opt seccomp=unconfined fedoracontainer dbus-run-session -- /tmp/rust-tss-esapi/tss-esapi/tests/all-fedora.sh

# SEE #558 : remove use of 1.82 once 1.84 rolls out;
tests-valgrind:
ionut-arm marked this conversation as resolved.
Show resolved Hide resolved
name: Valgrind test run
runs-on: ubuntu-latest
Expand All @@ -96,7 +97,7 @@ jobs:
- name: Build the container
run: docker build -t ubuntucontainer tss-esapi/tests/ --file tss-esapi/tests/Dockerfile-ubuntu --target tpm2-tools
- name: Run the tests
run: docker run -v $(pwd):/tmp/rust-tss-esapi -w /tmp/rust-tss-esapi/tss-esapi ubuntucontainer /tmp/rust-tss-esapi/tss-esapi/tests/valgrind.sh
run: docker run -v $(pwd):/tmp/rust-tss-esapi -w /tmp/rust-tss-esapi/tss-esapi -e RUST_TOOLCHAIN_VERSION="1.82" ubuntucontainer /tmp/rust-tss-esapi/tss-esapi/tests/valgrind.sh

# Check that the documentation builds as well.
docs:
Expand Down
4 changes: 2 additions & 2 deletions tss-esapi/src/constants/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright 2020 Contributors to the Parsec project.
// SPDX-License-Identifier: Apache-2.0

/// This module contains both the constants defined in the TSS specification (tss module)
/// but also the internal representation of the TSS constants.
//! This module contains both the constants defined in the TSS specification (tss module)
//! but also the internal representation of the TSS constants.

/// Representation of the constants defined in the
/// Constants -> TPM_ALG_ID section of the specification
Expand Down
2 changes: 1 addition & 1 deletion tss-esapi/src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ where
/// The owned bytes in the form of a `Vec<u8>` object.
pub fn to_owned_bytes(ffi_bytes_ptr: *mut u8, size: usize) -> Vec<u8> {
let ffi_bytes = unsafe { Malloced::<[u8]>::slice_from_raw_parts(ffi_bytes_ptr, size) };
return Vec::<u8>::from(ffi_bytes.as_ref());
Vec::<u8>::from(ffi_bytes.as_ref())
}

/// Type used for handling `size_t` variables
Expand Down
7 changes: 3 additions & 4 deletions tss-esapi/src/handles/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
/// Module that contains the different types of handles
/// that the ESAPI and the TPM uses in order to provide
/// access to objects that was or has been created.

/////////////////////////////////////////////////////////
/// ESYS Handles
/////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////
// ESYS Handles
// //////////////////////////////////////////////////////
pub use handle::auth::AuthHandle;
pub use handle::key::KeyHandle;
pub use handle::nv_index::NvIndexHandle;
Expand Down
78 changes: 38 additions & 40 deletions tss-esapi/src/interface_types/reserved_handles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ use crate::{
Error, Result, WrapperErrorKind,
};
use std::convert::TryFrom;
//////////////////////////////////////////////////////////////////////////////////
/// Hierarchy
///
/// Enum describing the object hierarchies in a TPM 2.0.
//////////////////////////////////////////////////////////////////////////////////
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum Hierarchy {
Owner,
Expand Down Expand Up @@ -74,9 +72,9 @@ impl TryFrom<TpmHandle> for Hierarchy {
}
}

//////////////////////////////////////////////////////////////////////////////////
/// Enables
//////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////
// Enables
// ////////////////////////////////////////////////////////////////////////////////
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Enables {
Owner,
Expand Down Expand Up @@ -143,9 +141,9 @@ impl TryFrom<TpmHandle> for Enables {
}
}

//////////////////////////////////////////////////////////////////////////////////
/// HierarchyAuth
//////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////
// HierarchyAuth
// ////////////////////////////////////////////////////////////////////////////////
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum HierarchyAuth {
Owner,
Expand Down Expand Up @@ -206,13 +204,13 @@ impl TryFrom<TpmHandle> for HierarchyAuth {
}
}
}
//////////////////////////////////////////////////////////////////////////////////
/// TODO: HierarchyPolicy
//////////////////////////////////////////////////////////////////////////////////
// ///////////////////////////////////////////////////////////////////////////////
// TODO: HierarchyPolicy
// ///////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////////
/// Platform
//////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////
// Platform
// ////////////////////////////////////////////////////////////////////////////////
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Platform {
Platform,
Expand All @@ -234,9 +232,9 @@ impl TryFrom<AuthHandle> for Platform {
}
}
}
//////////////////////////////////////////////////////////////////////////////////
/// Owner
//////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////
// Owner
// ////////////////////////////////////////////////////////////////////////////////
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Owner {
Owner,
Expand All @@ -263,9 +261,9 @@ impl TryFrom<ObjectHandle> for Owner {
}
}
}
//////////////////////////////////////////////////////////////////////////////////
/// Endorsement
//////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////
// Endorsement
// ////////////////////////////////////////////////////////////////////////////////
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Endorsement {
Endorsement,
Expand All @@ -292,9 +290,9 @@ impl TryFrom<ObjectHandle> for Endorsement {
}
}
}
//////////////////////////////////////////////////////////////////////////////////
/// Provision
//////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////
// Provision
// ////////////////////////////////////////////////////////////////////////////////
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Provision {
Owner,
Expand All @@ -321,9 +319,9 @@ impl TryFrom<AuthHandle> for Provision {
}
}
}
//////////////////////////////////////////////////////////////////////////////////
/// Clear
//////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////
// Clear
// ////////////////////////////////////////////////////////////////////////////////
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Clear {
Owner,
Expand All @@ -350,9 +348,9 @@ impl TryFrom<AuthHandle> for Clear {
}
}
}
//////////////////////////////////////////////////////////////////////////////////
/// NvAuth
//////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////
// NvAuth
// ////////////////////////////////////////////////////////////////////////////////
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum NvAuth {
Platform,
Expand Down Expand Up @@ -381,9 +379,9 @@ impl TryFrom<AuthHandle> for NvAuth {
}
}
}
//////////////////////////////////////////////////////////////////////////////////
/// Lockout
//////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////
// Lockout
// ////////////////////////////////////////////////////////////////////////////////
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Lockout {
Lockout,
Expand All @@ -406,9 +404,9 @@ impl TryFrom<ObjectHandle> for Lockout {
}
}

//////////////////////////////////////////////////////////////////////////////////
/// NvIndex
//////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////
// NvIndex
// ////////////////////////////////////////////////////////////////////////////////
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum NvIndex {
NvIndex(NvIndexTpmHandle),
Expand All @@ -428,9 +426,9 @@ impl From<NvIndex> for NvIndexTpmHandle {
}
}

//////////////////////////////////////////////////////////////////////////////////
/// AttachedComponent
//////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////
// AttachedComponent
// ////////////////////////////////////////////////////////////////////////////////
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum AttachedComponent {
AttachedComponent(AttachedComponentTpmHandle),
Expand All @@ -450,8 +448,8 @@ impl From<AttachedComponent> for AttachedComponentTpmHandle {
}
}

//////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////
// Act (authenticated timers)
//
// TODO: Figure out how to implement this. This is some kind of counter.
//////////////////////////////////////////////////////////////////////////////////
// ////////////////////////////////////////////////////////////////////////////////
Loading
Loading