Skip to content

CONFIG_MBEDTLS_PEM_CERTIFICATE_FORMAT is misleading as it only enables PEM parsing #75427

@sorru94

Description

@sorru94

Is your enhancement proposal related to a problem? Please describe.
The configuration option CONFIG_MBEDTLS_PEM_CERTIFICATE_FORMAT is misleading as it claims to enable support for PEM format. In reality, it only enables support for parsing PEM files but leaves PEM writing disabled.

Describe the solution you'd like
A simple solution would be to enable PEM writing with the same option.
This could be done by adding the #define MBEDTLS_PEM_WRITE_C line in the config-tls-generic.h file together with the already present #define MBEDTLS_PEM_PARSE_C.

#if defined(CONFIG_MBEDTLS_PEM_CERTIFICATE_FORMAT) && \
defined(MBEDTLS_X509_CRT_PARSE_C)
#define MBEDTLS_PEM_PARSE_C
#define MBEDTLS_BASE64_C
#endif

Describe alternatives you've considered
Otherwise, CONFIG_MBEDTLS_PEM_CERTIFICATE_FORMAT could be changed to a more meaningful name, such as
CONFIG_MBEDTLS_PEM_PARSE_C. Then a separate option could be added to write the PEM format. Something like CONFIG_MBEDTLS_PEM_WRITE_C.
Those names could be more explicative as CONFIG_MBEDTLS_PEM_CERTIFICATE_FORMAT implies support for a certificate format, while PEM files can also be keys or certificate signing requests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementChanges/Updates/Additions to existing features

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions