-
Notifications
You must be signed in to change notification settings - Fork 45
Privatize functions and some types/macros in cipher.h #259
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
Privatize functions and some types/macros in cipher.h #259
Conversation
A lot more types & macros could probably be privatized too, however doing so would break the CI for other reasons. e.g. |
I think we should try to find a reasonable compromise between the two. We don't have time to spend hours analyzing every single macro. But we should take quick wins. For example, I wouldn't insist on doing this kind of analysis for all macros, especially for ones that are used in more places or in more complex ways. But I'd prefer to privatize macros when the analysis and fix is as easy as this case. |
Sounds good - I've re-privatized those two macros then. I can't see any other macros/types that are privatized as easily, so the ones privatized in this PR should be the complete list - on my end at least. |
Signed-off-by: Felix Conway <[email protected]>
Signed-off-by: Felix Conway <[email protected]>
Signed-off-by: Felix Conway <[email protected]>
a940dde
to
5cdde0f
Compare
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.
Looks good to me, but I think now that GCC/CCM are done, we can probably go a bit further here. For example, in a local copy of this branch (with development merged in) I was able to make mbedtls_cipher_mode_t
private and things are still compiling (at least in the default config).
…n work Signed-off-by: Felix Conway <[email protected]>
Ah yes - done that now & updated the PR description to include the newly-privatized types/macros, cheers! |
Signed-off-by: Felix Conway <[email protected]>
...And the CI reminded my why they were left unprivatized (at least |
Ah, thanks for trying it out and explaining the results! |
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.
LGTM, thanks!
@bjwtaylor Gentle reminder that this is waiting for you to review again :) |
d999dcb
Privatizes all functions and some types/macros (below) by guarding them with
MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS
. Any types/macros not listed/privatized here will break the build if they are privatized.Types privatized:
mbedtls_cipher_padding_t
enum that includes MBEDTLS_KEY_LENGTH_<NONE|DES|DES_EDE|DES_EDE3>
mbedtls_cipher_base_t
Macros privatized:
MBEDTLS_MAX_KEY_LENGTH
MBEDTLS_CIPHER_VARIABLE_IV_LEN
MBEDTLS_CIPHER_VARIABLE_KEY_LEN
MBEDTLS_KEY_BITLEN_SHIFT
(required unlinking from Doxygen comment)MBEDTLS_IV_SIZE_SHIFT
(required unlinking from Doxygen comment)Resolves #220
PR checklist
MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS