Skip to content

Add support for the Feature unsupported error #211

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 3 commits into from
Jun 19, 2019

Conversation

RonEld
Copy link
Contributor

@RonEld RonEld commented Nov 5, 2018

Add support for MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED.
If the underlying platform does not support the current feature,
skip the test, instead of failing.

Dependent on ARMmbed/mbed-os#8643 and Mbed-TLS/mbedtls#2054 to be merged

@RonEld
Copy link
Contributor Author

RonEld commented Nov 26, 2018

Both the preceding PRs have been merged
cc @k-stachowiak

Add support for `MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED`.
If the underlying platform does not support the current feature,
skip the test, instead of failing.
@RonEld RonEld force-pushed the unsupported_feature_error_support branch from 6f99326 to 55c4a6d Compare January 6, 2019 11:24
@RonEld
Copy link
Contributor Author

RonEld commented Jan 6, 2019

I have rebased to resolve conflicts

Copy link
Contributor

@k-stachowiak k-stachowiak left a comment

Choose a reason for hiding this comment

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

I found few code style issues, most of which I consider negligible, except for an unaligned line and redundant spaces in the middle of one of the lines.

Otherwise the PR looks good (note that I do not know, in which functions the "feature anavailable" error is acceptable, and in which hot; therefore I did not evaluate this aspect).
Additionally, i built and ran all the examples with IAR on K64F. Unfortunately, this device doesn't trigger the new behavior, but I can confirm, that the changes don't interfere with the regular execution in my environment.

{ \
mbedtls_printf("Feature unsupported\n"); \
break; \
} else if (ret != 0) { \
Copy link
Contributor

Choose a reason for hiding this comment

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

There are unnecessary spaces in this line.

@@ -184,7 +184,11 @@ do { \
t.stop(); \
ms = t.read_ms(); \
\
if (ret != 0) { \
if (ret == MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED)\
{ \
Copy link
Contributor

Choose a reason for hiding this comment

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

Code style: this brace should probably be in line with the condition below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm sorry, but I don't understand. What brace? What condition?

Copy link
Contributor

@k-stachowiak k-stachowiak Jan 16, 2019

Choose a reason for hiding this comment

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

In Mbed OS the braces should be on the same lines as the if condition (https://os.mbed.com/docs/mbed-os/v5.7/reference/guidelines.html#style). So it should be:

if (condition) {

rather than:

if (condition)
{

My mind may have been clouded when I wrote the comment, because I agree it isn't clear; I apologize for that. Most probably I wanted to write "... on the same line as the condition above".

ret = mbedtls_snprintf(title, sizeof(title), "ECDSA-%s",
curve_info->name);
curve_info->name);
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems that this line is not indented correctly.

"mbedtls_snprintf(): %d\n", ret);
goto exit;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

This empty line is redundant.

@@ -1246,15 +1353,36 @@ MBED_NOINLINE static int benchmark_ecdh_curve22519()
mbedtls_ecdh_init(&ecdh);
mbedtls_mpi_init(&z);

ret = mbedtls_snprintf(title, sizeof(title), "ECDHE-Curve25519");
Copy link
Contributor

Choose a reason for hiding this comment

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

This line is misaligned.

Fix alignments and remove extra lines and spaces.
@RonEld
Copy link
Contributor Author

RonEld commented Jan 15, 2019

@k-stachowiak Thank you for the review!

I have addressed your comments.

As for your note:

note that I do not know, in which functions the "feature anavailable" error is acceptable, and in which hot; therefore I did not evaluate this aspect

The underlying platform can return this error on any function that it implements. For uniformity, I added a check for this error for all crypto errors, even if they don't have an alternative implementation for the time being.
For reference, you can look at Mbed-TLS/mbedtls#2124 for the changes in the benchmark application.

@k-stachowiak
Copy link
Contributor

@RonEld Thanks for the changes that you have provided. I'm sorry I wasn't clear in my previous review; I am afraid that some more style changes should be made in this PR. What I mean is having the opening and closing braces on the same lines as the statements. To avoid confusion I linked the Mbed OS coding style paragraph in the review comment.

Fix braces style to be like in mbed OS, K & R style.
@RonEld
Copy link
Contributor Author

RonEld commented Jan 16, 2019

@k-stachowiak Thank you for refering me to hte mbed OS coding style.
I ha ve modified the craces style in the file.
please review

Copy link
Contributor

@k-stachowiak k-stachowiak left a comment

Choose a reason for hiding this comment

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

@RonEld Thanks for making the changes! The code looks good now.

@RonEld RonEld requested a review from AndrzejKurek January 23, 2019 07:25
@Patater Patater merged commit 8fb5abd into ARMmbed:master Jun 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants