Lines Matching +defs:t +defs:f

95 sizeofType(const struct asn1_template *t)
97 return t->offset;
152 _asn1_decode(const struct asn1_template *t, unsigned flags,
155 size_t elements = A1_HEADER_LEN(t);
159 unsigned int template_flags = t->tt;
162 t++;
168 switch (t->tt & A1_OP_MASK) {
172 void *el = DPO(data, t->offset);
175 if ((t->tt & A1_OP_MASK) == A1_OP_TYPE) {
176 size = sizeofType(t->ptr);
178 const struct asn1_type_func *f = t->ptr;
179 size = f->size;
182 if (t->tt & A1_FLAG_OPTIONAL) {
188 if ((t->tt & A1_OP_MASK) == A1_OP_TYPE) {
189 ret = _asn1_decode(t->ptr, flags, p, len, el, &newsize);
191 const struct asn1_type_func *f = t->ptr;
192 ret = (f->decode)(p, len, el, &newsize);
195 if (t->tt & A1_FLAG_OPTIONAL) {
214 ret = der_match_tag_and_length(p, len, A1_TAG_CLASS(t->tt),
215 &dertype, A1_TAG_TAG(t->tt),
218 if (t->tt & A1_FLAG_OPTIONAL)
230 if (dertype != A1_TAG_TYPE(t->tt) && (flags & A1_PF_ALLOW_BER)) {
231 const struct asn1_template *subtype = t->ptr;
251 data = DPO(data, t->offset);
253 if (t->tt & A1_FLAG_OPTIONAL) {
255 size_t ellen = sizeofType(t->ptr);
263 ret = _asn1_decode(t->ptr, subflags, p, datalen, data, &newsize);
294 unsigned int type = A1_PARSE_TYPE(t->tt);
296 void *el = DPO(data, t->offset);
319 struct template_of *el = DPO(data, t->offset);
321 size_t ellen = sizeofType(t->ptr);
337 ret = _asn1_decode(t->ptr, flags & (~A1_PF_INDEFINTE), p, len,
349 const struct asn1_template *bmember = t->ptr;
378 const struct asn1_template *choice = t->ptr;
413 t++;
444 _asn1_encode(const struct asn1_template *t, unsigned char *p, size_t len, const void *data, size_t *size)
446 size_t elements = A1_HEADER_LEN(t);
450 t += A1_HEADER_LEN(t);
453 switch (t->tt & A1_OP_MASK) {
457 const void *el = DPOC(data, t->offset);
459 if (t->tt & A1_FLAG_OPTIONAL) {
466 if ((t->tt & A1_OP_MASK) == A1_OP_TYPE) {
467 ret = _asn1_encode(t->ptr, p, len, el, &newsize);
469 const struct asn1_type_func *f = t->ptr;
470 ret = (f->encode)(p, len, el, &newsize);
483 data = DPOC(data, t->offset);
485 if (t->tt & A1_FLAG_OPTIONAL) {
494 ret = _asn1_encode(t->ptr, p, len, data, &datalen);
501 A1_TAG_CLASS(t->tt),
502 A1_TAG_TYPE(t->tt),
503 A1_TAG_TAG(t->tt), &l);
514 unsigned int type = A1_PARSE_TYPE(t->tt);
516 const void *el = DPOC(data, t->offset);
531 const struct template_of *el = DPOC(data, t->offset);
532 size_t ellen = sizeofType(t->ptr);
551 val[i].length = _asn1_length(t->ptr, elptr);
554 ret = _asn1_encode(t->ptr, DPO(val[i].data, val[i].length - 1),
593 struct template_of *el = DPO(data, t->offset);
594 size_t ellen = sizeofType(t->ptr);
605 ret = _asn1_encode(t->ptr, p, len,
617 const struct asn1_template *bmember = t->ptr;
663 const struct asn1_template *choice = t->ptr;
690 t--;
700 _asn1_length(const struct asn1_template *t, const void *data)
702 size_t elements = A1_HEADER_LEN(t);
705 t += A1_HEADER_LEN(t);
708 switch (t->tt & A1_OP_MASK) {
711 const void *el = DPOC(data, t->offset);
713 if (t->tt & A1_FLAG_OPTIONAL) {
720 if ((t->tt & A1_OP_MASK) == A1_OP_TYPE) {
721 ret += _asn1_length(t->ptr, el);
723 const struct asn1_type_func *f = t->ptr;
724 ret += (f->length)(el);
732 data = DPO(data, t->offset);
734 if (t->tt & A1_FLAG_OPTIONAL) {
742 datalen = _asn1_length(t->ptr, data);
743 ret += der_length_tag(A1_TAG_TAG(t->tt)) + der_length_len(datalen);
749 unsigned int type = A1_PARSE_TYPE(t->tt);
750 const void *el = DPOC(data, t->offset);
761 const struct template_of *el = DPOC(data, t->offset);
762 size_t ellen = sizeofType(t->ptr);
767 ret += _asn1_length(t->ptr, element);
774 const struct asn1_template *bmember = t->ptr;
798 const struct asn1_template *choice = t->ptr;
817 t--;
823 _asn1_free(const struct asn1_template *t, void *data)
825 size_t elements = A1_HEADER_LEN(t);
827 if (t->tt & A1_HF_PRESERVE)
830 t++;
833 switch (t->tt & A1_OP_MASK) {
836 void *el = DPO(data, t->offset);
838 if (t->tt & A1_FLAG_OPTIONAL) {
845 if ((t->tt & A1_OP_MASK) == A1_OP_TYPE) {
846 _asn1_free(t->ptr, el);
848 const struct asn1_type_func *f = t->ptr;
849 (f->release)(el);
851 if (t->tt & A1_FLAG_OPTIONAL)
857 unsigned int type = A1_PARSE_TYPE(t->tt);
858 void *el = DPO(data, t->offset);
868 void *el = DPO(data, t->offset);
870 if (t->tt & A1_FLAG_OPTIONAL) {
877 _asn1_free(t->ptr, el);
879 if (t->tt & A1_FLAG_OPTIONAL)
886 struct template_of *el = DPO(data, t->offset);
887 size_t ellen = sizeofType(t->ptr);
892 _asn1_free(t->ptr, element);
904 const struct asn1_template *choice = t->ptr;
922 t++;
928 _asn1_copy(const struct asn1_template *t, const void *from, void *to)
930 size_t elements = A1_HEADER_LEN(t);
932 int preserve = (t->tt & A1_HF_PRESERVE);
934 t++;
943 switch (t->tt & A1_OP_MASK) {
946 const void *fel = DPOC(from, t->offset);
947 void *tel = DPO(to, t->offset);
951 if ((t->tt & A1_OP_MASK) == A1_OP_TYPE) {
952 size = sizeofType(t->ptr);
954 const struct asn1_type_func *f = t->ptr;
955 size = f->size;
958 if (t->tt & A1_FLAG_OPTIONAL) {
969 if ((t->tt & A1_OP_MASK) == A1_OP_TYPE) {
970 ret = _asn1_copy(t->ptr, fel, tel);
972 const struct asn1_type_func *f = t->ptr;
973 ret = (f->copy)(fel, tel);
977 if (t->tt & A1_FLAG_OPTIONAL) {
986 unsigned int type = A1_PARSE_TYPE(t->tt);
987 const void *fel = DPOC(from, t->offset);
988 void *tel = DPO(to, t->offset);
1004 from = DPOC(from, t->offset);
1005 to = DPO(to, t->offset);
1007 if (t->tt & A1_FLAG_OPTIONAL) {
1017 to = *tel = calloc(1, sizeofType(t->ptr));
1022 ret = _asn1_copy(t->ptr, from, to);
1024 if (t->tt & A1_FLAG_OPTIONAL) {
1038 const struct template_of *fel = DPOC(from, t->offset);
1039 struct template_of *tel = DPO(to, t->offset);
1040 size_t ellen = sizeofType(t->ptr);
1050 ret = _asn1_copy(t->ptr,
1059 const struct asn1_template *bmember = t->ptr;
1065 const struct asn1_template *choice = t->ptr;
1090 t++;
1097 _asn1_decode_top(const struct asn1_template *t, unsigned flags, const unsigned char *p, size_t len, void *data, size_t *size)
1100 memset(data, 0, t->offset);
1101 ret = _asn1_decode(t, flags, p, len, data, size);
1103 _asn1_free(t, data);
1104 memset(data, 0, t->offset);
1111 _asn1_copy_top(const struct asn1_template *t, const void *from, void *to)
1114 memset(to, 0, t->offset);
1115 ret = _asn1_copy(t, from, to);
1117 _asn1_free(t, to);
1118 memset(to, 0, t->offset);