summaryrefslogblamecommitdiffstats
path: root/fmt_asn1OID.c
blob: 6f6fc10c6d8183ec5ca67e783328050ba16ccece (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                                                                                                                          
#include "asn1.h"

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,tc,tt,tag,l);
  if (!dest) return l+l2;
  dest[l2]=array[0]*40+array[1];
  dest+=l2+1;
  for (i=2; i<len; ++i)
    dest+=fmt_asn1tagint(dest,array[i]);
  return l+l2;
}