From bedd2e7ccb1595c23e159eaa952ae1b0b5a3d2ad Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Sat, 15 Mar 2014 01:49:50 +0100 Subject: Lean and mean initial commit Not much functionality yet --- fmt_asn1sint.c | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 fmt_asn1sint.c (limited to 'fmt_asn1sint.c') diff --git a/fmt_asn1sint.c b/fmt_asn1sint.c new file mode 100644 index 0000000..986c398 --- /dev/null +++ b/fmt_asn1sint.c @@ -0,0 +1,11 @@ +#include "asn1.h" + +size_t fmt_asn1sint(char* dest,enum asn1_tagclass tc,enum asn1_tagtype tt,enum asn1_tag tag,signed long l) { + size_t len,tmp; + /* first the tag */ + if (!dest) return fmt_asn1tag(0,tc,tt,tag)+1+fmt_asn1intpayload(0,l); + len=fmt_asn1tag(dest,tc,tt,tag); + tmp=fmt_asn1sintpayload(dest+len+1,l); + if (fmt_asn1length(dest+len,tmp)!=1) return 0; + return len+tmp+1; +} -- cgit v1.2.3-55-g7522