Thanks to visit codestin.com
Credit goes to github.com

Skip to content

extmod/modussl: improve exception error messages (v2) #6259

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

Merged
merged 4 commits into from
Jul 20, 2020

Conversation

dpgeorge
Copy link
Member

This is the same as #5819 just with reorganised commits.

@dpgeorge dpgeorge added the extmod Relates to extmod/ directory in source label Jul 20, 2020
tve added 2 commits July 20, 2020 23:41
This commit adds human readable error messages when mbedtls or axtls raise
an exception.  Currently often just an EIO error is raised so the user is
lost and can't tell whether it's a cert error, buffer overrun, connecting
to a non-ssl port, etc.  The axtls and mbedtls error raising in the ussl
module is modified to raise:

    OSError(-err_num, "error string")

For axtls a small error table of strings is added and used for the second
argument of the OSErrer.  For mbedtls the code uses mbedtls' built-in
strerror function, and if there is an out of memory condition it just
produces OSError(-err_num).  Producing the error string for mbedtls is
conditional on them being included in the mbedtls build, via
MBEDTLS_ERROR_C.
@dpgeorge dpgeorge force-pushed the extmod-modussl-error-strings branch from 3aa1b14 to a2138c8 Compare July 20, 2020 13:42
The file `mbedtls_errors/mp_mbedtls_errors.c` can be used instead of
`mbedtls/library/error.c` to give shorter error strings, reducing the build
size of the error strings from about 12-16kB down to about 2-5kB.
@dpgeorge dpgeorge force-pushed the extmod-modussl-error-strings branch from a2138c8 to 5a3bd7a Compare July 20, 2020 13:54
The stm32 and esp32 ports now use shorter error strings for mbedtls errors.
Also, MBEDTLS_ERROR_C is enabled on stm32 by default to get these strings.
@dpgeorge dpgeorge force-pushed the extmod-modussl-error-strings branch from 5a3bd7a to 5264478 Compare July 20, 2020 14:31
@dpgeorge dpgeorge merged commit 5264478 into micropython:master Jul 20, 2020
@dpgeorge dpgeorge deleted the extmod-modussl-error-strings branch July 20, 2020 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extmod Relates to extmod/ directory in source
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants