2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.4 1995-02-10 15:55:28 quinn
10 * Revision 1.3 1995/02/03 17:04:34 quinn
11 * *** empty log message ***
13 * Revision 1.2 1995/02/02 20:38:50 quinn
16 * Revision 1.1 1995/02/02 16:21:52 quinn
23 int ber_octetstring(ODR o, Odr_oct *p, int cons)
26 unsigned char *base, *c;
31 if ((res = ber_declen(o->bp, &len)) < 0)
35 if (cons) /* fetch component strings */
38 while (odp_more_chunks(o, base, len))
39 if (!odr_octetstring(o, &p, 0))
43 /* primitive octetstring */
46 if (len + 1 > p->size - p->len)
48 c = nalloc(o, p->size += len + 1);
50 memcpy(c, p->buf, p->len);
54 memcpy(p->buf + p->len, o->bp, len);
60 if ((res = ber_enclen(o->bp, p->len, 5, 0)) < 0)
68 memcpy(o->bp, p->buf, p->len);
72 case ODR_PRINT: return 1;