2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.2 1995-02-02 20:38:50 quinn
10 * Revision 1.1 1995/02/02 16:21:52 quinn
17 int ber_octetstring(ODR o, ODR_OCT *p, int cons)
20 unsigned char *base, *c;
25 if ((res = ber_declen(o->bp, &len)) < 0)
29 if (cons) /* fetch component strings */
32 while (odp_more_chunks(o, base, len))
33 if (!odr_octetstring(o, &p, 0))
37 /* primitive octetstring */
42 if (len > p->size - p->len)
44 c = nalloc(o, p->size += len + 1);
46 memcpy(c, p->buf, p->len);
49 memcpy(p->buf + p->len, o->bp, len);
55 if ((res = ber_enclen(o->bp, p->len, 5, 0)) < 0)
63 memcpy(o->bp, p->buf, p->len);
67 case ODR_PRINT: return 1;