2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.4 1995-03-08 12:12:11 quinn
8 * Added better error checking.
10 * Revision 1.3 1995/03/01 08:40:56 quinn
13 * Revision 1.2 1995/02/14 20:39:55 quinn
14 * Fixed bugs in completeBER and (serious one in) ber_oid.
16 * Revision 1.1 1995/02/03 17:04:36 quinn
23 int ber_oidc(ODR o, Odr_oid *p)
28 unsigned char octs[8];
33 if ((res = ber_declen(o->bp, &len)) < 1)
53 p[1] = *o->bp - p[0] * 40;
69 p[pos] |= *o->bp & 0X7F;
73 while (*(o->bp++) & 0X80);
79 /* we'll allow ourselves the quiet luxury of only doing encodings
84 if (p[0] < 0 && p[1] <= 0)
89 p[1] = p[0] * 40 + p[1];
90 for (pos = 1; p[pos] >= 0; pos++)
96 octs[n++] = id & 0X7F;
107 *(o->bp++) = octs[n] | ((n > 0) << 7);
109 if (ber_enclen(lenp, (o->bp - lenp) - 1, 1, 1) != 1)
115 default: o->error = OOTHER; return 0;