Change some error codes to be more accurate
Signed-off-by: David Horstmann <david.horstmann@arm.com>
diff --git a/library/oid.c b/library/oid.c
index 9b8bef6..996b541 100644
--- a/library/oid.c
+++ b/library/oid.c
@@ -902,7 +902,7 @@
while (*p < bound && **p >= '0' && **p <= '9') {
ret = 0;
if (num > (INT_MAX / 10)) {
- return MBEDTLS_ERR_OID_BUF_TOO_SMALL;
+ return MBEDTLS_ERR_ASN1_INVALID_DATA;
}
num *= 10;
num += **p - '0';
@@ -988,7 +988,7 @@
if ((UINT_MAX - (unsigned int) component2) <=
((unsigned int) component1 * 40)) {
- return MBEDTLS_ERR_OID_BUF_TOO_SMALL;
+ return MBEDTLS_ERR_ASN1_INVALID_DATA;
}
encoded_len = oid_subidentifier_num_bytes(((unsigned int) component1 * 40)
+ (unsigned int) component2);
@@ -1008,7 +1008,7 @@
size_t num_bytes = oid_subidentifier_num_bytes(val);
if ((SIZE_MAX - encoded_len) <= num_bytes) {
- return MBEDTLS_ERR_OID_BUF_TOO_SMALL;
+ return MBEDTLS_ERR_ASN1_INVALID_DATA;
}
encoded_len += num_bytes;
}