Skip to content

Commit

Permalink
Merge pull request #431 from brandsimon/sbr/improve_errors
Browse files Browse the repository at this point in the history
Improve error messages of Public{Ecc,Rsa}ParametersBuilder
  • Loading branch information
wiktor-k authored Sep 14, 2023
2 parents a449af7 + ff3c06d commit 56f7b1d
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 56f7b1d

Please sign in to comment.