diff options
Diffstat (limited to 'source4/libcli')
-rw-r--r-- | source4/libcli/util/asn1.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/source4/libcli/util/asn1.c b/source4/libcli/util/asn1.c index 6f613f398b..756a33f77d 100644 --- a/source4/libcli/util/asn1.c +++ b/source4/libcli/util/asn1.c @@ -107,15 +107,23 @@ BOOL asn1_pop_tag(ASN1_DATA *data) return True; } +static void push_int_littleendian(ASN1_DATA *data, int i) +{ + uint8_t lowest = i & 0xFF; + + i = i >> 8; + if (i != 0) + push_int_littleendian(data, i); + + asn1_write_uint8(data, lowest); +} + /* write an integer */ BOOL asn1_write_Integer(ASN1_DATA *data, int i) { if (!asn1_push_tag(data, ASN1_INTEGER)) return False; - do { - asn1_write_uint8(data, i); - i = i >> 8; - } while (i); + push_int_littleendian(data, i); return asn1_pop_tag(data); } |