2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.1 1995-02-02 16:21:52 quinn
14 static int more_chunks(ODR o, unsigned char *base, int len)
18 if (len < 0) /* indefinite length */
20 if (*o->bp == 0 && *(o->bp + 1) == 0)
30 return o->bp - base < len;
33 int ber_octetstring(ODR o, ODR_OCT *p, int cons)
36 unsigned char *base, *c;
41 if ((res = ber_declen(o->bp, &len)) < 0)
45 if (cons) /* fetch component strings */
48 while (more_chunks(o, base, len))
49 if (!odr_octetstring(o, &p, 0))
53 /* primitive octetstring */
58 if (len > p->size - p->len)
60 c = nalloc(o, p->size += len);
62 memcpy(c, p->buf, p->len);
65 memcpy(p->buf + p->len, o->bp, len);
71 if ((res = ber_enclen(o->bp, p->len, 5, 0)) < 0)
79 memcpy(o->bp, p->buf, p->len);
83 case ODR_PRINT: return 1;