diff --git a/include/mbedtls/oid.h b/include/mbedtls/oid.h index d769ff2180..5b3a8f9fac 100644 --- a/include/mbedtls/oid.h +++ b/include/mbedtls/oid.h @@ -301,4 +301,40 @@ int mbedtls_oid_get_numeric_string(char *buf, size_t size, const mbedtls_asn1_bu int mbedtls_oid_from_numeric_string(mbedtls_asn1_buf *oid, const char *oid_str, size_t size); #endif /* MBEDTLS_X509_CREATE_C */ +#if defined(MBEDTLS_X509_USE_C) +/** + * \brief Translate an X.509 attribute type OID into the short name + * (e.g. the OID for an X520 Common Name into "CN") + * + * \param oid OID to use + * \param short_name place to store the string pointer + * + * \return 0 if successful, or MBEDTLS_ERR_X509_UNKNOWN_OID + */ +int mbedtls_x509_oid_get_attr_short_name(const mbedtls_asn1_buf *oid, const char **short_name); +#endif /* MBEDTLS_X509_USE_C */ + +#if defined(MBEDTLS_X509_CRT_PARSE_C) && !defined(MBEDTLS_X509_REMOVE_INFO) +/** + * \brief Translate Extended Key Usage OID into description + * + * \param oid OID to use + * \param desc place to store string pointer + * + * \return 0 if successful, or MBEDTLS_ERR_X509_UNKNOWN_OID + */ +int mbedtls_x509_oid_get_extended_key_usage(const mbedtls_asn1_buf *oid, const char **desc); + +/** + * \brief Translate certificate policies OID into description + * + * \param oid OID to use + * \param desc place to store string pointer + * + * \return 0 if successful, or MBEDTLS_ERR_X509_UNKNOWN_OID + */ +int mbedtls_x509_oid_get_certificate_policies(const mbedtls_asn1_buf *oid, const char **desc); +#endif /* MBEDTLS_X509_CRT_PARSE_C && !MBEDTLS_X509_REMOVE_INFO */ + + #endif /* oid.h */ diff --git a/library/x509_oid.h b/library/x509_oid.h index 5721d8586c..26f862a9d8 100644 --- a/library/x509_oid.h +++ b/library/x509_oid.h @@ -53,19 +53,6 @@ typedef struct { int mbedtls_x509_oid_get_x509_ext_type(const mbedtls_asn1_buf *oid, int *ext_type); #endif /* MBEDTLS_X509_OID_HAVE_GET_X509_EXT_TYPE */ -#if defined(MBEDTLS_X509_USE_C) -/** - * \brief Translate an X.509 attribute type OID into the short name - * (e.g. the OID for an X520 Common Name into "CN") - * - * \param oid OID to use - * \param short_name place to store the string pointer - * - * \return 0 if successful, or MBEDTLS_ERR_X509_UNKNOWN_OID - */ -int mbedtls_x509_oid_get_attr_short_name(const mbedtls_asn1_buf *oid, const char **short_name); -#endif /* MBEDTLS_X509_USE_C */ - #if defined(MBEDTLS_X509_USE_C) /** * \brief Translate SignatureAlgorithm OID into md_type and pk_type @@ -121,28 +108,6 @@ int mbedtls_x509_oid_get_oid_by_sig_alg(mbedtls_pk_sigalg_t pk_alg, mbedtls_md_t int mbedtls_x509_oid_get_md_alg(const mbedtls_asn1_buf *oid, mbedtls_md_type_t *md_alg); #endif /* MBEDTLS_X509_OID_HAVE_GET_MD_ALG */ -#if defined(MBEDTLS_X509_CRT_PARSE_C) && !defined(MBEDTLS_X509_REMOVE_INFO) -/** - * \brief Translate Extended Key Usage OID into description - * - * \param oid OID to use - * \param desc place to store string pointer - * - * \return 0 if successful, or MBEDTLS_ERR_X509_UNKNOWN_OID - */ -int mbedtls_x509_oid_get_extended_key_usage(const mbedtls_asn1_buf *oid, const char **desc); - -/** - * \brief Translate certificate policies OID into description - * - * \param oid OID to use - * \param desc place to store string pointer - * - * \return 0 if successful, or MBEDTLS_ERR_X509_UNKNOWN_OID - */ -int mbedtls_x509_oid_get_certificate_policies(const mbedtls_asn1_buf *oid, const char **desc); -#endif /* MBEDTLS_X509_CRT_PARSE_C && !MBEDTLS_X509_REMOVE_INFO */ - #ifdef __cplusplus } #endif diff --git a/tests/suites/test_suite_x509_oid.function b/tests/suites/test_suite_x509_oid.function index b988aa0f67..dc7e2969a6 100644 --- a/tests/suites/test_suite_x509_oid.function +++ b/tests/suites/test_suite_x509_oid.function @@ -3,6 +3,7 @@ #include "mbedtls/asn1.h" #include "mbedtls/asn1write.h" #include "string.h" +#include "mbedtls/oid.h" /* END_HEADER */ /* BEGIN_CASE depends_on:MBEDTLS_X509_CRT_PARSE_C:!MBEDTLS_X509_REMOVE_INFO */