-
Notifications
You must be signed in to change notification settings - Fork 58
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
crypto: Improve error handling and move to library #736
Conversation
fcd4674
to
663192f
Compare
Codecov ReportAttention:
Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more.
|
I'm seeing unrelated failures on CI that I hope to be fixed by: RedHat-SP-Security/keylime-tests#550 |
663192f
to
93ba5a3
Compare
205c14f
to
6610d39
Compare
/packit retest-failed |
1 similar comment
/packit retest-failed |
4a40ff4
to
99c862e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It feels to me a bit overwhelming to have this level of granularity. For example, SignerNewError
exactly maps to openssl::sign::Signer::new
function. I can understand that this would be useful for diagnosing any issues at production environment, but perhaps this kind of matter could be better handled with structured logging (for example, maybe switching to the tracing crate from pretty_env_logger)?
For me, these are complementary approaches. My end goal is to use the |
55346a3
to
02fac6a
Compare
Sure, we can use more generic error types with different error messages to achieve that. I fail to see how having that is an improvement over having unique error types, but I can change it. |
1448e9e
to
f1f7561
Compare
Also add unit tests for error cases Signed-off-by: Anderson Toshiyuki Sasaki <[email protected]>
Signed-off-by: Anderson Toshiyuki Sasaki <[email protected]>
f1f7561
to
fdd3886
Compare
/packit retest-failed |
Hopefully, the issue with the Fedora 39 tests will be solved with RedHat-SP-Security/keylime-tests#553 |
@ueno Could you please review this again? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me this change makes sense.
I understand @ueno comments about that the errors are very specific, but I do not see any issue with this.
/packit retest-failed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Sorry for the delay; I was away for the last couple of days.
/packit retest-failed |
Account Koncpa has no write access nor is author of PR! |
/packit retest-failed |
This takes advantage of thiserror crate to create a backtrace for the errors. Signed-off-by: Anderson Toshiyuki Sasaki <[email protected]>
fdd3886
to
c82fa2f
Compare
Also move crypto-related definitions from common.rs to crypto.rs. Adjust the code to handle the new error types. Add few auxiliary functions and tests for them. Signed-off-by: Anderson Toshiyuki Sasaki <[email protected]>
Move the crypto module from keylime-agent to the keylime library. Signed-off-by: Anderson Toshiyuki Sasaki <[email protected]>
Signed-off-by: Anderson Toshiyuki Sasaki <[email protected]>
This is to avoid frequent deadlocks on CI. Signed-off-by: Anderson Toshiyuki Sasaki <[email protected]>
Consolidate errors with same origin and add context specific messages. Signed-off-by: Anderson Toshiyuki Sasaki <[email protected]>
c82fa2f
to
a895c85
Compare
/packit retest-failed |
Wrap every possible error in
crypto.rs
in a single error typeCryptoError
.Moved
AES_128_KEY_LEN
,AES_256_KEY_LEN
, andAES_BLOCK_SIZE
definitions fromcommon.rs
tocrypto.rs
Marked the source of the errors in
tpm.rs
Move the
crypto
module fromkeylime-agent
to thekeylime
libraryAlso add some auxiliary functions and tests for them:
x509_get_pubkey()
x509_to_pem()
x509_to_der()
tss_pubkey_to_pem()
hash()
Rename:
kdf()
topbkdf2()
load_x509()
toload_x509_pem()
Bump
ahash
to version0.8.7
to avoid compilation error.Fixes #648