Replace MBEDTLS_ERR_OID_NOT_FOUND with MBEDTLS_ERR_X509_UNKNOWN_OID
Replace the non-X.509-named error code `MBEDTLS_ERR_OID_NOT_FOUND` with
`MBEDTLS_ERR_X509_UNKNOWN_OID`, which already exists and is currently not
used for anything.
Public functions in X.509 propagate this error code, so it needs to have a
public name.
Remove the definition of `MBEDTLS_ERR_OID_NOT_FOUND` in `x509_oid.h`, then
```
git grep -l MBEDTLS_ERR_OID_NOT_FOUND | xargs perl -i -pe 's/\bMBEDTLS_ERR_OID_NOT_FOUND\b/MBEDTLS_ERR_X509_UNKNOWN_OID/g'
```
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
diff --git a/library/x509_oid.h b/library/x509_oid.h
index 46cfd54..6b2da98 100644
--- a/library/x509_oid.h
+++ b/library/x509_oid.h
@@ -19,9 +19,6 @@
#include "mbedtls/md.h"
-/** OID is not found. */
-#define MBEDTLS_ERR_OID_NOT_FOUND -0x002E
-
/*
* Maximum number of OID components allowed
*/
@@ -459,7 +456,7 @@
* \param oid OID to use
* \param ext_type place to store the extension type
*
- * \return 0 if successful, or MBEDTLS_ERR_OID_NOT_FOUND
+ * \return 0 if successful, or MBEDTLS_ERR_X509_UNKNOWN_OID
*/
int mbedtls_x509_oid_get_x509_ext_type(const mbedtls_asn1_buf *oid, int *ext_type);
@@ -470,7 +467,7 @@
* \param oid OID to use
* \param short_name place to store the string pointer
*
- * \return 0 if successful, or MBEDTLS_ERR_OID_NOT_FOUND
+ * \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);
@@ -481,7 +478,7 @@
* \param md_alg place to store message digest algorithm
* \param pk_alg place to store public key algorithm
*
- * \return 0 if successful, or MBEDTLS_ERR_OID_NOT_FOUND
+ * \return 0 if successful, or MBEDTLS_ERR_X509_UNKNOWN_OID
*/
int mbedtls_x509_oid_get_sig_alg(const mbedtls_asn1_buf *oid,
mbedtls_md_type_t *md_alg, mbedtls_pk_type_t *pk_alg);
@@ -492,7 +489,7 @@
* \param oid OID to use
* \param desc place to store string pointer
*
- * \return 0 if successful, or MBEDTLS_ERR_OID_NOT_FOUND
+ * \return 0 if successful, or MBEDTLS_ERR_X509_UNKNOWN_OID
*/
int mbedtls_x509_oid_get_sig_alg_desc(const mbedtls_asn1_buf *oid, const char **desc);
@@ -504,7 +501,7 @@
* \param oid place to store ASN.1 OID string pointer
* \param olen length of the OID
*
- * \return 0 if successful, or MBEDTLS_ERR_OID_NOT_FOUND
+ * \return 0 if successful, or MBEDTLS_ERR_X509_UNKNOWN_OID
*/
int mbedtls_x509_oid_get_oid_by_sig_alg(mbedtls_pk_type_t pk_alg, mbedtls_md_type_t md_alg,
const char **oid, size_t *olen);
@@ -515,7 +512,7 @@
* \param oid OID to use
* \param md_alg place to store message digest algorithm
*
- * \return 0 if successful, or MBEDTLS_ERR_OID_NOT_FOUND
+ * \return 0 if successful, or MBEDTLS_ERR_X509_UNKNOWN_OID
*/
int mbedtls_x509_oid_get_md_alg(const mbedtls_asn1_buf *oid, mbedtls_md_type_t *md_alg);
@@ -526,7 +523,7 @@
* \param oid OID to use
* \param desc place to store string pointer
*
- * \return 0 if successful, or MBEDTLS_ERR_OID_NOT_FOUND
+ * \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);
#endif
@@ -537,7 +534,7 @@
* \param oid OID to use
* \param desc place to store string pointer
*
- * \return 0 if successful, or MBEDTLS_ERR_OID_NOT_FOUND
+ * \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);