2 * Copyright (c) 1995-2004, Index Data
3 * See the file LICENSE for details.
5 * $Id: ber_oid.c,v 1.2 2004-02-11 23:49:28 adam Exp $
13 int ber_oidc(ODR o, Odr_oid *p)
17 unsigned char octs[8];
22 if ((res = ber_declen(o->bp, &len, odr_max(o))) < 1)
24 odr_seterror(o, OPROTO, 18);
29 odr_seterror(o, OPROTO, 19);
35 odr_seterror(o, OPROTO, 20);
46 odr_seterror(o, OPROTO, 21);
53 while (*(o->bp++) & 0X80);
61 p[1] = id - p[0] * 40;
68 /* we'll allow ourselves the quiet luxury of only doing encodings
71 if (odr_putc(o, 0) < 0) /* dummy */
73 if (p[0] < 0 || p[1] <= 0)
75 odr_seterror(o, ODATA, 23);
78 for (pos = 1; p[pos] >= 0; pos++)
87 octs[n++] = id & 0X7F;
95 p = octs[n] | ((n > 0) << 7);
96 if (odr_putc(o, p) < 0)
101 odr_seek(o, ODR_S_SET, lenp);
102 if (ber_enclen(o, (end - lenp) - 1, 1, 1) != 1)
104 odr_seterror(o, OOTHER, 52);
107 odr_seek(o, ODR_S_END, 0);
110 odr_seterror(o, OOTHER, 22);