Lines Matching refs:len
151 const unsigned char *p, size_t len, void *data, size_t *size)
154 size_t oldlen = len;
187 ret = _asn1_decode(t->ptr, flags, p, len, el, &newsize);
190 ret = (f->decode)(p, len, el, &newsize);
200 p += newsize; len -= newsize;
212 ret = der_match_tag_and_length(p, len, A1_TAG_CLASS(t->tt),
221 p += l; len -= l;
241 datalen = len;
246 } else if (datalen > len)
268 len -= datalen;
276 ret = der_match_tag_and_length(p, len, ASN1_C_UNIV,
285 p += l; len -= l;
308 ret = (prim[type].decode)(p, len, el, &newsize);
311 p += newsize; len -= newsize;
322 while (len > 0) {
335 ret = _asn1_decode(t->ptr, flags & (~A1_PF_INDEFINTE), p, len,
340 el->len++;
341 p += newsize; len -= newsize;
356 if (len < 1)
358 p++; len--;
360 while (elements && len) {
362 if (len < 1)
364 p++; len--;
367 if (len) {
372 len = 0;
383 ret = _asn1_decode(choice[i].ptr, 0, p, len,
387 p += datalen; len -= datalen;
398 ret = der_get_octet_string(p, len,
402 p += datalen; len -= datalen;
416 len = 0;
418 oldlen -= len;
442 _asn1_encode(const struct asn1_template *t, unsigned char *p, size_t len, const void *data, size_t *size)
446 size_t oldlen = len;
465 ret = _asn1_encode(t->ptr, p, len, el, &newsize);
468 ret = (f->encode)(p, len, el, &newsize);
473 p -= newsize; len -= newsize;
492 ret = _asn1_encode(t->ptr, p, len, data, &datalen);
496 len -= datalen; p -= datalen;
498 ret = der_put_length_and_tag(p, len, datalen,
505 p -= l; len -= l;
521 ret = (prim[type].encode)(p, len, el, &newsize);
524 p -= newsize; len -= newsize;
535 if (el->len == 0)
538 if (el->len > UINT_MAX/sizeof(val[0]))
541 val = malloc(sizeof(val[0]) * el->len);
545 for(totallen = 0, i = 0; i < el->len; i++) {
565 if (ret == 0 && totallen > len)
575 len -= totallen;
577 qsort(val, el->len, sizeof(val[0]), _heim_der_set_sort);
579 i = el->len - 1;
597 if (el->len == 0)
600 elptr += ellen * (el->len - 1);
602 for (i = 0; i < el->len; i++) {
603 ret = _asn1_encode(t->ptr, p, len,
608 p -= newsize; len -= newsize;
630 while (elements && len) {
633 if (len < 1)
635 *p-- = c; len--;
644 if (len < 1)
646 *p-- = c; len--;
649 if (len < 1)
656 len--;
672 ret += der_put_octet_string(p, len,
677 ret = _asn1_encode(choice->ptr, p, len, el, &datalen);
681 len -= datalen; p -= datalen;
692 *size = oldlen - len;
764 for (i = 0; i < el->len; i++) {
889 for (i = 0; i < el->len; i++) {
895 el->len = 0;
1041 tel->val = calloc(fel->len, ellen);
1045 tel->len = fel->len;
1047 for (i = 0; i < fel->len; i++) {
1095 _asn1_decode_top(const struct asn1_template *t, unsigned flags, const unsigned char *p, size_t len, void *data, size_t *size)
1099 ret = _asn1_decode(t, flags, p, len, data, size);