-
Notifications
You must be signed in to change notification settings - Fork 11
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
Update error handling and debug logging #92
base: main
Are you sure you want to change the base?
Conversation
I see this has been deprecated in OpenSSL 3.0 - with ERR_raise (not directly specifying func, file and line) being preferred. I guess if ERR_put_error is not available, we need to directly invoke the underlying ERR_new / ERR_set_debug / ERR_set_error here? #Resolved Refers to: ScosslCommon/src/scossl_helpers.c:296 in e4e4818. [](commit_id = e4e4818, deletion_comment = False) |
I guess - general question; should there be any ERR_raise in the provider code, or should we route it all through SCOSSL_LOG* macros? In reply to: 2359556181 Refers to: SymCryptProvider/src/p_scossl_base.c:566 in e4e4818. [](commit_id = e4e4818, deletion_comment = False) |
Should we remove this parameter and hardcode to SCOSSL_ERR_R_SYMCRYPT_FAILURE? (for all SCOSSL_LOG_SYMCRYPT*) #Resolved Refers to: ScosslCommon/inc/scossl_helpers.h:313 in e4e4818. [](commit_id = e4e4818, deletion_comment = False) |
In my experience, relying on the OpenSSL error stack for debugging has been sufficient, since the provider error codes are descriptive and I think there would be value to add In reply to: 2359585467 Refers to: SymCryptProvider/src/p_scossl_base.c:566 in e4e4818. [](commit_id = e4e4818, deletion_comment = False) |
Yeah, that's not ideal but we should move off of ERR_put_error then. In reply to: 2359584794 Refers to: ScosslCommon/src/scossl_helpers.c:296 in e4e4818. [](commit_id = e4e4818, deletion_comment = False) |
That makes sense to me. I also noticed the parameters on SCOSSL_LOG_BIGNUM_ERROR and SCOSSL_LOG_BIGNUM_INFO are wrong, but we don't use them anywhere. Is there any reason to keep either around? In reply to: 2359587202 Refers to: ScosslCommon/inc/scossl_helpers.h:313 in e4e4818. [](commit_id = e4e4818, deletion_comment = False) |
Good catch - given SCOSSL_LOG_BIGNUM* is no longer being used, I think it's reasonable to remove it and _scossl_log_bignum In reply to: 2359608976 Refers to: ScosslCommon/inc/scossl_helpers.h:313 in e4e4818. [](commit_id = e4e4818, deletion_comment = False) |
In the process of doing this, I remembered that the function code is ignored in OpenSSL 3. We'd have to copy a significant amount of the error logging code from 1.1.1 to reintroduce this, but I don't think it adds anything for our provider code. I think the provider should just use SCOSSL_LOG macros that don't accept a function code but log everything else the same. In reply to: 2359605816 Refers to: ScosslCommon/src/scossl_helpers.c:296 in e4e4818. [](commit_id = e4e4818, deletion_comment = False) |
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.
LGTM
This PR primarily serves to make SymCrypt-OpenSSL more debuggable, especially in the provider.
SCOSSL_LOG_SYMCRYPT_ERROR
in the providerERR_set_mark
andERR_pop_to_mark
to RSA and ECC KeysInUse init to avoid surfacing KeysInUse errors to the caller