diff options
author | Simon Rettberg | 2014-03-15 01:49:50 +0100 |
---|---|---|
committer | Simon Rettberg | 2014-03-15 01:49:50 +0100 |
commit | bedd2e7ccb1595c23e159eaa952ae1b0b5a3d2ad (patch) | |
tree | c7d1995a09f6ed0c4e6873252e957d72f5d07d07 /scan_asn1oid.c | |
download | ldadp-bedd2e7ccb1595c23e159eaa952ae1b0b5a3d2ad.tar.gz ldadp-bedd2e7ccb1595c23e159eaa952ae1b0b5a3d2ad.tar.xz ldadp-bedd2e7ccb1595c23e159eaa952ae1b0b5a3d2ad.zip |
Lean and mean initial commit
Not much functionality yet
Diffstat (limited to 'scan_asn1oid.c')
-rw-r--r-- | scan_asn1oid.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/scan_asn1oid.c b/scan_asn1oid.c new file mode 100644 index 0000000..b5abf52 --- /dev/null +++ b/scan_asn1oid.c @@ -0,0 +1,21 @@ +#include "asn1.h" + +size_t scan_asn1oid(const char* src,const char* max,size_t* array,size_t* arraylen) { + size_t res,tlen; + unsigned long tag,tmp; + enum asn1_tagclass tc; + enum asn1_tagtype tt; + if (!arraylen) return 0; + if (!(res=scan_asn1tag(src,max,&tc,&tt,&tag)) || + (tc!=UNIVERSAL || tt!=PRIMITIVE || tag!=OBJECT_IDENTIFIER) || + !(tmp=scan_asn1length(src+res,max,&tlen)) || tlen<1) { + *arraylen=0; + return 0; + } + res+=tmp; + if (max>src+res+tlen) max=src+res+tlen; /* clamp max down */ + src+=res; + + return scan_asn1rawoid(src,max,array,arraylen); +} + |