-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fixed missing functions from doxygen headers #965
base: development
Are you sure you want to change the base?
Fixed missing functions from doxygen headers #965
Conversation
Hi @gilles-peskine-arm the CI is failing because:
perhaps this post could assisst |
Looks good to me. @Patater - if you can review this too, we can get it merged. |
@@ -96,7 +98,7 @@ | |||
|
|||
# Things that should be enabled in "full" even if they match @excluded | |||
my @non_excluded = qw( | |||
PLATFORM_[A-Z0-9]+_ALT | |||
PLATFORM_[_A-Z0-9]+_ALT |
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.
This now matches double (or more) _
like PLATFORM_____WHATEVER_STUFF_____ALT
. Consider removing all _
from outside the []
.
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.
I personally don't think this matters. Whether the underscore is inside or outside the brackets, they'll still match to multiple underscores, but I don't think that's an issue.
@@ -170,6 +172,9 @@ | |||
if ($action eq "realfull") { | |||
$exclude_re = qr/^$/; | |||
$no_exclude_re = qr/./; | |||
} elsif ($action eq "docfull") { | |||
$exclude_re = qr/_ALT\s*$/; | |||
$no_exclude_re = qr/(?:PLATFORM|ECP)_[_A-Z0-9]+_ALT\s*$/; |
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.
This also matches double (or more) _
. Consider removing all _
from outside the []
.
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.
This commit says it doesn't include ECC functions in doxygen output yet, but it perhaps is partially making the attempt by having ECP
in this no exclude regex. Should the |ECP
addition be in the ECC function no exclude commit instead?
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.
I think the structure of the commits makes logical sense as they are. I don't see a need to restructure them.
md_internal.h \ | ||
pk_internal.h \ | ||
ssl_internal.h \ | ||
*_wrap.h |
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.
Which _internal.h
files are we additionally allowing now? Is it clear to folks adding new _internal.h
files that they won't get excluded automatically anymore?
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.
I think there has been a shift in what _internal.h
is used for: it used to mean "don't include this in your application, it's only for internal library use", but in recently added occurrences it means "don't include this in your application, it's only for implementers of alternative crypto implementations". I wish we had distinct names for those two meanings but it's two late for that. Anyway, it looks like new _internal.h
files will most likely fall in that second category, so should indeed be included by default. (Ideally we could have different doxyfiles for end-users and alt-implementers.)
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.
I've added a comment to explain this.
@@ -98,7 +104,7 @@ int mbedtls_internal_ecp_init( const mbedtls_ecp_group *grp ); | |||
*/ | |||
void mbedtls_internal_ecp_free( const mbedtls_ecp_group *grp ); | |||
|
|||
#if defined(ECP_SHORTWEIERSTRASS) | |||
/* Short Weierstrass form */ |
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.
I'm not really sure why removing these ECP_SHORTWEIERSTRASS
and ECP_MONTGOMERY
ifdefs causes ECP functions with ALT implementations to be included in the Doxygen output. If why isn't obvious to an informed developer, could you please explain why in the commit message?
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.
I believe this will also fix #1147
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.
I've added a clarifying description to the commit. Please let me know if it's sufficient.
ChangeLog
Outdated
@@ -36,6 +36,8 @@ Changes | |||
* Clarify ECDSA documentation and improve the sample code to avoid | |||
misunderstandings and potentially dangerous use of the API. Pointed out | |||
by Jean-Philippe Aumasson. | |||
* Tweaked apidoc_full.sh to include functions with alternative |
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.
What tense are we supposed to use in the ChangeLog?
We should use a consistent tense.
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.
Judging from the surrounding ChangeLog entries, this should be Tweak
for uniformity.
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.
I've changed the tense and tried to improve the comment.
@gilles-peskine-arm The _ stuff is just "comment", not strictly requiring a change. With or without the The comment about tense should be addressed. The |
@gilles-peskine-arm I think the philosophy of what goes to doxigen output is yet to be defined, so concerns about upholding it should not block a PR. Anyway, I believe this PR keeps the spirit of what we'd been doing previously. |
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.
This looks good to me, both the intent and how it's implemented.
However, there are non-trivial merge conflicts in config.pl
which need to be addressed before merging.
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.
We've merged platform_zeroize, so MBEDTLS_PLATFORM_ZEROIZE_ALT
Doxygen isn't being generated properly. I'm happy to review after a rebase on latest development.
@gilles-peskine-arm If you find time, could you rebase this? |
@hanno-arm Looking at the comments here there's more work to do than just rebasing. I won't have time until the week after next. |
fixes #520 , but the script for generating the documentation in the website should probably change as well |
@gilles-peskine-arm - Do you think you'll be able to rework this PR? Or can I adopt it (or find a volunteer)? |
This PR has bitrotted and I don't intend to work on it in the short or medium term. |
Functions which had alternative implementations were omitted from the documentation generated by apidoc_full.sh, due to the way #define's were managed. This commit fixes this except for the ECC functions.
Some internal ECP functions which can be provided as alternative implementations to accelerate ECC operations were not being included in the doxygen generated documentation. This is because they were only being included in the header if the preprocessor symbols ECP_SHORTWEIERSTRASS and ECP_MONTGOMERY were included. Yet neither symbol is a config.h option, and were actually symbols that were defined internally in ecp.c, only after ecp_internal.h had been included. The missing functions also have no implementation in the library and are only defined as a means to provide acceleration through 3rd party implementation. Surrounding the functions by the symbols ECP_SHORTWEIERSTRASS and ECP_MONTGOMERY therefore is unnecessary, and stops the documentation from including them. This commit therefore removes those guards. Fixes Mbed-TLS#1147.
Fix the tense in the ChangeLog and refine the language.
Added a comment to doxygen/mbedtls.doxyfile to explain what is and isn't excluded from doxygen documentation and why.
4b022b3
to
d4b5e81
Compare
@@ -19,7 +19,7 @@ fi | |||
CONFIG_BAK=${CONFIG_H}.bak | |||
cp -p $CONFIG_H $CONFIG_BAK | |||
|
|||
scripts/config.pl realfull | |||
scripts/config.pl docfull |
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.
Since we only use realfull
to generate the documentation (which was its original purpose in 1989caf), we don't document it, and the library doesn't even build (check_config.h
would signal conflicts), I think we should change what realfull
does to be useful for its intended purpose and not introduce a new name.
@@ -218,7 +223,7 @@ | |||
|
|||
my $done; | |||
for my $line (@config_lines) { | |||
if ($action eq "full" || $action eq "realfull" || $action eq "baremetal" ) { | |||
if (grep {$action eq $_} qw(docfull full realfull baremetal)) { | |||
if ($line =~ /name SECTION: Module configuration options/) { |
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.
Note that including “Module configuration options” when generating the documentation fixes the bug that some configuration options are missing (#520), but introduces a minor bug: many options have lines like //#define MBEDTLS_FOO 42 /**< Description */
that were copied from another header with //
prepended, and this results in a duplicated sentence in the rendered documentation since Doxygen concatenates the documentation blocks from config.h
and the other header.
A couple of years later, it was not entirely clear to me what exactly this was doing, so I ran However since 3.0 those files have moved and are now It should also be noted that the ALT framework is going to be deprecated in favour of PSA crypto drivers in the near future. |
As part of our review of historical PRs we have made the decision to convert older PRs that have not been updated in 3 months into drafts until they are worked on again. |
Functions which had alternative implementations were omitted from the documentation generated by apidoc_full.sh, due to the way #define's were managed. This commit fixes this except for the ECC functions.
Internal ref: IOTSSL-1447. See also ARMmbed/mbed-os-5-docs#171