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>
This commit is contained in:
Gilles Peskine
2025-05-07 23:05:12 +02:00
parent 47f1d7be95
commit 4c83221320
7 changed files with 25 additions and 28 deletions

View File

@@ -66,7 +66,7 @@
int FN_NAME(const mbedtls_asn1_buf *oid, ATTR1_TYPE * ATTR1) \
{ \
const TYPE_T *data = oid_ ## TYPE_NAME ## _from_asn1(oid); \
if (data == NULL) return MBEDTLS_ERR_OID_NOT_FOUND; \
if (data == NULL) return MBEDTLS_ERR_X509_UNKNOWN_OID; \
*ATTR1 = data->descriptor.ATTR1; \
return 0; \
}
@@ -80,7 +80,7 @@
int FN_NAME(const mbedtls_asn1_buf *oid, ATTR1_TYPE * ATTR1) \
{ \
const TYPE_T *data = oid_ ## TYPE_NAME ## _from_asn1(oid); \
if (data == NULL) return MBEDTLS_ERR_OID_NOT_FOUND; \
if (data == NULL) return MBEDTLS_ERR_X509_UNKNOWN_OID; \
*ATTR1 = data->ATTR1; \
return 0; \
}
@@ -95,7 +95,7 @@
ATTR2_TYPE * ATTR2) \
{ \
const TYPE_T *data = oid_ ## TYPE_NAME ## _from_asn1(oid); \
if (data == NULL) return MBEDTLS_ERR_OID_NOT_FOUND; \
if (data == NULL) return MBEDTLS_ERR_X509_UNKNOWN_OID; \
*(ATTR1) = data->ATTR1; \
*(ATTR2) = data->ATTR2; \
return 0; \
@@ -117,7 +117,7 @@
} \
cur++; \
} \
return MBEDTLS_ERR_OID_NOT_FOUND; \
return MBEDTLS_ERR_X509_UNKNOWN_OID; \
}
/*
@@ -138,7 +138,7 @@
} \
cur++; \
} \
return MBEDTLS_ERR_OID_NOT_FOUND; \
return MBEDTLS_ERR_X509_UNKNOWN_OID; \
}
/*