Skip to content

Commit

Permalink
Improve error messages of Public{Ecc,Rsa}ParametersBuilder
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Brand <[email protected]>
  • Loading branch information
brandsimon committed Sep 14, 2023
1 parent 6fccc4d commit ff3c06d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions tss-esapi/src/structures/tagged/public/ecc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ impl PublicEccParametersBuilder {
return Err(Error::local_error(WrapperErrorKind::InconsistentParams));
}
} else {
error!("Found symmetric parameter, expected it to be Null nor not set at all because 'restricted' and 'is_decrypt_key' are set to false");
error!("Symmetric parameter was not set but 'restricted' and 'is_decrypt_key' are set to true");
return Err(Error::local_error(WrapperErrorKind::ParamsMissing));
}
} else if let Some(symmetric) = self.symmetric {
if !symmetric.is_null() {
error!("Found symmetric parameter, expected it to be Null nor not set at all because 'restricted' and 'is_decrypt_key' are set to false");
error!("Found symmetric parameter, expected it to be Null or not set at all because 'restricted' or 'is_decrypt_key' are set to false");
return Err(Error::local_error(WrapperErrorKind::InconsistentParams));
}
}
Expand Down
4 changes: 2 additions & 2 deletions tss-esapi/src/structures/tagged/public/rsa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ impl PublicRsaParametersBuilder {
return Err(Error::local_error(WrapperErrorKind::InconsistentParams));
}
} else {
error!("Found symmetric parameter, expected it to be Null nor not set at all because 'restricted' and 'is_decrypt_key' are set to false");
error!("Symmetric parameter was not set but 'restricted' and 'is_decrypt_key' are set to true");
return Err(Error::local_error(WrapperErrorKind::ParamsMissing));
}
} else if let Some(symmetric) = self.symmetric {
if !symmetric.is_null() {
error!("Found symmetric parameter, expected it to be Null nor not set at all because 'restricted' and 'is_decrypt_key' are set to false");
error!("Found symmetric parameter, expected it to be Null or not set at all because 'restricted' or 'is_decrypt_key' are set to false");
return Err(Error::local_error(WrapperErrorKind::InconsistentParams));
}
}
Expand Down

0 comments on commit ff3c06d

Please sign in to comment.