asn1: Add support for encoding large values in OIDs
This commit is contained in:
parent
7971bfded3
commit
61af2c1d0a
|
@ -891,10 +891,13 @@ sc_asn1_encode_object_id(u8 **buf, size_t *buflen, const struct sc_object_id *id
|
||||||
*p = k * 40;
|
*p = k * 40;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (k > 39)
|
if (k > 39 && id->value[0] < 2) {
|
||||||
return SC_ERROR_INVALID_ARGUMENTS;
|
return SC_ERROR_INVALID_ARGUMENTS;
|
||||||
*p++ += k;
|
}
|
||||||
break;
|
/* We can encode larger IDs to multiple bytes
|
||||||
|
* similarly as the following IDs */
|
||||||
|
k += *p;
|
||||||
|
/* fall through */
|
||||||
default:
|
default:
|
||||||
shift = 28;
|
shift = 28;
|
||||||
while (shift && (k >> shift) == 0)
|
while (shift && (k >> shift) == 0)
|
||||||
|
|
Loading…
Reference in New Issue