add oid and bitstring parsing and formatting to "generic" format string

routines, test them in t10.c
This commit is contained in:
leitner
2011-04-28 21:33:10 +00:00
parent e04ca78ff8
commit dae3ea8024
12 changed files with 181 additions and 50 deletions

View File

@@ -1,12 +1,12 @@
#include "asn1.h"
size_t fmt_asn1OID(char* dest,const unsigned long* array,unsigned long len) {
size_t fmt_asn1OID(char* dest,enum asn1_tagclass tc,enum asn1_tagtype tt,enum asn1_tag tag,const unsigned long* array,unsigned long len) {
size_t i,l,l2;
if (len<2) return 0;
for (l=1,i=2; i<len; ++i) {
l+=fmt_asn1tagint(dest,array[i]);
}
l2=fmt_asn1transparent(dest,UNIVERSAL,PRIMITIVE,OBJECT_IDENTIFIER,l);
l2=fmt_asn1transparent(dest,tc,tt,tag,l);
if (!dest) return l+l2;
dest[l2]=array[0]*40+array[1];
dest+=l2+1;