fmt_asn1generic, see t10.c for example usage) add "generic" asn.1 dumper (in t10.c) fix some read off-by-one errors, minor cleanups add real OID support add bitstring support
18 lines
307 B
C
18 lines
307 B
C
#include "asn1.h"
|
|
|
|
size_t fmt_asn1tagint(char* dest,unsigned long l) {
|
|
size_t needed=((sizeof l)*7)/8,i;
|
|
for (i=1; i<needed; ++i)
|
|
if (!(l>>(i*7)))
|
|
break;
|
|
if (dest) {
|
|
size_t j=i;
|
|
while (j) {
|
|
--j;
|
|
*dest=((l>>(j*7))&0x7f) + (j?0x80:0);
|
|
++dest;
|
|
}
|
|
}
|
|
return i;
|
|
}
|