Skip to content

Conversation

@Inokinoki
Copy link

Add macro and function to display openssl error info.

Before, during my debug, while private key validation failed, it shows:

Failed 'EC_KEY_check_key(key) - 1': -1 - LIBUSB_ERROR_IO

It may mislead someone who is debugging on the device.

Now it can show the right error information:

Failed 'EC_KEY_check_key(key) - 1': -1 - invalid private key

void openssl_res_err(int result, char* where) {
if (result != 0) {
printf("Failed '%s': %d - %s\n", where, result, ERR_reason_error_string(ERR_get_error()));
exit(0);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to exit here?
Maybe it's useful to proceed and see what happens afterwards.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With my 0094, it can reach the menu:
1 - Scan fingerprint
2 - Test leds
0 - Exit
But none of them works. The device replies with 0404.

I think the exit may still be necessary to guarantee a proper process.

Copy link
Author

@Inokinoki Inokinoki Jan 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's necessary to have a EC_KEY_check_key there and fail it if the private key not suitable, because I did a workaround during the parse of private key, which may lead some errors...
Before doing that, the header check and the padding check for the private key always failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants