Change error codes to more appropriate codes

The more precise error codes are borrowed from the ASN1 module.

Signed-off-by: David Horstmann <david.horstmann@arm.com>
diff --git a/library/oid.c b/library/oid.c
index e720cea..4ec752f 100644
--- a/library/oid.c
+++ b/library/oid.c
@@ -801,13 +801,13 @@
     value = 0;
     if ((oid->p[0]) == 0x80) {
         /* Overlong encoding is not allowed */
-        return MBEDTLS_ERR_OID_BUF_TOO_SMALL;
+        return MBEDTLS_ERR_ASN1_INVALID_DATA;
     }
 
     while (i < oid->len && ((oid->p[i] & 0x80) != 0)) {
         /* Prevent overflow in value. */
         if (value > (UINT_MAX >> 7)) {
-            return MBEDTLS_ERR_OID_BUF_TOO_SMALL;
+            return MBEDTLS_ERR_ASN1_INVALID_DATA;
         }
 
         value |= oid->p[i] & 0x7F;
@@ -815,7 +815,7 @@
         i++;
     }
     if (i >= oid->len) {
-        return MBEDTLS_ERR_OID_BUF_TOO_SMALL;
+        return MBEDTLS_ERR_ASN1_OUT_OF_DATA;
     }
     /* Last byte of first subidentifier */
     value |= oid->p[i] & 0x7F;
@@ -836,11 +836,11 @@
     for (; i < oid->len; i++) {
         /* Prevent overflow in value. */
         if (value > (UINT_MAX >> 7)) {
-            return MBEDTLS_ERR_OID_BUF_TOO_SMALL;
+            return MBEDTLS_ERR_ASN1_INVALID_DATA;
         }
         if ((value == 0) && ((oid->p[i]) == 0x80)) {
             /* Overlong encoding is not allowed */
-            return MBEDTLS_ERR_OID_BUF_TOO_SMALL;
+            return MBEDTLS_ERR_ASN1_INVALID_DATA;
         }
 
         value <<= 7;