-
Notifications
You must be signed in to change notification settings - Fork 13
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
Make legacy declarations private: macro guard, cipher #132
base: development
Are you sure you want to change the base?
Make legacy declarations private: macro guard, cipher #132
Conversation
Signed-off-by: Gilles Peskine <[email protected]>
Guard private declarations in public headers with this macro. Signed-off-by: Gilles Peskine <[email protected]>
Signed-off-by: Gilles Peskine <[email protected]>
@@ -1164,6 +1167,9 @@ int mbedtls_cipher_auth_decrypt_ext(mbedtls_cipher_context_t *ctx, | |||
unsigned char *output, size_t output_len, | |||
size_t *olen, size_t tag_len); | |||
#endif /* MBEDTLS_CIPHER_MODE_AEAD || MBEDTLS_NIST_KW_C */ | |||
|
|||
#endif /* MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS */ |
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.
It would be convenient to additionally annotate all function declarations between #if defined(MBEDTLS_DECLARE_PRIVATE_IDENTIFIERS)
and the corresponding #endif
with MBEDTLS_DECLARE_PRIVATE_FUNCTION
which can be defined to expand to something like __attribute__((__deprecated__))
. This would allow detecting the uses of private functions through compiler warnings, and gradually eliminating them by eliminating warnings.
We can add these annotations mechanically, once we've manually added the preprocessor guards.
Make legacy functions private by guarding their declaration with a macro.
As an example, do
cipher.h
(functions only, I didn't check if some macros and types should become private).This is up for design review. There is no update to documentation yet. Some open questions:
PR checklist