summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/objects
diff options
context:
space:
mode:
authorryker <>1998-10-05 20:13:14 +0000
committerryker <>1998-10-05 20:13:14 +0000
commitaeeae06a79815dc190061534d47236cec09f9e32 (patch)
tree851692b9c2f9c04f077666855641900f19fdb217 /src/lib/libcrypto/objects
parenta4f79641824cbf9f60ca9d1168d1fcc46717a82a (diff)
downloadopenbsd-aeeae06a79815dc190061534d47236cec09f9e32.tar.gz
openbsd-aeeae06a79815dc190061534d47236cec09f9e32.tar.bz2
openbsd-aeeae06a79815dc190061534d47236cec09f9e32.zip
Import of SSLeay-0.9.0b with RSA and IDEA stubbed + OpenBSD build
functionality for shared libs. Note that routines such as sslv2_init and friends that use RSA will not work due to lack of RSA in this library. Needs documentation and help from ports for easy upgrade to full functionality where legally possible.
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/objects/obj_dat.c578
-rw-r--r--src/lib/libcrypto/objects/obj_dat.pl269
-rw-r--r--src/lib/libcrypto/objects/obj_err.c96
-rw-r--r--src/lib/libcrypto/objects/obj_lib.c126
-rw-r--r--src/lib/libcrypto/objects/objects.h724
-rw-r--r--src/lib/libcrypto/objects/objects.txt40
6 files changed, 1833 insertions, 0 deletions
diff --git a/src/lib/libcrypto/objects/obj_dat.c b/src/lib/libcrypto/objects/obj_dat.c
new file mode 100644
index 0000000000..34866ebbd2
--- /dev/null
+++ b/src/lib/libcrypto/objects/obj_dat.c
@@ -0,0 +1,578 @@
1/* crypto/objects/obj_dat.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include <ctype.h>
61#include "cryptlib.h"
62#include "lhash.h"
63#include "asn1.h"
64#include "objects.h"
65
66/* obj_dat.h is generated from objects.h by obj_dat.pl */
67#include "obj_dat.h"
68
69#ifndef NOPROTO
70static int sn_cmp(ASN1_OBJECT **a, ASN1_OBJECT **b);
71static int ln_cmp(ASN1_OBJECT **a, ASN1_OBJECT **b);
72static int obj_cmp(ASN1_OBJECT **a, ASN1_OBJECT **b);
73#else
74static int sn_cmp();
75static int ln_cmp();
76static int obj_cmp();
77#endif
78
79#define ADDED_DATA 0
80#define ADDED_SNAME 1
81#define ADDED_LNAME 2
82#define ADDED_NID 3
83
84typedef struct added_obj_st
85 {
86 int type;
87 ASN1_OBJECT *obj;
88 } ADDED_OBJ;
89
90static int new_nid=NUM_NID;
91static LHASH *added=NULL;
92
93static int sn_cmp(ap,bp)
94ASN1_OBJECT **ap;
95ASN1_OBJECT **bp;
96 { return(strcmp((*ap)->sn,(*bp)->sn)); }
97
98static int ln_cmp(ap,bp)
99ASN1_OBJECT **ap;
100ASN1_OBJECT **bp;
101 { return(strcmp((*ap)->ln,(*bp)->ln)); }
102
103static unsigned long add_hash(ca)
104ADDED_OBJ *ca;
105 {
106 ASN1_OBJECT *a;
107 int i;
108 unsigned long ret=0;
109 unsigned char *p;
110
111 a=ca->obj;
112 switch (ca->type)
113 {
114 case ADDED_DATA:
115 ret=a->length<<20L;
116 p=(unsigned char *)a->data;
117 for (i=0; i<a->length; i++)
118 ret^=p[i]<<((i*3)%24);
119 break;
120 case ADDED_SNAME:
121 ret=lh_strhash(a->sn);
122 break;
123 case ADDED_LNAME:
124 ret=lh_strhash(a->ln);
125 break;
126 case ADDED_NID:
127 ret=a->nid;
128 break;
129 default:
130 abort();
131 }
132 ret&=0x3fffffffL;
133 ret|=ca->type<<30L;
134 return(ret);
135 }
136
137static int add_cmp(ca,cb)
138ADDED_OBJ *ca,*cb;
139 {
140 ASN1_OBJECT *a,*b;
141 int i;
142
143 i=ca->type-cb->type;
144 if (i) return(i);
145 a=ca->obj;
146 b=cb->obj;
147 switch (ca->type)
148 {
149 case ADDED_DATA:
150 i=(a->length - b->length);
151 if (i) return(i);
152 return(memcmp(a->data,b->data,a->length));
153 case ADDED_SNAME:
154 if (a->sn == NULL) return(-1);
155 else if (b->sn == NULL) return(1);
156 else return(strcmp(a->sn,b->sn));
157 case ADDED_LNAME:
158 if (a->ln == NULL) return(-1);
159 else if (b->ln == NULL) return(1);
160 else return(strcmp(a->ln,b->ln));
161 case ADDED_NID:
162 return(a->nid-b->nid);
163 default:
164 abort();
165 }
166 }
167
168static int init_added()
169 {
170 if (added != NULL) return(1);
171 added=lh_new(add_hash,add_cmp);
172 return(added != NULL);
173 }
174
175static void cleanup1(a)
176ADDED_OBJ *a;
177 {
178 a->obj->nid=0;
179 a->obj->flags|=ASN1_OBJECT_FLAG_DYNAMIC|
180 ASN1_OBJECT_FLAG_DYNAMIC_STRINGS;
181 }
182
183static void cleanup2(a)
184ADDED_OBJ *a;
185 { a->obj->nid++; }
186
187static void cleanup3(a)
188ADDED_OBJ *a;
189 {
190 if (--a->obj->nid == 0)
191 ASN1_OBJECT_free(a->obj);
192 Free(a);
193 }
194
195void OBJ_cleanup()
196 {
197 if (added == NULL) return;
198 added->down_load=0;
199 lh_doall(added,cleanup1); /* zero counters */
200 lh_doall(added,cleanup2); /* set counters */
201 lh_doall(added,cleanup3); /* free objects */
202 lh_free(added);
203 added=NULL;
204 }
205
206int OBJ_new_nid(num)
207int num;
208 {
209 int i;
210
211 i=new_nid;
212 new_nid+=num;
213 return(i);
214 }
215
216int OBJ_add_object(obj)
217ASN1_OBJECT *obj;
218 {
219 ASN1_OBJECT *o;
220 ADDED_OBJ *ao[4],*aop;
221 int i;
222
223 if (added == NULL)
224 if (!init_added()) return(0);
225 if ((o=OBJ_dup(obj)) == NULL) goto err;
226 ao[ADDED_DATA]=NULL;
227 ao[ADDED_SNAME]=NULL;
228 ao[ADDED_LNAME]=NULL;
229 ao[ADDED_NID]=NULL;
230 ao[ADDED_NID]=(ADDED_OBJ *)Malloc(sizeof(ADDED_OBJ));
231 if ((o->length != 0) && (obj->data != NULL))
232 ao[ADDED_DATA]=(ADDED_OBJ *)Malloc(sizeof(ADDED_OBJ));
233 if (o->sn != NULL)
234 ao[ADDED_SNAME]=(ADDED_OBJ *)Malloc(sizeof(ADDED_OBJ));
235 if (o->ln != NULL)
236 ao[ADDED_LNAME]=(ADDED_OBJ *)Malloc(sizeof(ADDED_OBJ));
237
238 for (i=ADDED_DATA; i<=ADDED_NID; i++)
239 {
240 if (ao[i] != NULL)
241 {
242 ao[i]->type=i;
243 ao[i]->obj=o;
244 aop=(ADDED_OBJ *)lh_insert(added,(char *)ao[i]);
245 /* memory leak, buit should not normally matter */
246 if (aop != NULL)
247 Free(aop);
248 }
249 }
250 o->flags&= ~(ASN1_OBJECT_FLAG_DYNAMIC|ASN1_OBJECT_FLAG_DYNAMIC_STRINGS);
251 return(o->nid);
252err:
253 for (i=ADDED_DATA; i<=ADDED_NID; i++)
254 if (ao[i] != NULL) Free(ao[i]);
255 if (o != NULL) Free(o);
256 return(NID_undef);
257 }
258
259ASN1_OBJECT *OBJ_nid2obj(n)
260int n;
261 {
262 ADDED_OBJ ad,*adp;
263 ASN1_OBJECT ob;
264
265 if ((n >= 0) && (n < NUM_NID))
266 {
267 if ((n != NID_undef) && (nid_objs[n].nid == NID_undef))
268 {
269 OBJerr(OBJ_F_OBJ_NID2OBJ,OBJ_R_UNKNOWN_NID);
270 return(NULL);
271 }
272 return((ASN1_OBJECT *)&(nid_objs[n]));
273 }
274 else if (added == NULL)
275 return(NULL);
276 else
277 {
278 ad.type=ADDED_NID;
279 ad.obj= &ob;
280 ob.nid=n;
281 adp=(ADDED_OBJ *)lh_retrieve(added,(char *)&ad);
282 if (adp != NULL)
283 return(adp->obj);
284 else
285 {
286 OBJerr(OBJ_F_OBJ_NID2OBJ,OBJ_R_UNKNOWN_NID);
287 return(NULL);
288 }
289 }
290 }
291
292char *OBJ_nid2sn(n)
293int n;
294 {
295 ADDED_OBJ ad,*adp;
296 ASN1_OBJECT ob;
297
298 if ((n >= 0) && (n < NUM_NID))
299 {
300 if ((n != NID_undef) && (nid_objs[n].nid == NID_undef))
301 {
302 OBJerr(OBJ_F_OBJ_NID2SN,OBJ_R_UNKNOWN_NID);
303 return(NULL);
304 }
305 return(nid_objs[n].sn);
306 }
307 else if (added == NULL)
308 return(NULL);
309 else
310 {
311 ad.type=ADDED_NID;
312 ad.obj= &ob;
313 ob.nid=n;
314 adp=(ADDED_OBJ *)lh_retrieve(added,(char *)&ad);
315 if (adp != NULL)
316 return(adp->obj->sn);
317 else
318 {
319 OBJerr(OBJ_F_OBJ_NID2SN,OBJ_R_UNKNOWN_NID);
320 return(NULL);
321 }
322 }
323 }
324
325char *OBJ_nid2ln(n)
326int n;
327 {
328 ADDED_OBJ ad,*adp;
329 ASN1_OBJECT ob;
330
331 if ((n >= 0) && (n < NUM_NID))
332 {
333 if ((n != NID_undef) && (nid_objs[n].nid == NID_undef))
334 {
335 OBJerr(OBJ_F_OBJ_NID2LN,OBJ_R_UNKNOWN_NID);
336 return(NULL);
337 }
338 return(nid_objs[n].ln);
339 }
340 else if (added == NULL)
341 return(NULL);
342 else
343 {
344 ad.type=ADDED_NID;
345 ad.obj= &ob;
346 ob.nid=n;
347 adp=(ADDED_OBJ *)lh_retrieve(added,(char *)&ad);
348 if (adp != NULL)
349 return(adp->obj->ln);
350 else
351 {
352 OBJerr(OBJ_F_OBJ_NID2LN,OBJ_R_UNKNOWN_NID);
353 return(NULL);
354 }
355 }
356 }
357
358int OBJ_obj2nid(a)
359ASN1_OBJECT *a;
360 {
361 ASN1_OBJECT **op;
362 ADDED_OBJ ad,*adp;
363
364 if (a == NULL)
365 return(NID_undef);
366 if (a->nid != 0)
367 return(a->nid);
368
369 if (added != NULL)
370 {
371 ad.type=ADDED_DATA;
372 ad.obj=a;
373 adp=(ADDED_OBJ *)lh_retrieve(added,(char *)&ad);
374 if (adp != NULL) return (adp->obj->nid);
375 }
376 op=(ASN1_OBJECT **)OBJ_bsearch((char *)&a,(char *)obj_objs,NUM_OBJ,
377 sizeof(ASN1_OBJECT *),(int (*)())obj_cmp);
378 if (op == NULL)
379 return(NID_undef);
380 return((*op)->nid);
381 }
382
383int OBJ_txt2nid(s)
384char *s;
385 {
386 int ret;
387
388 ret=OBJ_sn2nid(s);
389 if (ret == NID_undef)
390 {
391 ret=OBJ_ln2nid(s);
392 if (ret == NID_undef)
393 {
394 ASN1_OBJECT *op=NULL;
395 unsigned char *buf,*p;
396 int i;
397
398 i=a2d_ASN1_OBJECT(NULL,0,s,-1);
399 if (i <= 0)
400 {
401 /* clear the error */
402 ERR_get_error();
403 return(0);
404 }
405
406 if ((buf=(unsigned char *)Malloc(i)) == NULL)
407 return(NID_undef);
408 a2d_ASN1_OBJECT(buf,i,s,-1);
409 p=buf;
410 op=d2i_ASN1_OBJECT(NULL,&p,i);
411 if (op == NULL) return(NID_undef);
412 ret=OBJ_obj2nid(op);
413 ASN1_OBJECT_free(op);
414 Free(buf);
415 }
416 }
417 return(ret);
418 }
419
420int OBJ_ln2nid(s)
421char *s;
422 {
423 ASN1_OBJECT o,*oo= &o,**op;
424 ADDED_OBJ ad,*adp;
425
426 o.ln=s;
427 if (added != NULL)
428 {
429 ad.type=ADDED_LNAME;
430 ad.obj= &o;
431 adp=(ADDED_OBJ *)lh_retrieve(added,(char *)&ad);
432 if (adp != NULL) return (adp->obj->nid);
433 }
434 op=(ASN1_OBJECT **)OBJ_bsearch((char *)&oo,(char *)ln_objs,NUM_LN,
435 sizeof(ASN1_OBJECT *),(int (*)())ln_cmp);
436 if (op == NULL) return(NID_undef);
437 return((*op)->nid);
438 }
439
440int OBJ_sn2nid(s)
441char *s;
442 {
443 ASN1_OBJECT o,*oo= &o,**op;
444 ADDED_OBJ ad,*adp;
445
446 o.sn=s;
447 if (added != NULL)
448 {
449 ad.type=ADDED_SNAME;
450 ad.obj= &o;
451 adp=(ADDED_OBJ *)lh_retrieve(added,(char *)&ad);
452 if (adp != NULL) return (adp->obj->nid);
453 }
454 op=(ASN1_OBJECT **)OBJ_bsearch((char *)&oo,(char *)sn_objs,NUM_SN,
455 sizeof(ASN1_OBJECT *),(int (*)())sn_cmp);
456 if (op == NULL) return(NID_undef);
457 return((*op)->nid);
458 }
459
460static int obj_cmp(ap, bp)
461ASN1_OBJECT **ap;
462ASN1_OBJECT **bp;
463 {
464 int j;
465 ASN1_OBJECT *a= *ap;
466 ASN1_OBJECT *b= *bp;
467
468 j=(a->length - b->length);
469 if (j) return(j);
470 return(memcmp(a->data,b->data,a->length));
471 }
472
473char *OBJ_bsearch(key,base,num,size,cmp)
474char *key;
475char *base;
476int num;
477int size;
478int (*cmp)();
479 {
480 int l,h,i,c;
481 char *p;
482
483 if (num == 0) return(NULL);
484 l=0;
485 h=num;
486 while (l < h)
487 {
488 i=(l+h)/2;
489 p= &(base[i*size]);
490 c=(*cmp)(key,p);
491 if (c < 0)
492 h=i;
493 else if (c > 0)
494 l=i+1;
495 else
496 return(p);
497 }
498 return(NULL);
499 }
500
501int OBJ_create_objects(in)
502BIO *in;
503 {
504 MS_STATIC char buf[512];
505 int i,num= -1;
506 char *o,*s,*l=NULL;
507
508 for (;;)
509 {
510 s=o=NULL;
511 i=BIO_gets(in,buf,512);
512 if (i <= 0) return(num);
513 buf[i-1]='\0';
514 if (!isalnum(buf[0])) return(num);
515 o=s=buf;
516 while (isdigit(*s) || (*s == '.'))
517 s++;
518 if (*s != '\0')
519 {
520 *(s++)='\0';
521 while (isspace(*s))
522 s++;
523 if (*s == '\0')
524 s=NULL;
525 else
526 {
527 l=s;
528 while ((*l != '\0') && !isspace(*l))
529 l++;
530 if (*l != '\0')
531 {
532 *(l++)='\0';
533 while (isspace(*l))
534 l++;
535 if (*l == '\0') l=NULL;
536 }
537 else
538 l=NULL;
539 }
540 }
541 else
542 s=NULL;
543 if ((o == NULL) || (*o == '\0')) return(num);
544 if (!OBJ_create(o,s,l)) return(num);
545 num++;
546 }
547 return(num);
548 }
549
550int OBJ_create(oid,sn,ln)
551char *oid;
552char *sn;
553char *ln;
554 {
555 int ok=0;
556 ASN1_OBJECT *op=NULL;
557 unsigned char *buf;
558 int i;
559
560 i=a2d_ASN1_OBJECT(NULL,0,oid,-1);
561 if (i <= 0) return(0);
562
563 if ((buf=(unsigned char *)Malloc(i)) == NULL)
564 {
565 OBJerr(OBJ_F_OBJ_CREATE,OBJ_R_MALLOC_FAILURE);
566 return(0);
567 }
568 i=a2d_ASN1_OBJECT(buf,i,oid,-1);
569 op=(ASN1_OBJECT *)ASN1_OBJECT_create(OBJ_new_nid(1),buf,i,sn,ln);
570 if (op == NULL)
571 goto err;
572 ok=OBJ_add_object(op);
573err:
574 ASN1_OBJECT_free(op);
575 Free((char *)buf);
576 return(ok);
577 }
578
diff --git a/src/lib/libcrypto/objects/obj_dat.pl b/src/lib/libcrypto/objects/obj_dat.pl
new file mode 100644
index 0000000000..4e7879d3f3
--- /dev/null
+++ b/src/lib/libcrypto/objects/obj_dat.pl
@@ -0,0 +1,269 @@
1#!/usr/bin/perl
2
3sub obj_cmp
4 {
5 local(@a,@b,$_,$r);
6
7 $A=$obj_len{$obj{$nid{$a}}};
8 $B=$obj_len{$obj{$nid{$b}}};
9
10 $r=($A-$B);
11 return($r) if $r != 0;
12
13 $A=$obj_der{$obj{$nid{$a}}};
14 $B=$obj_der{$obj{$nid{$b}}};
15
16 return($A cmp $B);
17 }
18
19sub expand_obj
20 {
21 local(*v)=@_;
22 local($k,$d);
23 local($i);
24
25 do {
26 $i=0;
27 foreach $k (keys %v)
28 {
29 if (($v{$k} =~ s/(OBJ_[^,]+),/$v{$1},/))
30 { $i++; }
31 }
32 } while($i);
33 foreach $k (keys %v)
34 {
35 @a=split(/,/,$v{$k});
36 $objn{$k}=$#a+1;
37 }
38 return(%objn);
39 }
40
41while (<>)
42 {
43 next unless /^\#define\s+(\S+)\s+(.*)$/;
44 $v=$1;
45 $d=$2;
46 if ($v =~ /^SN_(.*)$/)
47 { $sn{$1}=$d; }
48 elsif ($v =~ /^LN_(.*)$/)
49 { $ln{$1}=$d; }
50 elsif ($v =~ /^NID_(.*)$/)
51 { $nid{$d}=$1; }
52 elsif ($v =~ /^OBJ_(.*)$/)
53 {
54 $obj{$1}=$v;
55 $objd{$v}=$d;
56 }
57 }
58
59%ob=&expand_obj(*objd);
60
61@a=sort { $a <=> $b } keys %nid;
62$n=$a[$#a]+1;
63
64@lvalues=();
65$lvalues=0;
66
67for ($i=0; $i<$n; $i++)
68 {
69 if (!defined($nid{$i}))
70 {
71 push(@out,"{NULL,NULL,NID_undef,0,NULL},\n");
72 }
73 else
74 {
75 $sn=defined($sn{$nid{$i}})?"$sn{$nid{$i}}":"NULL";
76 $ln=defined($ln{$nid{$i}})?"$ln{$nid{$i}}":"NULL";
77 $sn=$ln if ($sn eq "NULL");
78 $ln=$sn if ($ln eq "NULL");
79 $out ="{";
80 $out.=$sn;
81 $out.=",".$ln;
82 $out.=",NID_$nid{$i},";
83 if (defined($obj{$nid{$i}}))
84 {
85 $v=$objd{$obj{$nid{$i}}};
86 $v =~ s/L//g;
87 $v =~ s/,/ /g;
88 $r=&der_it($v);
89 $z="";
90 $length=0;
91 foreach (unpack("C*",$r))
92 {
93 $z.=sprintf("0x%02X,",$_);
94 $length++;
95 }
96 $obj_der{$obj{$nid{$i}}}=$z;
97 $obj_len{$obj{$nid{$i}}}=$length;
98
99 push(@lvalues,sprintf("%-45s/* [%3d] %s */\n",
100 $z,$lvalues,$obj{$nid{$i}}));
101 $out.="$length,&(lvalues[$lvalues]),0";
102 $lvalues+=$length;
103 }
104 else
105 {
106 $out.="0,NULL";
107 }
108 $out.="},\n";
109 push(@out,$out);
110 }
111 }
112
113@a=grep(defined($sn{$nid{$_}}),0 .. $n);
114foreach (sort { $sn{$nid{$a}} cmp $sn{$nid{$b}} } @a)
115 {
116 push(@sn,sprintf("&(nid_objs[%2d]),/* $sn{$nid{$_}} */\n",$_));
117 }
118
119@a=grep(defined($ln{$nid{$_}}),0 .. $n);
120foreach (sort { $ln{$nid{$a}} cmp $ln{$nid{$b}} } @a)
121 {
122 push(@ln,sprintf("&(nid_objs[%2d]),/* $ln{$nid{$_}} */\n",$_));
123 }
124
125@a=grep(defined($obj{$nid{$_}}),0 .. $n);
126foreach (sort obj_cmp @a)
127 {
128 $m=$obj{$nid{$_}};
129 $v=$objd{$m};
130 $v =~ s/L//g;
131 $v =~ s/,/ /g;
132 push(@ob,sprintf("&(nid_objs[%2d]),/* %-32s %s */\n",$_,$m,$v));
133 }
134
135print <<'EOF';
136/* lib/obj/obj_dat.h */
137/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
138 * All rights reserved.
139 *
140 * This package is an SSL implementation written
141 * by Eric Young (eay@cryptsoft.com).
142 * The implementation was written so as to conform with Netscapes SSL.
143 *
144 * This library is free for commercial and non-commercial use as long as
145 * the following conditions are aheared to. The following conditions
146 * apply to all code found in this distribution, be it the RC4, RSA,
147 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
148 * included with this distribution is covered by the same copyright terms
149 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
150 *
151 * Copyright remains Eric Young's, and as such any Copyright notices in
152 * the code are not to be removed.
153 * If this package is used in a product, Eric Young should be given attribution
154 * as the author of the parts of the library used.
155 * This can be in the form of a textual message at program startup or
156 * in documentation (online or textual) provided with the package.
157 *
158 * Redistribution and use in source and binary forms, with or without
159 * modification, are permitted provided that the following conditions
160 * are met:
161 * 1. Redistributions of source code must retain the copyright
162 * notice, this list of conditions and the following disclaimer.
163 * 2. Redistributions in binary form must reproduce the above copyright
164 * notice, this list of conditions and the following disclaimer in the
165 * documentation and/or other materials provided with the distribution.
166 * 3. All advertising materials mentioning features or use of this software
167 * must display the following acknowledgement:
168 * "This product includes cryptographic software written by
169 * Eric Young (eay@cryptsoft.com)"
170 * The word 'cryptographic' can be left out if the rouines from the library
171 * being used are not cryptographic related :-).
172 * 4. If you include any Windows specific code (or a derivative thereof) from
173 * the apps directory (application code) you must include an acknowledgement:
174 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
175 *
176 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
177 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
178 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
179 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
180 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
181 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
182 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
183 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
184 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
185 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
186 * SUCH DAMAGE.
187 *
188 * The licence and distribution terms for any publically available version or
189 * derivative of this code cannot be changed. i.e. this code cannot simply be
190 * copied and put under another distribution licence
191 * [including the GNU Public Licence.]
192 */
193
194/* THIS FILE IS GENERATED FROM Objects.h by obj_dat.pl via the
195 * following command:
196 * perl obj_dat.pl < objects.h > obj_dat.h
197 */
198
199EOF
200
201printf "#define NUM_NID %d\n",$n;
202printf "#define NUM_SN %d\n",$#sn+1;
203printf "#define NUM_LN %d\n",$#ln+1;
204printf "#define NUM_OBJ %d\n\n",$#ob+1;
205
206printf "static unsigned char lvalues[%d]={\n",$lvalues+1;
207print @lvalues;
208print "};\n\n";
209
210printf "static ASN1_OBJECT nid_objs[NUM_NID]={\n";
211foreach (@out)
212 {
213 if (length($_) > 75)
214 {
215 $out="";
216 foreach (split(/,/))
217 {
218 $t=$out.$_.",";
219 if (length($t) > 70)
220 {
221 print "$out\n";
222 $t="\t$_,";
223 }
224 $out=$t;
225 }
226 chop $out;
227 print "$out";
228 }
229 else
230 { print $_; }
231 }
232print "};\n\n";
233
234printf "static ASN1_OBJECT *sn_objs[NUM_SN]={\n";
235print @sn;
236print "};\n\n";
237
238printf "static ASN1_OBJECT *ln_objs[NUM_LN]={\n";
239print @ln;
240print "};\n\n";
241
242printf "static ASN1_OBJECT *obj_objs[NUM_OBJ]={\n";
243print @ob;
244print "};\n\n";
245
246sub der_it
247 {
248 local($v)=@_;
249 local(@a,$i,$ret,@r);
250
251 @a=split(/\s+/,$v);
252 $ret.=pack("C*",$a[0]*40+$a[1]);
253 shift @a;
254 shift @a;
255 while ($_=shift(@a))
256 {
257 @r=();
258 $t=0;
259 while ($_ >= 128)
260 {
261 $x=$_%128;
262 $_/=128;
263 push(@r,((($t++)?0x80:0)|$x));
264 }
265 push(@r,((($t++)?0x80:0)|$_));
266 $ret.=pack("C*",reverse(@r));
267 }
268 return($ret);
269 }
diff --git a/src/lib/libcrypto/objects/obj_err.c b/src/lib/libcrypto/objects/obj_err.c
new file mode 100644
index 0000000000..45206c616c
--- /dev/null
+++ b/src/lib/libcrypto/objects/obj_err.c
@@ -0,0 +1,96 @@
1/* lib/obj/obj_err.c */
2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58#include <stdio.h>
59#include "err.h"
60#include "objects.h"
61
62/* BEGIN ERROR CODES */
63#ifndef NO_ERR
64static ERR_STRING_DATA OBJ_str_functs[]=
65 {
66{ERR_PACK(0,OBJ_F_OBJ_CREATE,0), "OBJ_create"},
67{ERR_PACK(0,OBJ_F_OBJ_DUP,0), "OBJ_dup"},
68{ERR_PACK(0,OBJ_F_OBJ_NID2LN,0), "OBJ_nid2ln"},
69{ERR_PACK(0,OBJ_F_OBJ_NID2OBJ,0), "OBJ_nid2obj"},
70{ERR_PACK(0,OBJ_F_OBJ_NID2SN,0), "OBJ_nid2sn"},
71{0,NULL},
72 };
73
74static ERR_STRING_DATA OBJ_str_reasons[]=
75 {
76{OBJ_R_MALLOC_FAILURE ,"malloc failure"},
77{OBJ_R_UNKNOWN_NID ,"unknown nid"},
78{0,NULL},
79 };
80
81#endif
82
83void ERR_load_OBJ_strings()
84 {
85 static int init=1;
86
87 if (init);
88 {;
89 init=0;
90#ifndef NO_ERR
91 ERR_load_strings(ERR_LIB_OBJ,OBJ_str_functs);
92 ERR_load_strings(ERR_LIB_OBJ,OBJ_str_reasons);
93#endif
94
95 }
96 }
diff --git a/src/lib/libcrypto/objects/obj_lib.c b/src/lib/libcrypto/objects/obj_lib.c
new file mode 100644
index 0000000000..0a9c756197
--- /dev/null
+++ b/src/lib/libcrypto/objects/obj_lib.c
@@ -0,0 +1,126 @@
1/* crypto/objects/obj_lib.c */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#include <stdio.h>
60#include "cryptlib.h"
61#include "lhash.h"
62#include "objects.h"
63#include "buffer.h"
64
65ASN1_OBJECT *OBJ_dup(o)
66ASN1_OBJECT *o;
67 {
68 ASN1_OBJECT *r;
69 int i;
70
71 if (o == NULL) return(NULL);
72 if (!(o->flags & ASN1_OBJECT_FLAG_DYNAMIC))
73 return(o);
74
75 r=(ASN1_OBJECT *)ASN1_OBJECT_new();
76 if (r == NULL)
77 {
78 OBJerr(OBJ_F_OBJ_DUP,ERR_R_ASN1_LIB);
79 return(NULL);
80 }
81 r->data=(unsigned char *)Malloc(o->length);
82 if (r->data == NULL)
83 goto err;
84 memcpy(r->data,o->data,o->length);
85 r->length=o->length;
86 r->nid=o->nid;
87 r->ln=r->sn=NULL;
88 if (o->ln != NULL)
89 {
90 i=strlen(o->ln)+1;
91 r->ln=(char *)Malloc(i);
92 if (r->ln == NULL) goto err;
93 memcpy(r->ln,o->ln,i);
94 }
95
96 if (o->sn != NULL)
97 {
98 i=strlen(o->sn)+1;
99 r->sn=(char *)Malloc(i);
100 if (r->sn == NULL) goto err;
101 memcpy(r->sn,o->sn,i);
102 }
103 r->flags=o->flags|(ASN1_OBJECT_FLAG_DYNAMIC|
104 ASN1_OBJECT_FLAG_DYNAMIC_STRINGS);
105 return(r);
106err:
107 OBJerr(OBJ_F_OBJ_DUP,ERR_R_MALLOC_FAILURE);
108 if (r != NULL)
109 {
110 if (r->ln != NULL) Free(r->ln);
111 if (r->data != NULL) Free(r->data);
112 Free(r);
113 }
114 return(NULL);
115 }
116
117int OBJ_cmp(a,b)
118ASN1_OBJECT *a;
119ASN1_OBJECT *b;
120 {
121 int ret;
122
123 ret=(a->length-b->length);
124 if (ret) return(ret);
125 return(memcmp(a->data,b->data,a->length));
126 }
diff --git a/src/lib/libcrypto/objects/objects.h b/src/lib/libcrypto/objects/objects.h
new file mode 100644
index 0000000000..e1d555b47c
--- /dev/null
+++ b/src/lib/libcrypto/objects/objects.h
@@ -0,0 +1,724 @@
1/* crypto/objects/objects.h */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59#ifndef HEADER_OBJECTS_H
60#define HEADER_OBJECTS_H
61
62#ifdef __cplusplus
63extern "C" {
64#endif
65
66#define SN_undef "UNDEF"
67#define LN_undef "undefined"
68#define NID_undef 0
69
70#define SN_Algorithm "Algorithm"
71#define LN_algorithm "algorithm"
72#define NID_algorithm 38
73#define OBJ_algorithm 1L,3L,14L,3L,2L
74
75#define LN_rsadsi "rsadsi"
76#define NID_rsadsi 1
77#define OBJ_rsadsi 1L,2L,840L,113549L
78
79#define LN_pkcs "pkcs"
80#define NID_pkcs 2
81#define OBJ_pkcs OBJ_rsadsi,1L
82
83#define SN_md2 "MD2"
84#define LN_md2 "md2"
85#define NID_md2 3
86#define OBJ_md2 OBJ_rsadsi,2L,2L
87
88#define SN_md5 "MD5"
89#define LN_md5 "md5"
90#define NID_md5 4
91#define OBJ_md5 OBJ_rsadsi,2L,5L
92
93#define SN_rc4 "RC4"
94#define LN_rc4 "rc4"
95#define NID_rc4 5
96#define OBJ_rc4 OBJ_rsadsi,3L,4L
97
98#define LN_rsaEncryption "rsaEncryption"
99#define NID_rsaEncryption 6
100#define OBJ_rsaEncryption OBJ_pkcs,1L,1L
101
102#define SN_md2WithRSAEncryption "RSA-MD2"
103#define LN_md2WithRSAEncryption "md2WithRSAEncryption"
104#define NID_md2WithRSAEncryption 7
105#define OBJ_md2WithRSAEncryption OBJ_pkcs,1L,2L
106
107#define SN_md5WithRSAEncryption "RSA-MD5"
108#define LN_md5WithRSAEncryption "md5WithRSAEncryption"
109#define NID_md5WithRSAEncryption 8
110#define OBJ_md5WithRSAEncryption OBJ_pkcs,1L,4L
111
112#define LN_pbeWithMD2AndDES_CBC "pbeWithMD2AndDES-CBC"
113#define NID_pbeWithMD2AndDES_CBC 9
114#define OBJ_pbeWithMD2AndDES_CBC OBJ_pkcs,5L,1L
115
116#define LN_pbeWithMD5AndDES_CBC "pbeWithMD5AndDES-CBC"
117#define NID_pbeWithMD5AndDES_CBC 10
118#define OBJ_pbeWithMD5AndDES_CBC OBJ_pkcs,5L,3L
119
120#define LN_X500 "X500"
121#define NID_X500 11
122#define OBJ_X500 2L,5L
123
124#define LN_X509 "X509"
125#define NID_X509 12
126#define OBJ_X509 OBJ_X500,4L
127
128#define SN_commonName "CN"
129#define LN_commonName "commonName"
130#define NID_commonName 13
131#define OBJ_commonName OBJ_X509,3L
132
133#define SN_countryName "C"
134#define LN_countryName "countryName"
135#define NID_countryName 14
136#define OBJ_countryName OBJ_X509,6L
137
138#define SN_localityName "L"
139#define LN_localityName "localityName"
140#define NID_localityName 15
141#define OBJ_localityName OBJ_X509,7L
142
143/* Postal Address? PA */
144
145/* should be "ST" (rfc1327) but MS uses 'S' */
146#define SN_stateOrProvinceName "ST"
147#define LN_stateOrProvinceName "stateOrProvinceName"
148#define NID_stateOrProvinceName 16
149#define OBJ_stateOrProvinceName OBJ_X509,8L
150
151#define SN_organizationName "O"
152#define LN_organizationName "organizationName"
153#define NID_organizationName 17
154#define OBJ_organizationName OBJ_X509,10L
155
156#define SN_organizationalUnitName "OU"
157#define LN_organizationalUnitName "organizationalUnitName"
158#define NID_organizationalUnitName 18
159#define OBJ_organizationalUnitName OBJ_X509,11L
160
161#define SN_rsa "RSA"
162#define LN_rsa "rsa"
163#define NID_rsa 19
164#define OBJ_rsa OBJ_X500,8L,1L,1L
165
166#define LN_pkcs7 "pkcs7"
167#define NID_pkcs7 20
168#define OBJ_pkcs7 OBJ_pkcs,7L
169
170#define LN_pkcs7_data "pkcs7-data"
171#define NID_pkcs7_data 21
172#define OBJ_pkcs7_data OBJ_pkcs7,1L
173
174#define LN_pkcs7_signed "pkcs7-signedData"
175#define NID_pkcs7_signed 22
176#define OBJ_pkcs7_signed OBJ_pkcs7,2L
177
178#define LN_pkcs7_enveloped "pkcs7-envelopedData"
179#define NID_pkcs7_enveloped 23
180#define OBJ_pkcs7_enveloped OBJ_pkcs7,3L
181
182#define LN_pkcs7_signedAndEnveloped "pkcs7-signedAndEnvelopedData"
183#define NID_pkcs7_signedAndEnveloped 24
184#define OBJ_pkcs7_signedAndEnveloped OBJ_pkcs7,4L
185
186#define LN_pkcs7_digest "pkcs7-digestData"
187#define NID_pkcs7_digest 25
188#define OBJ_pkcs7_digest OBJ_pkcs7,5L
189
190#define LN_pkcs7_encrypted "pkcs7-encryptedData"
191#define NID_pkcs7_encrypted 26
192#define OBJ_pkcs7_encrypted OBJ_pkcs7,6L
193
194#define LN_pkcs3 "pkcs3"
195#define NID_pkcs3 27
196#define OBJ_pkcs3 OBJ_pkcs,3L
197
198#define LN_dhKeyAgreement "dhKeyAgreement"
199#define NID_dhKeyAgreement 28
200#define OBJ_dhKeyAgreement OBJ_pkcs3,1L
201
202#define SN_des_ecb "DES-ECB"
203#define LN_des_ecb "des-ecb"
204#define NID_des_ecb 29
205#define OBJ_des_ecb OBJ_algorithm,6L
206
207#define SN_des_cfb64 "DES-CFB"
208#define LN_des_cfb64 "des-cfb"
209#define NID_des_cfb64 30
210/* IV + num */
211#define OBJ_des_cfb64 OBJ_algorithm,9L
212
213#define SN_des_cbc "DES-CBC"
214#define LN_des_cbc "des-cbc"
215#define NID_des_cbc 31
216/* IV */
217#define OBJ_des_cbc OBJ_algorithm,7L
218
219#define SN_des_ede "DES-EDE"
220#define LN_des_ede "des-ede"
221#define NID_des_ede 32
222/* ?? */
223#define OBJ_des_ede OBJ_algorithm,17L
224
225#define SN_des_ede3 "DES-EDE3"
226#define LN_des_ede3 "des-ede3"
227#define NID_des_ede3 33
228
229#define SN_idea_cbc "IDEA-CBC"
230#define LN_idea_cbc "idea-cbc"
231#define NID_idea_cbc 34
232
233#define SN_idea_cfb64 "IDEA-CFB"
234#define LN_idea_cfb64 "idea-cfb"
235#define NID_idea_cfb64 35
236
237#define SN_idea_ecb "IDEA-ECB"
238#define LN_idea_ecb "idea-ecb"
239#define NID_idea_ecb 36
240
241#define SN_rc2_cbc "RC2-CBC"
242#define LN_rc2_cbc "rc2-cbc"
243#define NID_rc2_cbc 37
244#define OBJ_rc2_cbc OBJ_rsadsi,3L,2L
245
246#define SN_rc2_ecb "RC2-ECB"
247#define LN_rc2_ecb "rc2-ecb"
248#define NID_rc2_ecb 38
249
250#define SN_rc2_cfb64 "RC2-CFB"
251#define LN_rc2_cfb64 "rc2-cfb"
252#define NID_rc2_cfb64 39
253
254#define SN_rc2_ofb64 "RC2-OFB"
255#define LN_rc2_ofb64 "rc2-ofb"
256#define NID_rc2_ofb64 40
257
258#define SN_sha "SHA"
259#define LN_sha "sha"
260#define NID_sha 41
261#define OBJ_sha OBJ_algorithm,18L
262
263#define SN_shaWithRSAEncryption "RSA-SHA"
264#define LN_shaWithRSAEncryption "shaWithRSAEncryption"
265#define NID_shaWithRSAEncryption 42
266#define OBJ_shaWithRSAEncryption OBJ_algorithm,15L
267
268#define SN_des_ede_cbc "DES-EDE-CBC"
269#define LN_des_ede_cbc "des-ede-cbc"
270#define NID_des_ede_cbc 43
271
272#define SN_des_ede3_cbc "DES-EDE3-CBC"
273#define LN_des_ede3_cbc "des-ede3-cbc"
274#define NID_des_ede3_cbc 44
275#define OBJ_des_ede3_cbc OBJ_rsadsi,3L,7L
276
277#define SN_des_ofb64 "DES-OFB"
278#define LN_des_ofb64 "des-ofb"
279#define NID_des_ofb64 45
280#define OBJ_des_ofb64 OBJ_algorithm,8L
281
282#define SN_idea_ofb64 "IDEA-OFB"
283#define LN_idea_ofb64 "idea-ofb"
284#define NID_idea_ofb64 46
285
286#define LN_pkcs9 "pkcs9"
287#define NID_pkcs9 47
288#define OBJ_pkcs9 OBJ_pkcs,9L
289
290#define SN_pkcs9_emailAddress "Email"
291#define LN_pkcs9_emailAddress "emailAddress"
292#define NID_pkcs9_emailAddress 48
293#define OBJ_pkcs9_emailAddress OBJ_pkcs9,1L
294
295#define LN_pkcs9_unstructuredName "unstructuredName"
296#define NID_pkcs9_unstructuredName 49
297#define OBJ_pkcs9_unstructuredName OBJ_pkcs9,2L
298
299#define LN_pkcs9_contentType "contentType"
300#define NID_pkcs9_contentType 50
301#define OBJ_pkcs9_contentType OBJ_pkcs9,3L
302
303#define LN_pkcs9_messageDigest "messageDigest"
304#define NID_pkcs9_messageDigest 51
305#define OBJ_pkcs9_messageDigest OBJ_pkcs9,4L
306
307#define LN_pkcs9_signingTime "signingTime"
308#define NID_pkcs9_signingTime 52
309#define OBJ_pkcs9_signingTime OBJ_pkcs9,5L
310
311#define LN_pkcs9_countersignature "countersignature"
312#define NID_pkcs9_countersignature 53
313#define OBJ_pkcs9_countersignature OBJ_pkcs9,6L
314
315#define LN_pkcs9_challengePassword "challengePassword"
316#define NID_pkcs9_challengePassword 54
317#define OBJ_pkcs9_challengePassword OBJ_pkcs9,7L
318
319#define LN_pkcs9_unstructuredAddress "unstructuredAddress"
320#define NID_pkcs9_unstructuredAddress 55
321#define OBJ_pkcs9_unstructuredAddress OBJ_pkcs9,8L
322
323#define LN_pkcs9_extCertAttributes "extendedCertificateAttributes"
324#define NID_pkcs9_extCertAttributes 56
325#define OBJ_pkcs9_extCertAttributes OBJ_pkcs9,9L
326
327#define SN_netscape "Netscape"
328#define LN_netscape "Netscape Communications Corp."
329#define NID_netscape 57
330#define OBJ_netscape 2L,16L,840L,1L,113730L
331
332#define SN_netscape_cert_extension "nsCertExt"
333#define LN_netscape_cert_extension "Netscape Certificate Extension"
334#define NID_netscape_cert_extension 58
335#define OBJ_netscape_cert_extension OBJ_netscape,1L
336
337#define SN_netscape_data_type "nsDataType"
338#define LN_netscape_data_type "Netscape Data Type"
339#define NID_netscape_data_type 59
340#define OBJ_netscape_data_type OBJ_netscape,2L
341
342#define SN_des_ede_cfb64 "DES-EDE-CFB"
343#define LN_des_ede_cfb64 "des-ede-cfb"
344#define NID_des_ede_cfb64 60
345
346#define SN_des_ede3_cfb64 "DES-EDE3-CFB"
347#define LN_des_ede3_cfb64 "des-ede3-cfb"
348#define NID_des_ede3_cfb64 61
349
350#define SN_des_ede_ofb64 "DES-EDE-OFB"
351#define LN_des_ede_ofb64 "des-ede-ofb"
352#define NID_des_ede_ofb64 62
353
354#define SN_des_ede3_ofb64 "DES-EDE3-OFB"
355#define LN_des_ede3_ofb64 "des-ede3-ofb"
356#define NID_des_ede3_ofb64 63
357
358/* I'm not sure about the object ID */
359#define SN_sha1 "SHA1"
360#define LN_sha1 "sha1"
361#define NID_sha1 64
362#define OBJ_sha1 OBJ_algorithm,26L
363/* 28 Jun 1996 - eay */
364/* #define OBJ_sha1 1L,3L,14L,2L,26L,05L <- wrong */
365
366#define SN_sha1WithRSAEncryption "RSA-SHA1"
367#define LN_sha1WithRSAEncryption "sha1WithRSAEncryption"
368#define NID_sha1WithRSAEncryption 65
369#define OBJ_sha1WithRSAEncryption OBJ_pkcs,1L,5L
370
371#define SN_dsaWithSHA "DSA-SHA"
372#define LN_dsaWithSHA "dsaWithSHA"
373#define NID_dsaWithSHA 66
374#define OBJ_dsaWithSHA OBJ_algorithm,13L
375
376#define SN_dsa_2 "DSA-old"
377#define LN_dsa_2 "dsaEncryption-old"
378#define NID_dsa_2 67
379#define OBJ_dsa_2 OBJ_algorithm,12L
380
381/* proposed by microsoft to RSA */
382#define LN_pbeWithSHA1AndRC2_CBC "pbeWithSHA1AndRC2-CBC"
383#define NID_pbeWithSHA1AndRC2_CBC 68
384#define OBJ_pbeWithSHA1AndRC2_CBC OBJ_pkcs,5L,11L
385
386/* proposed by microsoft to RSA */
387#define LN_pbeWithSHA1AndRC4 "pbeWithSHA1AndRC4"
388#define NID_pbeWithSHA1AndRC4 69
389#define OBJ_pbeWithSHA1AndRC4 OBJ_pkcs,5L,12L
390
391#define SN_dsaWithSHA1_2 "DSA-SHA1-old"
392#define LN_dsaWithSHA1_2 "dsaWithSHA1"
393#define NID_dsaWithSHA1_2 70
394/* Got this one from 'sdn706r20.pdf' which is actually an NSA document :-) */
395#define OBJ_dsaWithSHA1_2 OBJ_algorithm,27L
396
397#define SN_netscape_cert_type "nsCertType"
398#define LN_netscape_cert_type "Netscape Cert Type"
399#define NID_netscape_cert_type 71
400#define OBJ_netscape_cert_type OBJ_netscape_cert_extension,1L
401
402#define SN_netscape_base_url "nsBaseUrl"
403#define LN_netscape_base_url "Netscape Base Url"
404#define NID_netscape_base_url 72
405#define OBJ_netscape_base_url OBJ_netscape_cert_extension,2L
406
407#define SN_netscape_revocation_url "nsRevocationUrl"
408#define LN_netscape_revocation_url "Netscape Revocation Url"
409#define NID_netscape_revocation_url 73
410#define OBJ_netscape_revocation_url OBJ_netscape_cert_extension,3L
411
412#define SN_netscape_ca_revocation_url "nsCaRevocationUrl"
413#define LN_netscape_ca_revocation_url "Netscape CA Revocation Url"
414#define NID_netscape_ca_revocation_url 74
415#define OBJ_netscape_ca_revocation_url OBJ_netscape_cert_extension,4L
416
417#define SN_netscape_renewal_url "nsRenewalUrl"
418#define LN_netscape_renewal_url "Netscape Renewal Url"
419#define NID_netscape_renewal_url 75
420#define OBJ_netscape_renewal_url OBJ_netscape_cert_extension,7L
421
422#define SN_netscape_ca_policy_url "nsCaPolicyUrl"
423#define LN_netscape_ca_policy_url "Netscape CA Policy Url"
424#define NID_netscape_ca_policy_url 76
425#define OBJ_netscape_ca_policy_url OBJ_netscape_cert_extension,8L
426
427#define SN_netscape_ssl_server_name "nsSslServerName"
428#define LN_netscape_ssl_server_name "Netscape SSL Server Name"
429#define NID_netscape_ssl_server_name 77
430#define OBJ_netscape_ssl_server_name OBJ_netscape_cert_extension,12L
431
432#define SN_netscape_comment "nsComment"
433#define LN_netscape_comment "Netscape Comment"
434#define NID_netscape_comment 78
435#define OBJ_netscape_comment OBJ_netscape_cert_extension,13L
436
437#define SN_netscape_cert_sequence "nsCertSequence"
438#define LN_netscape_cert_sequence "Netscape Certificate Sequence"
439#define NID_netscape_cert_sequence 79
440#define OBJ_netscape_cert_sequence OBJ_netscape_data_type,5L
441
442#define SN_desx_cbc "DESX-CBC"
443#define LN_desx_cbc "desx-cbc"
444#define NID_desx_cbc 80
445
446#define SN_ld_ce "ld-ce"
447#define NID_ld_ce 81
448#define OBJ_ld_ce 2L,5L,29L
449
450#define SN_subject_key_identifier "subjectKeyIdentifier"
451#define LN_subject_key_identifier "X509v3 Subject Key Identifier"
452#define NID_subject_key_identifier 82
453#define OBJ_subject_key_identifier OBJ_ld_ce,14L
454
455#define SN_key_usage "keyUsage"
456#define LN_key_usage "X509v3 Key Usage"
457#define NID_key_usage 83
458#define OBJ_key_usage OBJ_ld_ce,15L
459
460#define SN_private_key_usage_period "privateKeyUsagePeriod"
461#define LN_private_key_usage_period "X509v3 Private Key Usage Period"
462#define NID_private_key_usage_period 84
463#define OBJ_private_key_usage_period OBJ_ld_ce,16L
464
465#define SN_subject_alt_name "subjectAltName"
466#define LN_subject_alt_name "X509v3 Subject Alternative Name"
467#define NID_subject_alt_name 85
468#define OBJ_subject_alt_name OBJ_ld_ce,17L
469
470#define SN_issuer_alt_name "issuerAltName"
471#define LN_issuer_alt_name "X509v3 Issuer Alternative Name"
472#define NID_issuer_alt_name 86
473#define OBJ_issuer_alt_name OBJ_ld_ce,18L
474
475#define SN_basic_constraints "basicConstraints"
476#define LN_basic_constraints "X509v3 Basic Constraints"
477#define NID_basic_constraints 87
478#define OBJ_basic_constraints OBJ_ld_ce,19L
479
480#define SN_crl_number "crlNumber"
481#define LN_crl_number "X509v3 CRL Number"
482#define NID_crl_number 88
483#define OBJ_crl_number OBJ_ld_ce,20L
484
485#define SN_certificate_policies "certificatePolicies"
486#define LN_certificate_policies "X509v3 Certificate Policies"
487#define NID_certificate_policies 89
488#define OBJ_certificate_policies OBJ_ld_ce,32L
489
490#define SN_authority_key_identifier "authorityKeyIdentifier"
491#define LN_authority_key_identifier "X509v3 Authority Key Identifier"
492#define NID_authority_key_identifier 90
493#define OBJ_authority_key_identifier OBJ_ld_ce,35L
494
495#define SN_bf_cbc "BF-CBC"
496#define LN_bf_cbc "bf-cbc"
497#define NID_bf_cbc 91
498
499#define SN_bf_ecb "BF-ECB"
500#define LN_bf_ecb "bf-ecb"
501#define NID_bf_ecb 92
502
503#define SN_bf_cfb64 "BF-CFB"
504#define LN_bf_cfb64 "bf-cfb"
505#define NID_bf_cfb64 93
506
507#define SN_bf_ofb64 "BF-OFB"
508#define LN_bf_ofb64 "bf-ofb"
509#define NID_bf_ofb64 94
510
511#define SN_mdc2 "MDC2"
512#define LN_mdc2 "mdc2"
513#define NID_mdc2 95
514#define OBJ_mdc2 2L,5L,8L,3L,101L
515/* An alternative? 1L,3L,14L,3L,2L,19L */
516
517#define SN_mdc2WithRSA "RSA-MDC2"
518#define LN_mdc2WithRSA "mdc2withRSA"
519#define NID_mdc2WithRSA 96
520#define OBJ_mdc2WithRSA 2L,5L,8L,3L,100L
521
522#define SN_rc4_40 "RC4-40"
523#define LN_rc4_40 "rc4-40"
524#define NID_rc4_40 97
525
526#define SN_rc2_40_cbc "RC2-40-CBC"
527#define LN_rc2_40_cbc "rc2-40-cbc"
528#define NID_rc2_40_cbc 98
529
530#define SN_givenName "G"
531#define LN_givenName "givenName"
532#define NID_givenName 99
533#define OBJ_givenName OBJ_X509,42L
534
535#define SN_surname "S"
536#define LN_surname "surname"
537#define NID_surname 100
538#define OBJ_surname OBJ_X509,4L
539
540#define SN_initials "I"
541#define LN_initials "initials"
542#define NID_initials 101
543#define OBJ_initials OBJ_X509,43L
544
545#define SN_uniqueIdentifier "UID"
546#define LN_uniqueIdentifier "uniqueIdentifier"
547#define NID_uniqueIdentifier 102
548#define OBJ_uniqueIdentifier OBJ_X509,45L
549
550#define SN_crl_distribution_points "crlDistributionPoints"
551#define LN_crl_distribution_points "X509v3 CRL Distribution Points"
552#define NID_crl_distribution_points 103
553#define OBJ_crl_distribution_points OBJ_ld_ce,31L
554
555#define SN_md5WithRSA "RSA-NP-MD5"
556#define LN_md5WithRSA "md5WithRSA"
557#define NID_md5WithRSA 104
558#define OBJ_md5WithRSA OBJ_algorithm,3L
559
560#define SN_serialNumber "SN"
561#define LN_serialNumber "serialNumber"
562#define NID_serialNumber 105
563#define OBJ_serialNumber OBJ_X509,5L
564
565#define SN_title "T"
566#define LN_title "title"
567#define NID_title 106
568#define OBJ_title OBJ_X509,12L
569
570#define SN_description "D"
571#define LN_description "description"
572#define NID_description 107
573#define OBJ_description OBJ_X509,13L
574
575/* CAST5 is CAST-128, I'm just sticking with the documentation */
576#define SN_cast5_cbc "CAST5-CBC"
577#define LN_cast5_cbc "cast5-cbc"
578#define NID_cast5_cbc 108
579#define OBJ_cast5_cbc 1L,2L,840L,113533L,7L,66L,10L
580
581#define SN_cast5_ecb "CAST5-ECB"
582#define LN_cast5_ecb "cast5-ecb"
583#define NID_cast5_ecb 109
584
585#define SN_cast5_cfb64 "CAST5-CFB"
586#define LN_cast5_cfb64 "cast5-cfb"
587#define NID_cast5_cfb64 110
588
589#define SN_cast5_ofb64 "CAST5-OFB"
590#define LN_cast5_ofb64 "cast5-ofb"
591#define NID_cast5_ofb64 111
592
593#define LN_pbeWithMD5AndCast5_CBC "pbeWithMD5AndCast5CBC"
594#define NID_pbeWithMD5AndCast5_CBC 112
595#define OBJ_pbeWithMD5AndCast5_CBC 1L,2L,840L,113533L,7L,66L,12L
596
597/* This is one sun will soon be using :-(
598 * id-dsa-with-sha1 ID ::= {
599 * iso(1) member-body(2) us(840) x9-57 (10040) x9cm(4) 3 }
600 */
601#define SN_dsaWithSHA1 "DSA-SHA1"
602#define LN_dsaWithSHA1 "dsaWithSHA1"
603#define NID_dsaWithSHA1 113
604#define OBJ_dsaWithSHA1 1L,2L,840L,10040L,4L,3L
605
606#define NID_md5_sha1 114
607#define SN_md5_sha1 "MD5-SHA1"
608#define LN_md5_sha1 "md5-sha1"
609
610#define SN_sha1WithRSA "RSA-SHA1-2"
611#define LN_sha1WithRSA "sha1WithRSA"
612#define NID_sha1WithRSA 115
613#define OBJ_sha1WithRSA OBJ_algorithm,29L
614
615#define SN_dsa "DSA"
616#define LN_dsa "dsaEncryption"
617#define NID_dsa 116
618#define OBJ_dsa 1L,2L,840L,10040L,4L,1L
619
620#define SN_ripemd160 "RIPEMD160"
621#define LN_ripemd160 "ripemd160"
622#define NID_ripemd160 117
623#define OBJ_ripemd160 1L,3L,36L,3L,2L,1L
624
625/* The name should actually be rsaSignatureWithripemd160, but I'm going
626 * to contiune using the convention I'm using with the other ciphers */
627#define SN_ripemd160WithRSA "RSA-RIPEMD160"
628#define LN_ripemd160WithRSA "ripemd160WithRSA"
629#define NID_ripemd160WithRSA 119
630#define OBJ_ripemd160WithRSA 1L,3L,36L,3L,3L,1L,2L
631
632/* Taken from rfc2040
633 * RC5_CBC_Parameters ::= SEQUENCE {
634 * version INTEGER (v1_0(16)),
635 * rounds INTEGER (8..127),
636 * blockSizeInBits INTEGER (64, 128),
637 * iv OCTET STRING OPTIONAL
638 * }
639 */
640#define SN_rc5_cbc "RC5-CBC"
641#define LN_rc5_cbc "rc5-cbc"
642#define NID_rc5_cbc 120
643#define OBJ_rc5_cbc OBJ_rsadsi,3L,8L
644
645#define SN_rc5_ecb "RC5-ECB"
646#define LN_rc5_ecb "rc5-ecb"
647#define NID_rc5_ecb 121
648
649#define SN_rc5_cfb64 "RC5-CFB"
650#define LN_rc5_cfb64 "rc5-cfb"
651#define NID_rc5_cfb64 122
652
653#define SN_rc5_ofb64 "RC5-OFB"
654#define LN_rc5_ofb64 "rc5-ofb"
655#define NID_rc5_ofb64 123
656
657#include "bio.h"
658#include "asn1.h"
659
660#define OBJ_create_and_add_object(a,b,c) OBJ_create(a,b,c)
661
662#ifndef NOPROTO
663
664ASN1_OBJECT * OBJ_dup(ASN1_OBJECT *o);
665ASN1_OBJECT * OBJ_nid2obj(int n);
666char * OBJ_nid2ln(int n);
667char * OBJ_nid2sn(int n);
668int OBJ_obj2nid(ASN1_OBJECT *o);
669int OBJ_txt2nid(char *s);
670int OBJ_ln2nid(char *s);
671int OBJ_sn2nid(char *s);
672int OBJ_cmp(ASN1_OBJECT *a,ASN1_OBJECT *b);
673char * OBJ_bsearch(char *key,char *base,int num,int size,int (*cmp)());
674
675void ERR_load_OBJ_strings(void );
676
677int OBJ_new_nid(int num);
678int OBJ_add_object(ASN1_OBJECT *obj);
679int OBJ_create(char *oid,char *sn,char *ln);
680void OBJ_cleanup(void );
681int OBJ_create_objects(BIO *in);
682
683#else
684
685ASN1_OBJECT * OBJ_dup();
686ASN1_OBJECT * OBJ_nid2obj();
687char * OBJ_nid2ln();
688char * OBJ_nid2sn();
689int OBJ_obj2nid();
690int OBJ_txt2nid();
691int OBJ_ln2nid();
692int OBJ_sn2nid();
693int OBJ_cmp();
694char * OBJ_bsearch();
695
696void ERR_load_OBJ_strings();
697
698int OBJ_new_nid();
699int OBJ_add_object();
700int OBJ_create();
701void OBJ_cleanup();
702int OBJ_create_objects();
703
704#endif
705
706/* BEGIN ERROR CODES */
707/* Error codes for the OBJ functions. */
708
709/* Function codes. */
710#define OBJ_F_OBJ_CREATE 100
711#define OBJ_F_OBJ_DUP 101
712#define OBJ_F_OBJ_NID2LN 102
713#define OBJ_F_OBJ_NID2OBJ 103
714#define OBJ_F_OBJ_NID2SN 104
715
716/* Reason codes. */
717#define OBJ_R_MALLOC_FAILURE 100
718#define OBJ_R_UNKNOWN_NID 101
719
720#ifdef __cplusplus
721}
722#endif
723#endif
724
diff --git a/src/lib/libcrypto/objects/objects.txt b/src/lib/libcrypto/objects/objects.txt
new file mode 100644
index 0000000000..cb276e90e9
--- /dev/null
+++ b/src/lib/libcrypto/objects/objects.txt
@@ -0,0 +1,40 @@
11 2 : ISO member bodies
21 2 840 : US (ANSI)
31 2 840 113549 : rsadsi : RSA Data Security, Inc.
41 2 840 113549 1 : pkcs : RSA Data Security, Inc. PKCS
51 2 840 113549 1 1 1 : rsaEncryption
61 2 840 113549 1 1 2 : md2withRSAEncryption
71 2 840 113549 1 1 4 : md5withRSAEncryption
81 2 840 113549 1 7 : pkcs-7
91 2 840 113549 1 7 1 : pkcs-7-data
101 2 840 113549 1 7 2 : pkcs-7-signedData
111 2 840 113549 1 7 3 : pkcs-7-envelopedData
121 2 840 113549 1 7 4 : pkcs-7-signedAndEnvelopedData
131 2 840 113549 1 7 5 : pkcs-7-digestData
141 2 840 113549 1 7 6 : pkcs-7-encryptedData
151 2 840 113549 2 2 : md2
161 2 840 113549 2 4 : md4
171 2 840 113549 2 5 : md5
181 2 840 113549 3 4 : rc4
191 2 840 113549 5 1 : pbeWithMD2AndDES_CBC
201 2 840 113549 5 3 : pbeWithMD5AndDES_CBC
212 5 : X500 : directory services (X.500)
222 5 4 : X509
232 5 4 3 : commonName
242 5 4 6 : countryName
252 5 4 7 : localityName
262 5 4 8 : stateOrProvinceName
272 5 4 10 : organizationName
282 5 4 11 : organizationalUnitName
292 5 8 : directory services - algorithms
302 5 8 1 1 : rsa
31
32algorithm 18 : sha
33encryptionAlgorithm 1 : rsa
34algorithm 11 : rsaSignature
35
36algorithm 6 : desECB
37algorithm 7 : desCBC
38algorithm 8 : desOFB
39algorithm 9 : desCFB
40algorithm 17 : desEDE2