Declare oid_xxx_numeric_string only when they are defined
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
diff --git a/include/mbedtls/x509.h b/include/mbedtls/x509.h
index 5a3bd8a..17b3c5d 100644
--- a/include/mbedtls/x509.h
+++ b/include/mbedtls/x509.h
@@ -489,6 +489,7 @@
p += (size_t) ret; \
} while (0)
+#if defined(MBEDTLS_X509_USE_C)
/**
* \brief Translate an ASN.1 OID into its numeric representation
* (e.g. "\x2A\x86\x48\x86\xF7\x0D" into "1.2.840.113549")
@@ -501,7 +502,9 @@
* PSA_ERROR_BUFFER_TOO_SMALL in case of error
*/
int mbedtls_oid_get_numeric_string(char *buf, size_t size, const mbedtls_asn1_buf *oid);
+#endif /* MBEDTLS_X509_USE_C */
+#if defined(MBEDTLS_X509_CREATE_C)
/**
* \brief Translate a string containing a dotted-decimal
* representation of an ASN.1 OID into its encoded form
@@ -520,6 +523,7 @@
* allocate oid->buf
*/
int mbedtls_oid_from_numeric_string(mbedtls_asn1_buf *oid, const char *oid_str, size_t size);
+#endif /* MBEDTLS_X509_CREATE_C */
#ifdef __cplusplus
}
diff --git a/tests/suites/test_suite_x509write.function b/tests/suites/test_suite_x509write.function
index f43e01e..51a5d37 100644
--- a/tests/suites/test_suite_x509write.function
+++ b/tests/suites/test_suite_x509write.function
@@ -704,7 +704,7 @@
}
/* END_CASE */
-/* BEGIN_CASE depends_on:MBEDTLS_X509_USE_C */
+/* BEGIN_CASE depends_on:MBEDTLS_X509_CREATE_C */
void oid_from_numeric_string(char *oid_str, int error_ret,
data_t *exp_oid_buf)
{