69 #ifndef OPENSSL_NO_OBJECT
77 static const unsigned char lvalues[1];
79 static const unsigned int sn_objs[1];
80 static const unsigned int ln_objs[1];
81 static const unsigned int obj_objs[1];
103 static int sn_cmp(
const ASN1_OBJECT *
const *
a,
const unsigned int *
b)
104 {
return(strcmp((*a)->sn,nid_objs[*b].
sn)); }
108 static int ln_cmp(
const ASN1_OBJECT *
const *a,
const unsigned int *b)
109 {
return(strcmp((*a)->ln,nid_objs[*b].
ln)); }
113 static unsigned long added_obj_hash(
const ADDED_OBJ *ca)
125 p=(
unsigned char *)a->
data;
126 for (i=0; i<a->
length; i++)
127 ret^=p[i]<<((i*3)%24);
164 if (a->
sn == NULL)
return(-1);
165 else if (b->
sn == NULL)
return(1);
166 else return(strcmp(a->
sn,b->
sn));
168 if (a->
ln == NULL)
return(-1);
169 else if (b->
ln == NULL)
return(1);
170 else return(strcmp(a->
ln,b->
ln));
180 static
int init_added(
void)
182 if (added != NULL)
return(1);
184 return(added != NULL);
214 int obj_cleanup_defer = 0;
218 if (!obj_cleanup_defer && nid >=
NUM_NID)
219 obj_cleanup_defer = 1;
224 if (obj_cleanup_defer)
226 obj_cleanup_defer = 2;
229 if (added == NULL)
return;
250 ADDED_OBJ *ao[4]={NULL,NULL,NULL,NULL},*aop;
254 if (!init_added())
return(0);
255 if ((o=
OBJ_dup(obj)) == NULL)
goto err;
303 else if (added == NULL)
333 return(nid_objs[n].sn);
335 else if (added == NULL)
344 return(adp->
obj->
sn);
365 return(nid_objs[n].ln);
367 else if (added == NULL)
376 return(adp->
obj->
ln);
385 static int obj_cmp(
const ASN1_OBJECT *
const *ap,
const unsigned int *
bp)
400 const unsigned int *op;
413 if (adp != NULL)
return (adp->
obj->
nid);
415 op=OBJ_bsearch_obj(&a, obj_objs,
NUM_OBJ);
418 return(nid_objs[*op].nid);
433 const unsigned char *cp;
468 int i,n=0,
len,
nid, first, use_bn;
471 const unsigned char *
p;
474 if ((a == NULL) || (a->
data == NULL)) {
508 unsigned char c = *p++;
510 if ((
len == 0) && (c & 0x80))
521 if (!use_bn && (l > (ULONG_MAX >> 7L)))
523 if (!bl && !(bl =
BN_new()))
557 if (buf && (buf_len > 0))
599 if (buf && (buf_len > 0))
643 const unsigned int *op;
651 if (adp != NULL)
return (adp->
obj->
nid);
653 op=OBJ_bsearch_ln(&oo, ln_objs,
NUM_LN);
655 return(nid_objs[*op].nid);
663 const unsigned int *op;
671 if (adp != NULL)
return (adp->
obj->
nid);
673 op=OBJ_bsearch_sn(&oo, sn_objs,
NUM_SN);
675 return(nid_objs[*op].nid);
679 int (*cmp)(
const void *,
const void *))
686 int (*cmp)(
const void *,
const void *),
689 const char *base=base_;
691 const char *p = NULL;
693 if (num == 0)
return(NULL);
708 #ifdef CHARSET_EBCDIC
715 for (i=0; i<
num; ++i)
728 while(i > 0 && (*cmp)(
key,&(base[(i-1)*size])) == 0)
745 if (i <= 0)
return(num);
747 if (!isalnum((
unsigned char)buf[0]))
return(num);
749 while (isdigit((
unsigned char)*s) || (*s ==
'.'))
754 while (isspace((
unsigned char)*s))
761 while ((*l !=
'\0') && !isspace((
unsigned char)*l))
766 while (isspace((
unsigned char)*l))
768 if (*l ==
'\0') l=NULL;
776 if ((o == NULL) || (*o ==
'\0'))
return(num);
783 int OBJ_create(
const char *oid,
const char *sn,
const char *ln)
791 if (i <= 0)
return(0);