Skip to content
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

Added debug print in tls13 ssl_tls13_write_key_share_ext #9798

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions library/ssl_tls13_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ static int ssl_tls13_write_key_share_ext(mbedtls_ssl_context *ssl,
ssl, group_id, p, end, &key_exchange_len);
p += key_exchange_len;
if (ret != 0) {
MBEDTLS_SSL_DEBUG_MSG(1, ("client hello: failed generating xxdh key exchange"));
Copy link
Contributor

Choose a reason for hiding this comment

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

It's usually useful to log the error code too, we have a macro for that. Also, when debugging the library, it's convenient to have the function name.

Suggested change
MBEDTLS_SSL_DEBUG_MSG(1, ("client hello: failed generating xxdh key exchange"));
MBEDTLS_SSL_DEBUG_RET(1, "mbedtls_ssl_tls13_generate_and_write_xxdh_key_exchange", ret);

Copy link
Author

Choose a reason for hiding this comment

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

I agree that the MBEDTLS_SSL_DEBUG_RET should be used, but isn't it better to keep the text as is?
Seems like it gives a more literal description of the error - when someone will debug the library they will end up Ctrl + Fing the string anyway...

Copy link
Contributor

Choose a reason for hiding this comment

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

MBEDTLS_SSL_DEBUG_RET would be consistent with the rest of the code base, and gives the location of the failure plus the error code. But that's no big deal.

return ret;
}

Expand Down