@@ -9,7 +9,8 @@ use crate::fapi_sys::{TSS2_RC, constants};
99const LAYER_BIT_MASK : u32 = 0x0000FFFF ;
1010
1111/// The error type for FAPI operations, used by the [`FapiContext`](crate::FapiContext) struct.
12- #[ derive( Debug , PartialEq ) ]
12+ #[ derive( Clone , Copy , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
13+ #[ non_exhaustive]
1314pub enum ErrorCode {
1415 TpmError ( Tpm2ErrorCode ) ,
1516 FapiError ( BaseErrorCode ) ,
@@ -24,7 +25,8 @@ pub enum ErrorCode {
2425}
2526
2627/// Generic TSS2 error codes.
27- #[ derive( Debug , PartialEq ) ]
28+ #[ derive( Clone , Copy , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
29+ #[ non_exhaustive]
2830pub enum BaseErrorCode {
2931 GeneralFailure ,
3032 NotImplemented ,
@@ -84,7 +86,8 @@ pub enum BaseErrorCode {
8486}
8587
8688/// TPM 2.0 response code wrapper.
87- #[ derive( Debug , PartialEq ) ]
89+ #[ derive( Clone , Copy , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
90+ #[ non_exhaustive]
8891pub enum Tpm2ErrorCode {
8992 Tpm2ErrFmt0 ( Tpm2ErrFmt0 ) ,
9093 Tpm2ErrFmt1 ( Tpm2ErrFmt1 ) ,
@@ -93,7 +96,8 @@ pub enum Tpm2ErrorCode {
9396}
9497
9598/// TPM 2.0 "format zero" response codes.
96- #[ derive( Debug , PartialEq ) ]
99+ #[ derive( Clone , Copy , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
100+ #[ non_exhaustive]
97101pub enum Tpm2ErrFmt0 {
98102 Initialize ,
99103 Failure ,
@@ -133,7 +137,8 @@ pub enum Tpm2ErrFmt0 {
133137}
134138
135139/// TPM 2.0 "format one" response codes.
136- #[ derive( Debug , PartialEq ) ]
140+ #[ derive( Clone , Copy , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
141+ #[ non_exhaustive]
137142pub enum Tpm2ErrFmt1 {
138143 Asymmetric ,
139144 Attributes ,
@@ -172,7 +177,8 @@ pub enum Tpm2ErrFmt1 {
172177}
173178
174179/// TPM 2.0 "warning" response codes.
175- #[ derive( Debug , PartialEq ) ]
180+ #[ derive( Clone , Copy , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
181+ #[ non_exhaustive]
176182pub enum Tpm2Warning {
177183 ContextGap ,
178184 ObjectMemory ,
@@ -206,7 +212,8 @@ pub enum Tpm2Warning {
206212}
207213
208214/// Internal error codes.
209- #[ derive( Debug , PartialEq ) ]
215+ #[ derive( Clone , Copy , Debug , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
216+ #[ non_exhaustive]
210217pub enum InternalError {
211218 NoResultData ,
212219 InvalidArguments ,
0 commit comments