Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Support the negative option MBEDTLS_BLOCK_CIPHER_NO_DECRYPT #8124
Support the negative option MBEDTLS_BLOCK_CIPHER_NO_DECRYPT #8124
Changes from 54 commits
422a77f
4274247
78ee0c9
590c9b7
380be5a
67208fd
a8ac23a
9141ad1
db9b309
d7058b0
85c3023
702c220
ba473b1
3c56527
72d7bb4
dbcc0c6
207c991
bf66ef9
7821904
a675776
9b81165
4f4822c
56e27b9
c5944d4
3caaf0c
ef1b04d
bc7716c
aa01ee3
4b6595a
b67b474
e367e47
b799eea
6611139
eefd269
6b190d4
be08908
f24bbd9
de0e259
f149640
956aa00
0d76b6e
5347957
bc29aef
4995e0c
004a60c
d137da5
f03b491
70743b0
9938554
49cd4b5
4cd1b16
799bd84
111159b
cd25d22
0287b9d
85b7465
b2d6e52
07e663d
3ae1199
19583e4
c434791
690ee81
70642ec
42be1ba
18040ed
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Here we can drop the guard and just use
MBEDTLS_MAYBE_UNUSED
as this is static, so the compiler will remove it (I tested this, no impact on code size).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.
If a static function / variable is guarded by a single/simple macro, should we guard it directly or use
MBEDTLS_MAYBE_UNUSED
to let compiler remove it for us?For example:
But I got
error log
I'm not sure why compiler doesn't remove
aes_setkey_dec_wrap
for us. But IMO, if the guard is not very complicated, maybe using guard is more reliable?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.
The compiler would remove the unused static functions and variables. But in your case, I think it is a compiler error before the removing happens. The preprocessor runs before the compiler, and it removes
mbedtls_aes_setkey_dec
since it is guarded by preprocessor macro. So you need to guard the function call.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.
No strong preference on this one. We use
MBEDTLS_MAYBE_UNUSED
in aes.c, because the guards got so complicated I wanted to remove as many as possible and let the compiler remove functions automatically as far as possible. Butaesce.c
doesn't have this problem so either approach is OK in my view.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.