summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/objects
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/objects')
-rw-r--r--src/lib/libcrypto/objects/Makefile.ssl66
-rw-r--r--src/lib/libcrypto/objects/o_names.c243
-rw-r--r--src/lib/libcrypto/objects/obj_dat.c269
-rw-r--r--src/lib/libcrypto/objects/obj_dat.h656
-rw-r--r--src/lib/libcrypto/objects/obj_dat.pl4
-rw-r--r--src/lib/libcrypto/objects/obj_err.c118
-rw-r--r--src/lib/libcrypto/objects/obj_lib.c32
-rw-r--r--src/lib/libcrypto/objects/objects.err12
-rw-r--r--src/lib/libcrypto/objects/objects.h316
9 files changed, 817 insertions, 899 deletions
diff --git a/src/lib/libcrypto/objects/Makefile.ssl b/src/lib/libcrypto/objects/Makefile.ssl
index 320523cea1..a3a15c13c1 100644
--- a/src/lib/libcrypto/objects/Makefile.ssl
+++ b/src/lib/libcrypto/objects/Makefile.ssl
@@ -7,23 +7,23 @@ TOP= ../..
7CC= cc 7CC= cc
8INCLUDES= -I.. -I../../include 8INCLUDES= -I.. -I../../include
9CFLAG=-g 9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
10INSTALLTOP=/usr/local/ssl 12INSTALLTOP=/usr/local/ssl
11MAKE= make -f Makefile.ssl 13MAKE= make -f Makefile.ssl
12MAKEDEPEND= makedepend -f Makefile.ssl 14MAKEDEPEND= $(TOP)/util/domd $(TOP)
13MAKEFILE= Makefile.ssl 15MAKEFILE= Makefile.ssl
14AR= ar r 16AR= ar r
15 17
16CFLAGS= $(INCLUDES) $(CFLAG) 18CFLAGS= $(INCLUDES) $(CFLAG)
17 19
18ERR=objects
19ERRC=obj_err
20GENERAL=Makefile README 20GENERAL=Makefile README
21TEST= 21TEST=
22APPS= 22APPS=
23 23
24LIB=$(TOP)/libcrypto.a 24LIB=$(TOP)/libcrypto.a
25LIBSRC= obj_dat.c obj_lib.c $(ERRC).c 25LIBSRC= o_names.c obj_dat.c obj_lib.c obj_err.c
26LIBOBJ= obj_dat.o obj_lib.o $(ERRC).o 26LIBOBJ= o_names.o obj_dat.o obj_lib.o obj_err.o
27 27
28SRC= $(LIBSRC) 28SRC= $(LIBSRC)
29 29
@@ -38,28 +38,27 @@ top:
38all: obj_dat.h lib 38all: obj_dat.h lib
39 39
40obj_dat.h: objects.h obj_dat.pl 40obj_dat.h: objects.h obj_dat.pl
41 perl ./obj_dat.pl < objects.h > obj_dat.h 41 $(PERL) ./obj_dat.pl < objects.h > obj_dat.h
42 42
43lib: $(LIBOBJ) 43lib: $(LIBOBJ)
44 $(AR) $(LIB) $(LIBOBJ) 44 $(AR) $(LIB) $(LIBOBJ)
45 sh $(TOP)/util/ranlib.sh $(LIB) 45 $(RANLIB) $(LIB)
46 @touch lib 46 @touch lib
47 47
48files: 48files:
49 perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO 49 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
50 50
51links: 51links:
52 /bin/rm -f Makefile 52 @$(TOP)/util/point.sh Makefile.ssl Makefile
53 $(TOP)/util/point.sh Makefile.ssl Makefile ; 53 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
54 $(TOP)/util/mklink.sh ../../include $(EXHEADER) 54 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
55 $(TOP)/util/mklink.sh ../../test $(TEST) 55 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
56 $(TOP)/util/mklink.sh ../../apps $(APPS)
57 56
58install: 57install:
59 @for i in $(EXHEADER) ; \ 58 @for i in $(EXHEADER) ; \
60 do \ 59 do \
61 (cp $$i $(INSTALLTOP)/include/$$i; \ 60 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
62 chmod 644 $(INSTALLTOP)/include/$$i ); \ 61 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
63 done; 62 done;
64 63
65tags: 64tags:
@@ -71,17 +70,40 @@ lint:
71 lint -DLINT $(INCLUDES) $(SRC)>fluff 70 lint -DLINT $(INCLUDES) $(SRC)>fluff
72 71
73depend: 72depend:
74 $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) 73 $(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC)
75 74
76dclean: 75dclean:
77 perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new 76 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
78 mv -f Makefile.new $(MAKEFILE) 77 mv -f Makefile.new $(MAKEFILE)
79 78
80clean: 79clean:
81 /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff 80 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
82
83errors:
84 perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h
85 perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c
86 81
87# DO NOT DELETE THIS LINE -- make depend depends on it. 82# DO NOT DELETE THIS LINE -- make depend depends on it.
83
84o_names.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
85o_names.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
86o_names.o: ../../include/openssl/lhash.h ../../include/openssl/objects.h
87o_names.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
88o_names.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
89obj_dat.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
90obj_dat.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
91obj_dat.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
92obj_dat.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
93obj_dat.o: ../../include/openssl/lhash.h ../../include/openssl/objects.h
94obj_dat.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
95obj_dat.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
96obj_dat.o: ../cryptlib.h obj_dat.h
97obj_err.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
98obj_err.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h
99obj_err.o: ../../include/openssl/err.h ../../include/openssl/objects.h
100obj_err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
101obj_err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
102obj_lib.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
103obj_lib.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
104obj_lib.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
105obj_lib.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
106obj_lib.o: ../../include/openssl/lhash.h ../../include/openssl/objects.h
107obj_lib.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
108obj_lib.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
109obj_lib.o: ../cryptlib.h
diff --git a/src/lib/libcrypto/objects/o_names.c b/src/lib/libcrypto/objects/o_names.c
new file mode 100644
index 0000000000..4da5e45b9c
--- /dev/null
+++ b/src/lib/libcrypto/objects/o_names.c
@@ -0,0 +1,243 @@
1#include <stdio.h>
2#include <stdlib.h>
3#include <string.h>
4
5#include <openssl/lhash.h>
6#include <openssl/objects.h>
7
8/* I use the ex_data stuff to manage the identifiers for the obj_name_types
9 * that applications may define. I only really use the free function field.
10 */
11static LHASH *names_lh=NULL;
12static int names_type_num=OBJ_NAME_TYPE_NUM;
13static STACK *names_cmp=NULL;
14static STACK *names_hash=NULL;
15static STACK *names_free=NULL;
16
17static unsigned long obj_name_hash(OBJ_NAME *a);
18static int obj_name_cmp(OBJ_NAME *a,OBJ_NAME *b);
19
20int OBJ_NAME_init(void)
21 {
22 if (names_lh != NULL) return(1);
23 MemCheck_off();
24 names_lh=lh_new(obj_name_hash,obj_name_cmp);
25 MemCheck_on();
26 return(names_lh != NULL);
27 }
28
29int OBJ_NAME_new_index(unsigned long (*hash_func)(), int (*cmp_func)(),
30 void (*free_func)())
31 {
32 int ret;
33 int i;
34
35 if (names_free == NULL)
36 {
37 MemCheck_off();
38 names_hash=sk_new_null();
39 names_cmp=sk_new_null();
40 names_free=sk_new_null();
41 MemCheck_on();
42 }
43 if ((names_free == NULL) || (names_hash == NULL) || (names_cmp == NULL))
44 {
45 /* ERROR */
46 return(0);
47 }
48 ret=names_type_num;
49 names_type_num++;
50 for (i=sk_num(names_free); i<names_type_num; i++)
51 {
52 MemCheck_off();
53 sk_push(names_hash,(char *)strcmp);
54 sk_push(names_cmp,(char *)lh_strhash);
55 sk_push(names_free,NULL);
56 MemCheck_on();
57 }
58 if (hash_func != NULL)
59 sk_set(names_hash,ret,(char *)hash_func);
60 if (cmp_func != NULL)
61 sk_set(names_cmp,ret,(char *)cmp_func);
62 if (free_func != NULL)
63 sk_set(names_free,ret,(char *)free_func);
64 return(ret);
65 }
66
67static int obj_name_cmp(OBJ_NAME *a, OBJ_NAME *b)
68 {
69 int ret;
70 int (*cmp)();
71
72 ret=a->type-b->type;
73 if (ret == 0)
74 {
75 if ((names_cmp != NULL) && (sk_num(names_cmp) > a->type))
76 {
77 cmp=(int (*)())sk_value(names_cmp,a->type);
78 ret=cmp(a->name,b->name);
79 }
80 else
81 ret=strcmp(a->name,b->name);
82 }
83 return(ret);
84 }
85
86static unsigned long obj_name_hash(OBJ_NAME *a)
87 {
88 unsigned long ret;
89 unsigned long (*hash)();
90
91 if ((names_hash != NULL) && (sk_num(names_hash) > a->type))
92 {
93 hash=(unsigned long (*)())sk_value(names_hash,a->type);
94 ret=hash(a->name);
95 }
96 else
97 {
98 ret=lh_strhash(a->name);
99 }
100 ret^=a->type;
101 return(ret);
102 }
103
104const char *OBJ_NAME_get(const char *name, int type)
105 {
106 OBJ_NAME on,*ret;
107 int num=0,alias;
108
109 if (name == NULL) return(NULL);
110 if ((names_lh == NULL) && !OBJ_NAME_init()) return(NULL);
111
112 alias=type&OBJ_NAME_ALIAS;
113 type&= ~OBJ_NAME_ALIAS;
114
115 on.name=name;
116 on.type=type;
117
118 for (;;)
119 {
120 ret=(OBJ_NAME *)lh_retrieve(names_lh,(char *)&on);
121 if (ret == NULL) return(NULL);
122 if ((ret->alias) && !alias)
123 {
124 if (++num > 10) return(NULL);
125 on.name=ret->data;
126 }
127 else
128 {
129 return(ret->data);
130 }
131 }
132 }
133
134int OBJ_NAME_add(const char *name, int type, const char *data)
135 {
136 void (*f)();
137 OBJ_NAME *onp,*ret;
138 int alias;
139
140 if ((names_lh == NULL) && !OBJ_NAME_init()) return(0);
141
142 alias=type&OBJ_NAME_ALIAS;
143 type&= ~OBJ_NAME_ALIAS;
144
145 onp=(OBJ_NAME *)Malloc(sizeof(OBJ_NAME));
146 if (onp == NULL)
147 {
148 /* ERROR */
149 return(0);
150 }
151
152 onp->name=name;
153 onp->alias=alias;
154 onp->type=type;
155 onp->data=data;
156
157 ret=(OBJ_NAME *)lh_insert(names_lh,(char *)onp);
158 if (ret != NULL)
159 {
160 /* free things */
161 if ((names_free != NULL) && (sk_num(names_free) > ret->type))
162 {
163 f=(void (*)())sk_value(names_free,ret->type);
164 f(ret->name,ret->type,ret->data);
165 }
166 Free((char *)ret);
167 }
168 else
169 {
170 if (lh_error(names_lh))
171 {
172 /* ERROR */
173 return(0);
174 }
175 }
176 return(1);
177 }
178
179int OBJ_NAME_remove(const char *name, int type)
180 {
181 OBJ_NAME on,*ret;
182 void (*f)();
183
184 if (names_lh == NULL) return(0);
185
186 type&= ~OBJ_NAME_ALIAS;
187 on.name=name;
188 on.type=type;
189 ret=(OBJ_NAME *)lh_delete(names_lh,(char *)&on);
190 if (ret != NULL)
191 {
192 /* free things */
193 if ((names_free != NULL) && (sk_num(names_free) > type))
194 {
195 f=(void (*)())sk_value(names_free,type);
196 f(ret->name,ret->type,ret->data);
197 }
198 Free((char *)ret);
199 return(1);
200 }
201 else
202 return(0);
203 }
204
205static int free_type;
206
207static void names_lh_free(OBJ_NAME *onp, int type)
208{
209 if(onp == NULL)
210 return;
211
212 if ((free_type < 0) || (free_type == onp->type))
213 {
214 OBJ_NAME_remove(onp->name,onp->type);
215 }
216 }
217
218void OBJ_NAME_cleanup(int type)
219 {
220 unsigned long down_load;
221
222 if (names_lh == NULL) return;
223
224 free_type=type;
225 down_load=names_lh->down_load;
226 names_lh->down_load=0;
227
228 lh_doall(names_lh,names_lh_free);
229 if (type < 0)
230 {
231 lh_free(names_lh);
232 sk_free(names_hash);
233 sk_free(names_cmp);
234 sk_free(names_free);
235 names_lh=NULL;
236 names_hash=NULL;
237 names_cmp=NULL;
238 names_free=NULL;
239 }
240 else
241 names_lh->down_load=down_load;
242 }
243
diff --git a/src/lib/libcrypto/objects/obj_dat.c b/src/lib/libcrypto/objects/obj_dat.c
index 34866ebbd2..d47b874399 100644
--- a/src/lib/libcrypto/objects/obj_dat.c
+++ b/src/lib/libcrypto/objects/obj_dat.c
@@ -59,23 +59,29 @@
59#include <stdio.h> 59#include <stdio.h>
60#include <ctype.h> 60#include <ctype.h>
61#include "cryptlib.h" 61#include "cryptlib.h"
62#include "lhash.h" 62#include <openssl/lhash.h>
63#include "asn1.h" 63#include <openssl/asn1.h>
64#include "objects.h" 64#include <openssl/objects.h>
65 65
66/* obj_dat.h is generated from objects.h by obj_dat.pl */ 66/* obj_dat.h is generated from objects.h by obj_dat.pl */
67#ifndef NO_OBJECT
67#include "obj_dat.h" 68#include "obj_dat.h"
69#else
70/* You will have to load all the objects needed manually in the application */
71#define NUM_NID 0
72#define NUM_SN 0
73#define NUM_LN 0
74#define NUM_OBJ 0
75static unsigned char lvalues[1];
76static ASN1_OBJECT nid_objs[1];
77static ASN1_OBJECT *sn_objs[1];
78static ASN1_OBJECT *ln_objs[1];
79static ASN1_OBJECT *obj_objs[1];
80#endif
68 81
69#ifndef NOPROTO
70static int sn_cmp(ASN1_OBJECT **a, ASN1_OBJECT **b); 82static int sn_cmp(ASN1_OBJECT **a, ASN1_OBJECT **b);
71static int ln_cmp(ASN1_OBJECT **a, ASN1_OBJECT **b); 83static int ln_cmp(ASN1_OBJECT **a, ASN1_OBJECT **b);
72static int obj_cmp(ASN1_OBJECT **a, ASN1_OBJECT **b); 84static 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 85#define ADDED_DATA 0
80#define ADDED_SNAME 1 86#define ADDED_SNAME 1
81#define ADDED_LNAME 2 87#define ADDED_LNAME 2
@@ -90,18 +96,13 @@ typedef struct added_obj_st
90static int new_nid=NUM_NID; 96static int new_nid=NUM_NID;
91static LHASH *added=NULL; 97static LHASH *added=NULL;
92 98
93static int sn_cmp(ap,bp) 99static int sn_cmp(ASN1_OBJECT **ap, ASN1_OBJECT **bp)
94ASN1_OBJECT **ap;
95ASN1_OBJECT **bp;
96 { return(strcmp((*ap)->sn,(*bp)->sn)); } 100 { return(strcmp((*ap)->sn,(*bp)->sn)); }
97 101
98static int ln_cmp(ap,bp) 102static int ln_cmp(ASN1_OBJECT **ap, ASN1_OBJECT **bp)
99ASN1_OBJECT **ap;
100ASN1_OBJECT **bp;
101 { return(strcmp((*ap)->ln,(*bp)->ln)); } 103 { return(strcmp((*ap)->ln,(*bp)->ln)); }
102 104
103static unsigned long add_hash(ca) 105static unsigned long add_hash(ADDED_OBJ *ca)
104ADDED_OBJ *ca;
105 { 106 {
106 ASN1_OBJECT *a; 107 ASN1_OBJECT *a;
107 int i; 108 int i;
@@ -134,8 +135,7 @@ ADDED_OBJ *ca;
134 return(ret); 135 return(ret);
135 } 136 }
136 137
137static int add_cmp(ca,cb) 138static int add_cmp(ADDED_OBJ *ca, ADDED_OBJ *cb)
138ADDED_OBJ *ca,*cb;
139 { 139 {
140 ASN1_OBJECT *a,*b; 140 ASN1_OBJECT *a,*b;
141 int i; 141 int i;
@@ -163,36 +163,35 @@ ADDED_OBJ *ca,*cb;
163 default: 163 default:
164 abort(); 164 abort();
165 } 165 }
166 return(1); /* should not get here */
166 } 167 }
167 168
168static int init_added() 169static int init_added(void)
169 { 170 {
170 if (added != NULL) return(1); 171 if (added != NULL) return(1);
171 added=lh_new(add_hash,add_cmp); 172 added=lh_new(add_hash,add_cmp);
172 return(added != NULL); 173 return(added != NULL);
173 } 174 }
174 175
175static void cleanup1(a) 176static void cleanup1(ADDED_OBJ *a)
176ADDED_OBJ *a;
177 { 177 {
178 a->obj->nid=0; 178 a->obj->nid=0;
179 a->obj->flags|=ASN1_OBJECT_FLAG_DYNAMIC| 179 a->obj->flags|=ASN1_OBJECT_FLAG_DYNAMIC|
180 ASN1_OBJECT_FLAG_DYNAMIC_STRINGS; 180 ASN1_OBJECT_FLAG_DYNAMIC_STRINGS|
181 ASN1_OBJECT_FLAG_DYNAMIC_DATA;
181 } 182 }
182 183
183static void cleanup2(a) 184static void cleanup2(ADDED_OBJ *a)
184ADDED_OBJ *a;
185 { a->obj->nid++; } 185 { a->obj->nid++; }
186 186
187static void cleanup3(a) 187static void cleanup3(ADDED_OBJ *a)
188ADDED_OBJ *a;
189 { 188 {
190 if (--a->obj->nid == 0) 189 if (--a->obj->nid == 0)
191 ASN1_OBJECT_free(a->obj); 190 ASN1_OBJECT_free(a->obj);
192 Free(a); 191 Free(a);
193 } 192 }
194 193
195void OBJ_cleanup() 194void OBJ_cleanup(void)
196 { 195 {
197 if (added == NULL) return; 196 if (added == NULL) return;
198 added->down_load=0; 197 added->down_load=0;
@@ -203,8 +202,7 @@ void OBJ_cleanup()
203 added=NULL; 202 added=NULL;
204 } 203 }
205 204
206int OBJ_new_nid(num) 205int OBJ_new_nid(int num)
207int num;
208 { 206 {
209 int i; 207 int i;
210 208
@@ -213,8 +211,7 @@ int num;
213 return(i); 211 return(i);
214 } 212 }
215 213
216int OBJ_add_object(obj) 214int OBJ_add_object(ASN1_OBJECT *obj)
217ASN1_OBJECT *obj;
218 { 215 {
219 ASN1_OBJECT *o; 216 ASN1_OBJECT *o;
220 ADDED_OBJ *ao[4],*aop; 217 ADDED_OBJ *ao[4],*aop;
@@ -247,7 +244,9 @@ ASN1_OBJECT *obj;
247 Free(aop); 244 Free(aop);
248 } 245 }
249 } 246 }
250 o->flags&= ~(ASN1_OBJECT_FLAG_DYNAMIC|ASN1_OBJECT_FLAG_DYNAMIC_STRINGS); 247 o->flags&= ~(ASN1_OBJECT_FLAG_DYNAMIC|ASN1_OBJECT_FLAG_DYNAMIC_STRINGS|
248 ASN1_OBJECT_FLAG_DYNAMIC_DATA);
249
251 return(o->nid); 250 return(o->nid);
252err: 251err:
253 for (i=ADDED_DATA; i<=ADDED_NID; i++) 252 for (i=ADDED_DATA; i<=ADDED_NID; i++)
@@ -256,8 +255,7 @@ err:
256 return(NID_undef); 255 return(NID_undef);
257 } 256 }
258 257
259ASN1_OBJECT *OBJ_nid2obj(n) 258ASN1_OBJECT *OBJ_nid2obj(int n)
260int n;
261 { 259 {
262 ADDED_OBJ ad,*adp; 260 ADDED_OBJ ad,*adp;
263 ASN1_OBJECT ob; 261 ASN1_OBJECT ob;
@@ -289,8 +287,7 @@ int n;
289 } 287 }
290 } 288 }
291 289
292char *OBJ_nid2sn(n) 290const char *OBJ_nid2sn(int n)
293int n;
294 { 291 {
295 ADDED_OBJ ad,*adp; 292 ADDED_OBJ ad,*adp;
296 ASN1_OBJECT ob; 293 ASN1_OBJECT ob;
@@ -322,8 +319,7 @@ int n;
322 } 319 }
323 } 320 }
324 321
325char *OBJ_nid2ln(n) 322const char *OBJ_nid2ln(int n)
326int n;
327 { 323 {
328 ADDED_OBJ ad,*adp; 324 ADDED_OBJ ad,*adp;
329 ASN1_OBJECT ob; 325 ASN1_OBJECT ob;
@@ -355,8 +351,7 @@ int n;
355 } 351 }
356 } 352 }
357 353
358int OBJ_obj2nid(a) 354int OBJ_obj2nid(ASN1_OBJECT *a)
359ASN1_OBJECT *a;
360 { 355 {
361 ASN1_OBJECT **op; 356 ASN1_OBJECT **op;
362 ADDED_OBJ ad,*adp; 357 ADDED_OBJ ad,*adp;
@@ -380,45 +375,126 @@ ASN1_OBJECT *a;
380 return((*op)->nid); 375 return((*op)->nid);
381 } 376 }
382 377
383int OBJ_txt2nid(s) 378/* Convert an object name into an ASN1_OBJECT
384char *s; 379 * if "noname" is not set then search for short and long names first.
380 * This will convert the "dotted" form into an object: unlike OBJ_txt2nid
381 * it can be used with any objects, not just registered ones.
382 */
383
384ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name)
385 { 385 {
386 int ret; 386 int nid = NID_undef;
387 ASN1_OBJECT *op=NULL;
388 unsigned char *buf,*p;
389 int i, j;
387 390
388 ret=OBJ_sn2nid(s); 391 if(!no_name) {
389 if (ret == NID_undef) 392 if( ((nid = OBJ_sn2nid(s)) != NID_undef) ||
390 { 393 ((nid = OBJ_ln2nid(s)) != NID_undef) )
391 ret=OBJ_ln2nid(s); 394 return OBJ_nid2obj(nid);
392 if (ret == NID_undef) 395 }
393 {
394 ASN1_OBJECT *op=NULL;
395 unsigned char *buf,*p;
396 int i;
397 396
398 i=a2d_ASN1_OBJECT(NULL,0,s,-1); 397 /* Work out size of content octets */
399 if (i <= 0) 398 i=a2d_ASN1_OBJECT(NULL,0,s,-1);
400 { 399 if (i <= 0) {
401 /* clear the error */ 400 /* Clear the error */
402 ERR_get_error(); 401 ERR_get_error();
403 return(0); 402 return NULL;
404 } 403 }
404 /* Work out total size */
405 j = ASN1_object_size(0,i,V_ASN1_OBJECT);
406
407 if((buf=(unsigned char *)Malloc(j)) == NULL) return NULL;
408
409 p = buf;
410 /* Write out tag+length */
411 ASN1_put_object(&p,0,i,V_ASN1_OBJECT,V_ASN1_UNIVERSAL);
412 /* Write out contents */
413 a2d_ASN1_OBJECT(p,i,s,-1);
414
415 p=buf;
416 op=d2i_ASN1_OBJECT(NULL,&p,i);
417 Free(buf);
418 return op;
419 }
420
421int OBJ_obj2txt(char *buf, int buf_len, ASN1_OBJECT *a, int no_name)
422{
423 int i,idx=0,n=0,len,nid;
424 unsigned long l;
425 unsigned char *p;
426 const char *s;
427 char tbuf[32];
428
429 if (buf_len <= 0) return(0);
430
431 if ((a == NULL) || (a->data == NULL)) {
432 buf[0]='\0';
433 return(0);
434 }
405 435
406 if ((buf=(unsigned char *)Malloc(i)) == NULL) 436 nid=OBJ_obj2nid(a);
407 return(NID_undef); 437 if ((nid == NID_undef) || no_name) {
408 a2d_ASN1_OBJECT(buf,i,s,-1); 438 len=a->length;
409 p=buf; 439 p=a->data;
410 op=d2i_ASN1_OBJECT(NULL,&p,i); 440
411 if (op == NULL) return(NID_undef); 441 idx=0;
412 ret=OBJ_obj2nid(op); 442 l=0;
413 ASN1_OBJECT_free(op); 443 while (idx < a->length) {
414 Free(buf); 444 l|=(p[idx]&0x7f);
445 if (!(p[idx] & 0x80)) break;
446 l<<=7L;
447 idx++;
448 }
449 idx++;
450 i=(int)(l/40);
451 if (i > 2) i=2;
452 l-=(long)(i*40);
453
454 sprintf(tbuf,"%d.%lu",i,l);
455 i=strlen(tbuf);
456 strncpy(buf,tbuf,buf_len);
457 buf_len-=i;
458 buf+=i;
459 n+=i;
460
461 l=0;
462 for (; idx<len; idx++) {
463 l|=p[idx]&0x7f;
464 if (!(p[idx] & 0x80)) {
465 sprintf(tbuf,".%lu",l);
466 i=strlen(tbuf);
467 if (buf_len > 0)
468 strncpy(buf,tbuf,buf_len);
469 buf_len-=i;
470 buf+=i;
471 n+=i;
472 l=0;
415 } 473 }
474 l<<=7L;
416 } 475 }
417 return(ret); 476 } else {
477 s=OBJ_nid2ln(nid);
478 if (s == NULL)
479 s=OBJ_nid2sn(nid);
480 strncpy(buf,s,buf_len);
481 n=strlen(s);
418 } 482 }
483 buf[buf_len-1]='\0';
484 return(n);
485}
419 486
420int OBJ_ln2nid(s) 487int OBJ_txt2nid(char *s)
421char *s; 488{
489 ASN1_OBJECT *obj;
490 int nid;
491 obj = OBJ_txt2obj(s, 0);
492 nid = OBJ_obj2nid(obj);
493 ASN1_OBJECT_free(obj);
494 return nid;
495}
496
497int OBJ_ln2nid(const char *s)
422 { 498 {
423 ASN1_OBJECT o,*oo= &o,**op; 499 ASN1_OBJECT o,*oo= &o,**op;
424 ADDED_OBJ ad,*adp; 500 ADDED_OBJ ad,*adp;
@@ -437,8 +513,7 @@ char *s;
437 return((*op)->nid); 513 return((*op)->nid);
438 } 514 }
439 515
440int OBJ_sn2nid(s) 516int OBJ_sn2nid(const char *s)
441char *s;
442 { 517 {
443 ASN1_OBJECT o,*oo= &o,**op; 518 ASN1_OBJECT o,*oo= &o,**op;
444 ADDED_OBJ ad,*adp; 519 ADDED_OBJ ad,*adp;
@@ -457,9 +532,7 @@ char *s;
457 return((*op)->nid); 532 return((*op)->nid);
458 } 533 }
459 534
460static int obj_cmp(ap, bp) 535static int obj_cmp(ASN1_OBJECT **ap, ASN1_OBJECT **bp)
461ASN1_OBJECT **ap;
462ASN1_OBJECT **bp;
463 { 536 {
464 int j; 537 int j;
465 ASN1_OBJECT *a= *ap; 538 ASN1_OBJECT *a= *ap;
@@ -470,12 +543,7 @@ ASN1_OBJECT **bp;
470 return(memcmp(a->data,b->data,a->length)); 543 return(memcmp(a->data,b->data,a->length));
471 } 544 }
472 545
473char *OBJ_bsearch(key,base,num,size,cmp) 546char *OBJ_bsearch(char *key, char *base, int num, int size, int (*cmp)())
474char *key;
475char *base;
476int num;
477int size;
478int (*cmp)();
479 { 547 {
480 int l,h,i,c; 548 int l,h,i,c;
481 char *p; 549 char *p;
@@ -495,14 +563,24 @@ int (*cmp)();
495 else 563 else
496 return(p); 564 return(p);
497 } 565 }
566#ifdef CHARSET_EBCDIC
567/* THIS IS A KLUDGE - Because the *_obj is sorted in ASCII order, and
568 * I don't have perl (yet), we revert to a *LINEAR* search
569 * when the object wasn't found in the binary search.
570 */
571 for (i=0; i<num; ++i) {
572 p= &(base[i*size]);
573 if ((*cmp)(key,p) == 0)
574 return p;
575 }
576#endif
498 return(NULL); 577 return(NULL);
499 } 578 }
500 579
501int OBJ_create_objects(in) 580int OBJ_create_objects(BIO *in)
502BIO *in;
503 { 581 {
504 MS_STATIC char buf[512]; 582 MS_STATIC char buf[512];
505 int i,num= -1; 583 int i,num=0;
506 char *o,*s,*l=NULL; 584 char *o,*s,*l=NULL;
507 585
508 for (;;) 586 for (;;)
@@ -511,26 +589,26 @@ BIO *in;
511 i=BIO_gets(in,buf,512); 589 i=BIO_gets(in,buf,512);
512 if (i <= 0) return(num); 590 if (i <= 0) return(num);
513 buf[i-1]='\0'; 591 buf[i-1]='\0';
514 if (!isalnum(buf[0])) return(num); 592 if (!isalnum((unsigned char)buf[0])) return(num);
515 o=s=buf; 593 o=s=buf;
516 while (isdigit(*s) || (*s == '.')) 594 while (isdigit((unsigned char)*s) || (*s == '.'))
517 s++; 595 s++;
518 if (*s != '\0') 596 if (*s != '\0')
519 { 597 {
520 *(s++)='\0'; 598 *(s++)='\0';
521 while (isspace(*s)) 599 while (isspace((unsigned char)*s))
522 s++; 600 s++;
523 if (*s == '\0') 601 if (*s == '\0')
524 s=NULL; 602 s=NULL;
525 else 603 else
526 { 604 {
527 l=s; 605 l=s;
528 while ((*l != '\0') && !isspace(*l)) 606 while ((*l != '\0') && !isspace((unsigned char)*l))
529 l++; 607 l++;
530 if (*l != '\0') 608 if (*l != '\0')
531 { 609 {
532 *(l++)='\0'; 610 *(l++)='\0';
533 while (isspace(*l)) 611 while (isspace((unsigned char)*l))
534 l++; 612 l++;
535 if (*l == '\0') l=NULL; 613 if (*l == '\0') l=NULL;
536 } 614 }
@@ -544,13 +622,10 @@ BIO *in;
544 if (!OBJ_create(o,s,l)) return(num); 622 if (!OBJ_create(o,s,l)) return(num);
545 num++; 623 num++;
546 } 624 }
547 return(num); 625 /* return(num); */
548 } 626 }
549 627
550int OBJ_create(oid,sn,ln) 628int OBJ_create(char *oid, char *sn, char *ln)
551char *oid;
552char *sn;
553char *ln;
554 { 629 {
555 int ok=0; 630 int ok=0;
556 ASN1_OBJECT *op=NULL; 631 ASN1_OBJECT *op=NULL;
diff --git a/src/lib/libcrypto/objects/obj_dat.h b/src/lib/libcrypto/objects/obj_dat.h
deleted file mode 100644
index 48143ae3c7..0000000000
--- a/src/lib/libcrypto/objects/obj_dat.h
+++ /dev/null
@@ -1,656 +0,0 @@
1/* lib/obj/obj_dat.h */
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
59/* THIS FILE IS GENERATED FROM Objects.h by obj_dat.pl via the
60 * following command:
61 * perl obj_dat.pl < objects.h > obj_dat.h
62 */
63
64#define NUM_NID 124
65#define NUM_SN 95
66#define NUM_LN 122
67#define NUM_OBJ 95
68
69static unsigned char lvalues[600]={
700x2A,0x86,0x48,0x86,0xF7,0x0D, /* [ 0] OBJ_rsadsi */
710x2A,0x86,0x48,0x86,0xF7,0x0D,0x01, /* [ 6] OBJ_pkcs */
720x2A,0x86,0x48,0x86,0xF7,0x0D,0x02,0x02, /* [ 13] OBJ_md2 */
730x2A,0x86,0x48,0x86,0xF7,0x0D,0x02,0x05, /* [ 21] OBJ_md5 */
740x2A,0x86,0x48,0x86,0xF7,0x0D,0x03,0x04, /* [ 29] OBJ_rc4 */
750x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x01,/* [ 37] OBJ_rsaEncryption */
760x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x02,/* [ 46] OBJ_md2WithRSAEncryption */
770x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x04,/* [ 55] OBJ_md5WithRSAEncryption */
780x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x05,0x01,/* [ 64] OBJ_pbeWithMD2AndDES_CBC */
790x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x05,0x03,/* [ 73] OBJ_pbeWithMD5AndDES_CBC */
800x55, /* [ 82] OBJ_X500 */
810x55,0x04, /* [ 83] OBJ_X509 */
820x55,0x04,0x03, /* [ 85] OBJ_commonName */
830x55,0x04,0x06, /* [ 88] OBJ_countryName */
840x55,0x04,0x07, /* [ 91] OBJ_localityName */
850x55,0x04,0x08, /* [ 94] OBJ_stateOrProvinceName */
860x55,0x04,0x0A, /* [ 97] OBJ_organizationName */
870x55,0x04,0x0B, /* [100] OBJ_organizationalUnitName */
880x55,0x08,0x01,0x01, /* [103] OBJ_rsa */
890x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x07, /* [107] OBJ_pkcs7 */
900x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x07,0x01,/* [115] OBJ_pkcs7_data */
910x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x07,0x02,/* [124] OBJ_pkcs7_signed */
920x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x07,0x03,/* [133] OBJ_pkcs7_enveloped */
930x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x07,0x04,/* [142] OBJ_pkcs7_signedAndEnveloped */
940x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x07,0x05,/* [151] OBJ_pkcs7_digest */
950x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x07,0x06,/* [160] OBJ_pkcs7_encrypted */
960x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x03, /* [169] OBJ_pkcs3 */
970x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x03,0x01,/* [177] OBJ_dhKeyAgreement */
980x2B,0x0E,0x03,0x02,0x06, /* [186] OBJ_des_ecb */
990x2B,0x0E,0x03,0x02,0x09, /* [191] OBJ_des_cfb64 */
1000x2B,0x0E,0x03,0x02,0x07, /* [196] OBJ_des_cbc */
1010x2B,0x0E,0x03,0x02,0x11, /* [201] OBJ_des_ede */
1020x2A,0x86,0x48,0x86,0xF7,0x0D,0x03,0x02, /* [206] OBJ_rc2_cbc */
1030x2B,0x0E,0x03,0x02,0x12, /* [214] OBJ_sha */
1040x2B,0x0E,0x03,0x02,0x0F, /* [219] OBJ_shaWithRSAEncryption */
1050x2A,0x86,0x48,0x86,0xF7,0x0D,0x03,0x07, /* [224] OBJ_des_ede3_cbc */
1060x2B,0x0E,0x03,0x02,0x08, /* [232] OBJ_des_ofb64 */
1070x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09, /* [237] OBJ_pkcs9 */
1080x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x01,/* [245] OBJ_pkcs9_emailAddress */
1090x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x02,/* [254] OBJ_pkcs9_unstructuredName */
1100x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x03,/* [263] OBJ_pkcs9_contentType */
1110x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x04,/* [272] OBJ_pkcs9_messageDigest */
1120x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x05,/* [281] OBJ_pkcs9_signingTime */
1130x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x06,/* [290] OBJ_pkcs9_countersignature */
1140x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x07,/* [299] OBJ_pkcs9_challengePassword */
1150x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x08,/* [308] OBJ_pkcs9_unstructuredAddress */
1160x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x09,0x09,/* [317] OBJ_pkcs9_extCertAttributes */
1170x60,0x86,0x48,0x01,0x86,0xF8,0x42, /* [326] OBJ_netscape */
1180x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01, /* [333] OBJ_netscape_cert_extension */
1190x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x02, /* [341] OBJ_netscape_data_type */
1200x2B,0x0E,0x03,0x02,0x1A, /* [349] OBJ_sha1 */
1210x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x01,0x05,/* [354] OBJ_sha1WithRSAEncryption */
1220x2B,0x0E,0x03,0x02,0x0D, /* [363] OBJ_dsaWithSHA */
1230x2B,0x0E,0x03,0x02,0x0C, /* [368] OBJ_dsa_2 */
1240x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x05,0x0B,/* [373] OBJ_pbeWithSHA1AndRC2_CBC */
1250x2A,0x86,0x48,0x86,0xF7,0x0D,0x01,0x05,0x0C,/* [382] OBJ_pbeWithSHA1AndRC4 */
1260x2B,0x0E,0x03,0x02,0x1B, /* [391] OBJ_dsaWithSHA1_2 */
1270x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x01,/* [396] OBJ_netscape_cert_type */
1280x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x02,/* [405] OBJ_netscape_base_url */
1290x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x03,/* [414] OBJ_netscape_revocation_url */
1300x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x04,/* [423] OBJ_netscape_ca_revocation_url */
1310x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x07,/* [432] OBJ_netscape_renewal_url */
1320x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x08,/* [441] OBJ_netscape_ca_policy_url */
1330x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x0C,/* [450] OBJ_netscape_ssl_server_name */
1340x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x01,0x0D,/* [459] OBJ_netscape_comment */
1350x60,0x86,0x48,0x01,0x86,0xF8,0x42,0x02,0x05,/* [468] OBJ_netscape_cert_sequence */
1360x55,0x1D, /* [477] OBJ_ld_ce */
1370x55,0x1D,0x0E, /* [479] OBJ_subject_key_identifier */
1380x55,0x1D,0x0F, /* [482] OBJ_key_usage */
1390x55,0x1D,0x10, /* [485] OBJ_private_key_usage_period */
1400x55,0x1D,0x11, /* [488] OBJ_subject_alt_name */
1410x55,0x1D,0x12, /* [491] OBJ_issuer_alt_name */
1420x55,0x1D,0x13, /* [494] OBJ_basic_constraints */
1430x55,0x1D,0x14, /* [497] OBJ_crl_number */
1440x55,0x1D,0x20, /* [500] OBJ_certificate_policies */
1450x55,0x1D,0x23, /* [503] OBJ_authority_key_identifier */
1460x55,0x08,0x03,0x65, /* [506] OBJ_mdc2 */
1470x55,0x08,0x03,0x64, /* [510] OBJ_mdc2WithRSA */
1480x55,0x04,0x2A, /* [514] OBJ_givenName */
1490x55,0x04,0x04, /* [517] OBJ_surname */
1500x55,0x04,0x2B, /* [520] OBJ_initials */
1510x55,0x04,0x2D, /* [523] OBJ_uniqueIdentifier */
1520x55,0x1D,0x1F, /* [526] OBJ_crl_distribution_points */
1530x2B,0x0E,0x03,0x02,0x03, /* [529] OBJ_md5WithRSA */
1540x55,0x04,0x05, /* [534] OBJ_serialNumber */
1550x55,0x04,0x0C, /* [537] OBJ_title */
1560x55,0x04,0x0D, /* [540] OBJ_description */
1570x2A,0x86,0x48,0x86,0xF6,0x7D,0x07,0x42,0x0A,/* [543] OBJ_cast5_cbc */
1580x2A,0x86,0x48,0x86,0xF6,0x7D,0x07,0x42,0x0C,/* [552] OBJ_pbeWithMD5AndCast5_CBC */
1590x2A,0x86,0x48,0xCE,0x38,0x04,0x03, /* [561] OBJ_dsaWithSHA1 */
1600x2B,0x0E,0x03,0x02,0x1D, /* [568] OBJ_sha1WithRSA */
1610x2A,0x86,0x48,0xCE,0x38,0x04,0x01, /* [573] OBJ_dsa */
1620x2B,0x24,0x03,0x02,0x01, /* [580] OBJ_ripemd160 */
1630x2B,0x24,0x03,0x03,0x01,0x02, /* [585] OBJ_ripemd160WithRSA */
1640x2A,0x86,0x48,0x86,0xF7,0x0D,0x03,0x08, /* [591] OBJ_rc5_cbc */
165};
166
167static ASN1_OBJECT nid_objs[NUM_NID]={
168{"UNDEF","undefined",NID_undef,0,NULL},
169{"rsadsi","rsadsi",NID_rsadsi,6,&(lvalues[0]),0},
170{"pkcs","pkcs",NID_pkcs,7,&(lvalues[6]),0},
171{"MD2","md2",NID_md2,8,&(lvalues[13]),0},
172{"MD5","md5",NID_md5,8,&(lvalues[21]),0},
173{"RC4","rc4",NID_rc4,8,&(lvalues[29]),0},
174{"rsaEncryption","rsaEncryption",NID_rsaEncryption,9,&(lvalues[37]),0},
175{"RSA-MD2","md2WithRSAEncryption",NID_md2WithRSAEncryption,9,
176 &(lvalues[46]),0},
177{"RSA-MD5","md5WithRSAEncryption",NID_md5WithRSAEncryption,9,
178 &(lvalues[55]),0},
179{"pbeWithMD2AndDES-CBC","pbeWithMD2AndDES-CBC",
180 NID_pbeWithMD2AndDES_CBC,9,&(lvalues[64]),0},
181{"pbeWithMD5AndDES-CBC","pbeWithMD5AndDES-CBC",
182 NID_pbeWithMD5AndDES_CBC,9,&(lvalues[73]),0},
183{"X500","X500",NID_X500,1,&(lvalues[82]),0},
184{"X509","X509",NID_X509,2,&(lvalues[83]),0},
185{"CN","commonName",NID_commonName,3,&(lvalues[85]),0},
186{"C","countryName",NID_countryName,3,&(lvalues[88]),0},
187{"L","localityName",NID_localityName,3,&(lvalues[91]),0},
188{"ST","stateOrProvinceName",NID_stateOrProvinceName,3,&(lvalues[94]),0},
189{"O","organizationName",NID_organizationName,3,&(lvalues[97]),0},
190{"OU","organizationalUnitName",NID_organizationalUnitName,3,
191 &(lvalues[100]),0},
192{"RSA","rsa",NID_rsa,4,&(lvalues[103]),0},
193{"pkcs7","pkcs7",NID_pkcs7,8,&(lvalues[107]),0},
194{"pkcs7-data","pkcs7-data",NID_pkcs7_data,9,&(lvalues[115]),0},
195{"pkcs7-signedData","pkcs7-signedData",NID_pkcs7_signed,9,
196 &(lvalues[124]),0},
197{"pkcs7-envelopedData","pkcs7-envelopedData",NID_pkcs7_enveloped,9,
198 &(lvalues[133]),0},
199{"pkcs7-signedAndEnvelopedData","pkcs7-signedAndEnvelopedData",
200 NID_pkcs7_signedAndEnveloped,9,&(lvalues[142]),0},
201{"pkcs7-digestData","pkcs7-digestData",NID_pkcs7_digest,9,
202 &(lvalues[151]),0},
203{"pkcs7-encryptedData","pkcs7-encryptedData",NID_pkcs7_encrypted,9,
204 &(lvalues[160]),0},
205{"pkcs3","pkcs3",NID_pkcs3,8,&(lvalues[169]),0},
206{"dhKeyAgreement","dhKeyAgreement",NID_dhKeyAgreement,9,
207 &(lvalues[177]),0},
208{"DES-ECB","des-ecb",NID_des_ecb,5,&(lvalues[186]),0},
209{"DES-CFB","des-cfb",NID_des_cfb64,5,&(lvalues[191]),0},
210{"DES-CBC","des-cbc",NID_des_cbc,5,&(lvalues[196]),0},
211{"DES-EDE","des-ede",NID_des_ede,5,&(lvalues[201]),0},
212{"DES-EDE3","des-ede3",NID_des_ede3,0,NULL},
213{"IDEA-CBC","idea-cbc",NID_idea_cbc,0,NULL},
214{"IDEA-CFB","idea-cfb",NID_idea_cfb64,0,NULL},
215{"IDEA-ECB","idea-ecb",NID_idea_ecb,0,NULL},
216{"RC2-CBC","rc2-cbc",NID_rc2_cbc,8,&(lvalues[206]),0},
217{"RC2-ECB","rc2-ecb",NID_rc2_ecb,0,NULL},
218{"RC2-CFB","rc2-cfb",NID_rc2_cfb64,0,NULL},
219{"RC2-OFB","rc2-ofb",NID_rc2_ofb64,0,NULL},
220{"SHA","sha",NID_sha,5,&(lvalues[214]),0},
221{"RSA-SHA","shaWithRSAEncryption",NID_shaWithRSAEncryption,5,
222 &(lvalues[219]),0},
223{"DES-EDE-CBC","des-ede-cbc",NID_des_ede_cbc,0,NULL},
224{"DES-EDE3-CBC","des-ede3-cbc",NID_des_ede3_cbc,8,&(lvalues[224]),0},
225{"DES-OFB","des-ofb",NID_des_ofb64,5,&(lvalues[232]),0},
226{"IDEA-OFB","idea-ofb",NID_idea_ofb64,0,NULL},
227{"pkcs9","pkcs9",NID_pkcs9,8,&(lvalues[237]),0},
228{"Email","emailAddress",NID_pkcs9_emailAddress,9,&(lvalues[245]),0},
229{"unstructuredName","unstructuredName",NID_pkcs9_unstructuredName,9,
230 &(lvalues[254]),0},
231{"contentType","contentType",NID_pkcs9_contentType,9,&(lvalues[263]),0},
232{"messageDigest","messageDigest",NID_pkcs9_messageDigest,9,
233 &(lvalues[272]),0},
234{"signingTime","signingTime",NID_pkcs9_signingTime,9,&(lvalues[281]),0},
235{"countersignature","countersignature",NID_pkcs9_countersignature,9,
236 &(lvalues[290]),0},
237{"challengePassword","challengePassword",NID_pkcs9_challengePassword,
238 9,&(lvalues[299]),0},
239{"unstructuredAddress","unstructuredAddress",
240 NID_pkcs9_unstructuredAddress,9,&(lvalues[308]),0},
241{"extendedCertificateAttributes","extendedCertificateAttributes",
242 NID_pkcs9_extCertAttributes,9,&(lvalues[317]),0},
243{"Netscape","Netscape Communications Corp.",NID_netscape,7,
244 &(lvalues[326]),0},
245{"nsCertExt","Netscape Certificate Extension",
246 NID_netscape_cert_extension,8,&(lvalues[333]),0},
247{"nsDataType","Netscape Data Type",NID_netscape_data_type,8,
248 &(lvalues[341]),0},
249{"DES-EDE-CFB","des-ede-cfb",NID_des_ede_cfb64,0,NULL},
250{"DES-EDE3-CFB","des-ede3-cfb",NID_des_ede3_cfb64,0,NULL},
251{"DES-EDE-OFB","des-ede-ofb",NID_des_ede_ofb64,0,NULL},
252{"DES-EDE3-OFB","des-ede3-ofb",NID_des_ede3_ofb64,0,NULL},
253{"SHA1","sha1",NID_sha1,5,&(lvalues[349]),0},
254{"RSA-SHA1","sha1WithRSAEncryption",NID_sha1WithRSAEncryption,9,
255 &(lvalues[354]),0},
256{"DSA-SHA","dsaWithSHA",NID_dsaWithSHA,5,&(lvalues[363]),0},
257{"DSA-old","dsaEncryption-old",NID_dsa_2,5,&(lvalues[368]),0},
258{"pbeWithSHA1AndRC2-CBC","pbeWithSHA1AndRC2-CBC",
259 NID_pbeWithSHA1AndRC2_CBC,9,&(lvalues[373]),0},
260{"pbeWithSHA1AndRC4","pbeWithSHA1AndRC4",NID_pbeWithSHA1AndRC4,9,
261 &(lvalues[382]),0},
262{"DSA-SHA1-old","dsaWithSHA1",NID_dsaWithSHA1_2,5,&(lvalues[391]),0},
263{"nsCertType","Netscape Cert Type",NID_netscape_cert_type,9,
264 &(lvalues[396]),0},
265{"nsBaseUrl","Netscape Base Url",NID_netscape_base_url,9,
266 &(lvalues[405]),0},
267{"nsRevocationUrl","Netscape Revocation Url",
268 NID_netscape_revocation_url,9,&(lvalues[414]),0},
269{"nsCaRevocationUrl","Netscape CA Revocation Url",
270 NID_netscape_ca_revocation_url,9,&(lvalues[423]),0},
271{"nsRenewalUrl","Netscape Renewal Url",NID_netscape_renewal_url,9,
272 &(lvalues[432]),0},
273{"nsCaPolicyUrl","Netscape CA Policy Url",NID_netscape_ca_policy_url,
274 9,&(lvalues[441]),0},
275{"nsSslServerName","Netscape SSL Server Name",
276 NID_netscape_ssl_server_name,9,&(lvalues[450]),0},
277{"nsComment","Netscape Comment",NID_netscape_comment,9,&(lvalues[459]),0},
278{"nsCertSequence","Netscape Certificate Sequence",
279 NID_netscape_cert_sequence,9,&(lvalues[468]),0},
280{"DESX-CBC","desx-cbc",NID_desx_cbc,0,NULL},
281{"ld-ce","ld-ce",NID_ld_ce,2,&(lvalues[477]),0},
282{"subjectKeyIdentifier","X509v3 Subject Key Identifier",
283 NID_subject_key_identifier,3,&(lvalues[479]),0},
284{"keyUsage","X509v3 Key Usage",NID_key_usage,3,&(lvalues[482]),0},
285{"privateKeyUsagePeriod","X509v3 Private Key Usage Period",
286 NID_private_key_usage_period,3,&(lvalues[485]),0},
287{"subjectAltName","X509v3 Subject Alternative Name",
288 NID_subject_alt_name,3,&(lvalues[488]),0},
289{"issuerAltName","X509v3 Issuer Alternative Name",NID_issuer_alt_name,
290 3,&(lvalues[491]),0},
291{"basicConstraints","X509v3 Basic Constraints",NID_basic_constraints,
292 3,&(lvalues[494]),0},
293{"crlNumber","X509v3 CRL Number",NID_crl_number,3,&(lvalues[497]),0},
294{"certificatePolicies","X509v3 Certificate Policies",
295 NID_certificate_policies,3,&(lvalues[500]),0},
296{"authorityKeyIdentifier","X509v3 Authority Key Identifier",
297 NID_authority_key_identifier,3,&(lvalues[503]),0},
298{"BF-CBC","bf-cbc",NID_bf_cbc,0,NULL},
299{"BF-ECB","bf-ecb",NID_bf_ecb,0,NULL},
300{"BF-CFB","bf-cfb",NID_bf_cfb64,0,NULL},
301{"BF-OFB","bf-ofb",NID_bf_ofb64,0,NULL},
302{"MDC2","mdc2",NID_mdc2,4,&(lvalues[506]),0},
303{"RSA-MDC2","mdc2withRSA",NID_mdc2WithRSA,4,&(lvalues[510]),0},
304{"RC4-40","rc4-40",NID_rc4_40,0,NULL},
305{"RC2-40-CBC","rc2-40-cbc",NID_rc2_40_cbc,0,NULL},
306{"G","givenName",NID_givenName,3,&(lvalues[514]),0},
307{"S","surname",NID_surname,3,&(lvalues[517]),0},
308{"I","initials",NID_initials,3,&(lvalues[520]),0},
309{"UID","uniqueIdentifier",NID_uniqueIdentifier,3,&(lvalues[523]),0},
310{"crlDistributionPoints","X509v3 CRL Distribution Points",
311 NID_crl_distribution_points,3,&(lvalues[526]),0},
312{"RSA-NP-MD5","md5WithRSA",NID_md5WithRSA,5,&(lvalues[529]),0},
313{"SN","serialNumber",NID_serialNumber,3,&(lvalues[534]),0},
314{"T","title",NID_title,3,&(lvalues[537]),0},
315{"D","description",NID_description,3,&(lvalues[540]),0},
316{"CAST5-CBC","cast5-cbc",NID_cast5_cbc,9,&(lvalues[543]),0},
317{"CAST5-ECB","cast5-ecb",NID_cast5_ecb,0,NULL},
318{"CAST5-CFB","cast5-cfb",NID_cast5_cfb64,0,NULL},
319{"CAST5-OFB","cast5-ofb",NID_cast5_ofb64,0,NULL},
320{"pbeWithMD5AndCast5CBC","pbeWithMD5AndCast5CBC",
321 NID_pbeWithMD5AndCast5_CBC,9,&(lvalues[552]),0},
322{"DSA-SHA1","dsaWithSHA1",NID_dsaWithSHA1,7,&(lvalues[561]),0},
323{"MD5-SHA1","md5-sha1",NID_md5_sha1,0,NULL},
324{"RSA-SHA1-2","sha1WithRSA",NID_sha1WithRSA,5,&(lvalues[568]),0},
325{"DSA","dsaEncryption",NID_dsa,7,&(lvalues[573]),0},
326{"RIPEMD160","ripemd160",NID_ripemd160,5,&(lvalues[580]),0},
327{NULL,NULL,NID_undef,0,NULL},
328{"RSA-RIPEMD160","ripemd160WithRSA",NID_ripemd160WithRSA,6,
329 &(lvalues[585]),0},
330{"RC5-CBC","rc5-cbc",NID_rc5_cbc,8,&(lvalues[591]),0},
331{"RC5-ECB","rc5-ecb",NID_rc5_ecb,0,NULL},
332{"RC5-CFB","rc5-cfb",NID_rc5_cfb64,0,NULL},
333{"RC5-OFB","rc5-ofb",NID_rc5_ofb64,0,NULL},
334};
335
336static ASN1_OBJECT *sn_objs[NUM_SN]={
337&(nid_objs[91]),/* "BF-CBC" */
338&(nid_objs[93]),/* "BF-CFB" */
339&(nid_objs[92]),/* "BF-ECB" */
340&(nid_objs[94]),/* "BF-OFB" */
341&(nid_objs[14]),/* "C" */
342&(nid_objs[108]),/* "CAST5-CBC" */
343&(nid_objs[110]),/* "CAST5-CFB" */
344&(nid_objs[109]),/* "CAST5-ECB" */
345&(nid_objs[111]),/* "CAST5-OFB" */
346&(nid_objs[13]),/* "CN" */
347&(nid_objs[107]),/* "D" */
348&(nid_objs[31]),/* "DES-CBC" */
349&(nid_objs[30]),/* "DES-CFB" */
350&(nid_objs[29]),/* "DES-ECB" */
351&(nid_objs[32]),/* "DES-EDE" */
352&(nid_objs[43]),/* "DES-EDE-CBC" */
353&(nid_objs[60]),/* "DES-EDE-CFB" */
354&(nid_objs[62]),/* "DES-EDE-OFB" */
355&(nid_objs[33]),/* "DES-EDE3" */
356&(nid_objs[44]),/* "DES-EDE3-CBC" */
357&(nid_objs[61]),/* "DES-EDE3-CFB" */
358&(nid_objs[63]),/* "DES-EDE3-OFB" */
359&(nid_objs[45]),/* "DES-OFB" */
360&(nid_objs[80]),/* "DESX-CBC" */
361&(nid_objs[116]),/* "DSA" */
362&(nid_objs[66]),/* "DSA-SHA" */
363&(nid_objs[113]),/* "DSA-SHA1" */
364&(nid_objs[70]),/* "DSA-SHA1-old" */
365&(nid_objs[67]),/* "DSA-old" */
366&(nid_objs[48]),/* "Email" */
367&(nid_objs[99]),/* "G" */
368&(nid_objs[101]),/* "I" */
369&(nid_objs[34]),/* "IDEA-CBC" */
370&(nid_objs[35]),/* "IDEA-CFB" */
371&(nid_objs[36]),/* "IDEA-ECB" */
372&(nid_objs[46]),/* "IDEA-OFB" */
373&(nid_objs[15]),/* "L" */
374&(nid_objs[ 3]),/* "MD2" */
375&(nid_objs[ 4]),/* "MD5" */
376&(nid_objs[114]),/* "MD5-SHA1" */
377&(nid_objs[95]),/* "MDC2" */
378&(nid_objs[57]),/* "Netscape" */
379&(nid_objs[17]),/* "O" */
380&(nid_objs[18]),/* "OU" */
381&(nid_objs[98]),/* "RC2-40-CBC" */
382&(nid_objs[37]),/* "RC2-CBC" */
383&(nid_objs[39]),/* "RC2-CFB" */
384&(nid_objs[38]),/* "RC2-ECB" */
385&(nid_objs[40]),/* "RC2-OFB" */
386&(nid_objs[ 5]),/* "RC4" */
387&(nid_objs[97]),/* "RC4-40" */
388&(nid_objs[120]),/* "RC5-CBC" */
389&(nid_objs[122]),/* "RC5-CFB" */
390&(nid_objs[121]),/* "RC5-ECB" */
391&(nid_objs[123]),/* "RC5-OFB" */
392&(nid_objs[117]),/* "RIPEMD160" */
393&(nid_objs[19]),/* "RSA" */
394&(nid_objs[ 7]),/* "RSA-MD2" */
395&(nid_objs[ 8]),/* "RSA-MD5" */
396&(nid_objs[96]),/* "RSA-MDC2" */
397&(nid_objs[104]),/* "RSA-NP-MD5" */
398&(nid_objs[119]),/* "RSA-RIPEMD160" */
399&(nid_objs[42]),/* "RSA-SHA" */
400&(nid_objs[65]),/* "RSA-SHA1" */
401&(nid_objs[115]),/* "RSA-SHA1-2" */
402&(nid_objs[100]),/* "S" */
403&(nid_objs[41]),/* "SHA" */
404&(nid_objs[64]),/* "SHA1" */
405&(nid_objs[105]),/* "SN" */
406&(nid_objs[16]),/* "ST" */
407&(nid_objs[106]),/* "T" */
408&(nid_objs[102]),/* "UID" */
409&(nid_objs[ 0]),/* "UNDEF" */
410&(nid_objs[90]),/* "authorityKeyIdentifier" */
411&(nid_objs[87]),/* "basicConstraints" */
412&(nid_objs[89]),/* "certificatePolicies" */
413&(nid_objs[103]),/* "crlDistributionPoints" */
414&(nid_objs[88]),/* "crlNumber" */
415&(nid_objs[86]),/* "issuerAltName" */
416&(nid_objs[83]),/* "keyUsage" */
417&(nid_objs[81]),/* "ld-ce" */
418&(nid_objs[72]),/* "nsBaseUrl" */
419&(nid_objs[76]),/* "nsCaPolicyUrl" */
420&(nid_objs[74]),/* "nsCaRevocationUrl" */
421&(nid_objs[58]),/* "nsCertExt" */
422&(nid_objs[79]),/* "nsCertSequence" */
423&(nid_objs[71]),/* "nsCertType" */
424&(nid_objs[78]),/* "nsComment" */
425&(nid_objs[59]),/* "nsDataType" */
426&(nid_objs[75]),/* "nsRenewalUrl" */
427&(nid_objs[73]),/* "nsRevocationUrl" */
428&(nid_objs[77]),/* "nsSslServerName" */
429&(nid_objs[84]),/* "privateKeyUsagePeriod" */
430&(nid_objs[85]),/* "subjectAltName" */
431&(nid_objs[82]),/* "subjectKeyIdentifier" */
432};
433
434static ASN1_OBJECT *ln_objs[NUM_LN]={
435&(nid_objs[72]),/* "Netscape Base Url" */
436&(nid_objs[76]),/* "Netscape CA Policy Url" */
437&(nid_objs[74]),/* "Netscape CA Revocation Url" */
438&(nid_objs[71]),/* "Netscape Cert Type" */
439&(nid_objs[58]),/* "Netscape Certificate Extension" */
440&(nid_objs[79]),/* "Netscape Certificate Sequence" */
441&(nid_objs[78]),/* "Netscape Comment" */
442&(nid_objs[57]),/* "Netscape Communications Corp." */
443&(nid_objs[59]),/* "Netscape Data Type" */
444&(nid_objs[75]),/* "Netscape Renewal Url" */
445&(nid_objs[73]),/* "Netscape Revocation Url" */
446&(nid_objs[77]),/* "Netscape SSL Server Name" */
447&(nid_objs[11]),/* "X500" */
448&(nid_objs[12]),/* "X509" */
449&(nid_objs[90]),/* "X509v3 Authority Key Identifier" */
450&(nid_objs[87]),/* "X509v3 Basic Constraints" */
451&(nid_objs[103]),/* "X509v3 CRL Distribution Points" */
452&(nid_objs[88]),/* "X509v3 CRL Number" */
453&(nid_objs[89]),/* "X509v3 Certificate Policies" */
454&(nid_objs[86]),/* "X509v3 Issuer Alternative Name" */
455&(nid_objs[83]),/* "X509v3 Key Usage" */
456&(nid_objs[84]),/* "X509v3 Private Key Usage Period" */
457&(nid_objs[85]),/* "X509v3 Subject Alternative Name" */
458&(nid_objs[82]),/* "X509v3 Subject Key Identifier" */
459&(nid_objs[91]),/* "bf-cbc" */
460&(nid_objs[93]),/* "bf-cfb" */
461&(nid_objs[92]),/* "bf-ecb" */
462&(nid_objs[94]),/* "bf-ofb" */
463&(nid_objs[108]),/* "cast5-cbc" */
464&(nid_objs[110]),/* "cast5-cfb" */
465&(nid_objs[109]),/* "cast5-ecb" */
466&(nid_objs[111]),/* "cast5-ofb" */
467&(nid_objs[54]),/* "challengePassword" */
468&(nid_objs[13]),/* "commonName" */
469&(nid_objs[50]),/* "contentType" */
470&(nid_objs[53]),/* "countersignature" */
471&(nid_objs[14]),/* "countryName" */
472&(nid_objs[31]),/* "des-cbc" */
473&(nid_objs[30]),/* "des-cfb" */
474&(nid_objs[29]),/* "des-ecb" */
475&(nid_objs[32]),/* "des-ede" */
476&(nid_objs[43]),/* "des-ede-cbc" */
477&(nid_objs[60]),/* "des-ede-cfb" */
478&(nid_objs[62]),/* "des-ede-ofb" */
479&(nid_objs[33]),/* "des-ede3" */
480&(nid_objs[44]),/* "des-ede3-cbc" */
481&(nid_objs[61]),/* "des-ede3-cfb" */
482&(nid_objs[63]),/* "des-ede3-ofb" */
483&(nid_objs[45]),/* "des-ofb" */
484&(nid_objs[107]),/* "description" */
485&(nid_objs[80]),/* "desx-cbc" */
486&(nid_objs[28]),/* "dhKeyAgreement" */
487&(nid_objs[116]),/* "dsaEncryption" */
488&(nid_objs[67]),/* "dsaEncryption-old" */
489&(nid_objs[66]),/* "dsaWithSHA" */
490&(nid_objs[113]),/* "dsaWithSHA1" */
491&(nid_objs[70]),/* "dsaWithSHA1" */
492&(nid_objs[48]),/* "emailAddress" */
493&(nid_objs[56]),/* "extendedCertificateAttributes" */
494&(nid_objs[99]),/* "givenName" */
495&(nid_objs[34]),/* "idea-cbc" */
496&(nid_objs[35]),/* "idea-cfb" */
497&(nid_objs[36]),/* "idea-ecb" */
498&(nid_objs[46]),/* "idea-ofb" */
499&(nid_objs[101]),/* "initials" */
500&(nid_objs[15]),/* "localityName" */
501&(nid_objs[ 3]),/* "md2" */
502&(nid_objs[ 7]),/* "md2WithRSAEncryption" */
503&(nid_objs[ 4]),/* "md5" */
504&(nid_objs[114]),/* "md5-sha1" */
505&(nid_objs[104]),/* "md5WithRSA" */
506&(nid_objs[ 8]),/* "md5WithRSAEncryption" */
507&(nid_objs[95]),/* "mdc2" */
508&(nid_objs[96]),/* "mdc2withRSA" */
509&(nid_objs[51]),/* "messageDigest" */
510&(nid_objs[17]),/* "organizationName" */
511&(nid_objs[18]),/* "organizationalUnitName" */
512&(nid_objs[ 9]),/* "pbeWithMD2AndDES-CBC" */
513&(nid_objs[112]),/* "pbeWithMD5AndCast5CBC" */
514&(nid_objs[10]),/* "pbeWithMD5AndDES-CBC" */
515&(nid_objs[68]),/* "pbeWithSHA1AndRC2-CBC" */
516&(nid_objs[69]),/* "pbeWithSHA1AndRC4" */
517&(nid_objs[ 2]),/* "pkcs" */
518&(nid_objs[27]),/* "pkcs3" */
519&(nid_objs[20]),/* "pkcs7" */
520&(nid_objs[21]),/* "pkcs7-data" */
521&(nid_objs[25]),/* "pkcs7-digestData" */
522&(nid_objs[26]),/* "pkcs7-encryptedData" */
523&(nid_objs[23]),/* "pkcs7-envelopedData" */
524&(nid_objs[24]),/* "pkcs7-signedAndEnvelopedData" */
525&(nid_objs[22]),/* "pkcs7-signedData" */
526&(nid_objs[47]),/* "pkcs9" */
527&(nid_objs[98]),/* "rc2-40-cbc" */
528&(nid_objs[37]),/* "rc2-cbc" */
529&(nid_objs[39]),/* "rc2-cfb" */
530&(nid_objs[38]),/* "rc2-ecb" */
531&(nid_objs[40]),/* "rc2-ofb" */
532&(nid_objs[ 5]),/* "rc4" */
533&(nid_objs[97]),/* "rc4-40" */
534&(nid_objs[120]),/* "rc5-cbc" */
535&(nid_objs[122]),/* "rc5-cfb" */
536&(nid_objs[121]),/* "rc5-ecb" */
537&(nid_objs[123]),/* "rc5-ofb" */
538&(nid_objs[117]),/* "ripemd160" */
539&(nid_objs[119]),/* "ripemd160WithRSA" */
540&(nid_objs[19]),/* "rsa" */
541&(nid_objs[ 6]),/* "rsaEncryption" */
542&(nid_objs[ 1]),/* "rsadsi" */
543&(nid_objs[105]),/* "serialNumber" */
544&(nid_objs[41]),/* "sha" */
545&(nid_objs[64]),/* "sha1" */
546&(nid_objs[115]),/* "sha1WithRSA" */
547&(nid_objs[65]),/* "sha1WithRSAEncryption" */
548&(nid_objs[42]),/* "shaWithRSAEncryption" */
549&(nid_objs[52]),/* "signingTime" */
550&(nid_objs[16]),/* "stateOrProvinceName" */
551&(nid_objs[100]),/* "surname" */
552&(nid_objs[106]),/* "title" */
553&(nid_objs[ 0]),/* "undefined" */
554&(nid_objs[102]),/* "uniqueIdentifier" */
555&(nid_objs[55]),/* "unstructuredAddress" */
556&(nid_objs[49]),/* "unstructuredName" */
557};
558
559static ASN1_OBJECT *obj_objs[NUM_OBJ]={
560&(nid_objs[11]),/* OBJ_X500 2 5 */
561&(nid_objs[12]),/* OBJ_X509 2 5 4 */
562&(nid_objs[81]),/* OBJ_ld_ce 2 5 29 */
563&(nid_objs[13]),/* OBJ_commonName 2 5 4 3 */
564&(nid_objs[100]),/* OBJ_surname 2 5 4 4 */
565&(nid_objs[105]),/* OBJ_serialNumber 2 5 4 5 */
566&(nid_objs[14]),/* OBJ_countryName 2 5 4 6 */
567&(nid_objs[15]),/* OBJ_localityName 2 5 4 7 */
568&(nid_objs[16]),/* OBJ_stateOrProvinceName 2 5 4 8 */
569&(nid_objs[17]),/* OBJ_organizationName 2 5 4 10 */
570&(nid_objs[18]),/* OBJ_organizationalUnitName 2 5 4 11 */
571&(nid_objs[106]),/* OBJ_title 2 5 4 12 */
572&(nid_objs[107]),/* OBJ_description 2 5 4 13 */
573&(nid_objs[99]),/* OBJ_givenName 2 5 4 42 */
574&(nid_objs[101]),/* OBJ_initials 2 5 4 43 */
575&(nid_objs[102]),/* OBJ_uniqueIdentifier 2 5 4 45 */
576&(nid_objs[82]),/* OBJ_subject_key_identifier 2 5 29 14 */
577&(nid_objs[83]),/* OBJ_key_usage 2 5 29 15 */
578&(nid_objs[84]),/* OBJ_private_key_usage_period 2 5 29 16 */
579&(nid_objs[85]),/* OBJ_subject_alt_name 2 5 29 17 */
580&(nid_objs[86]),/* OBJ_issuer_alt_name 2 5 29 18 */
581&(nid_objs[87]),/* OBJ_basic_constraints 2 5 29 19 */
582&(nid_objs[88]),/* OBJ_crl_number 2 5 29 20 */
583&(nid_objs[103]),/* OBJ_crl_distribution_points 2 5 29 31 */
584&(nid_objs[89]),/* OBJ_certificate_policies 2 5 29 32 */
585&(nid_objs[90]),/* OBJ_authority_key_identifier 2 5 29 35 */
586&(nid_objs[19]),/* OBJ_rsa 2 5 8 1 1 */
587&(nid_objs[96]),/* OBJ_mdc2WithRSA 2 5 8 3 100 */
588&(nid_objs[95]),/* OBJ_mdc2 2 5 8 3 101 */
589&(nid_objs[104]),/* OBJ_md5WithRSA 1 3 14 3 2 3 */
590&(nid_objs[29]),/* OBJ_des_ecb 1 3 14 3 2 6 */
591&(nid_objs[31]),/* OBJ_des_cbc 1 3 14 3 2 7 */
592&(nid_objs[45]),/* OBJ_des_ofb64 1 3 14 3 2 8 */
593&(nid_objs[30]),/* OBJ_des_cfb64 1 3 14 3 2 9 */
594&(nid_objs[67]),/* OBJ_dsa_2 1 3 14 3 2 12 */
595&(nid_objs[66]),/* OBJ_dsaWithSHA 1 3 14 3 2 13 */
596&(nid_objs[42]),/* OBJ_shaWithRSAEncryption 1 3 14 3 2 15 */
597&(nid_objs[32]),/* OBJ_des_ede 1 3 14 3 2 17 */
598&(nid_objs[41]),/* OBJ_sha 1 3 14 3 2 18 */
599&(nid_objs[64]),/* OBJ_sha1 1 3 14 3 2 26 */
600&(nid_objs[70]),/* OBJ_dsaWithSHA1_2 1 3 14 3 2 27 */
601&(nid_objs[115]),/* OBJ_sha1WithRSA 1 3 14 3 2 29 */
602&(nid_objs[117]),/* OBJ_ripemd160 1 3 36 3 2 1 */
603&(nid_objs[ 1]),/* OBJ_rsadsi 1 2 840 113549 */
604&(nid_objs[119]),/* OBJ_ripemd160WithRSA 1 3 36 3 3 1 2 */
605&(nid_objs[ 2]),/* OBJ_pkcs 1 2 840 113549 1 */
606&(nid_objs[116]),/* OBJ_dsa 1 2 840 10040 4 1 */
607&(nid_objs[113]),/* OBJ_dsaWithSHA1 1 2 840 10040 4 3 */
608&(nid_objs[57]),/* OBJ_netscape 2 16 840 1 113730 */
609&(nid_objs[27]),/* OBJ_pkcs3 1 2 840 113549 1 3 */
610&(nid_objs[20]),/* OBJ_pkcs7 1 2 840 113549 1 7 */
611&(nid_objs[47]),/* OBJ_pkcs9 1 2 840 113549 1 9 */
612&(nid_objs[ 3]),/* OBJ_md2 1 2 840 113549 2 2 */
613&(nid_objs[ 4]),/* OBJ_md5 1 2 840 113549 2 5 */
614&(nid_objs[37]),/* OBJ_rc2_cbc 1 2 840 113549 3 2 */
615&(nid_objs[ 5]),/* OBJ_rc4 1 2 840 113549 3 4 */
616&(nid_objs[44]),/* OBJ_des_ede3_cbc 1 2 840 113549 3 7 */
617&(nid_objs[120]),/* OBJ_rc5_cbc 1 2 840 113549 3 8 */
618&(nid_objs[58]),/* OBJ_netscape_cert_extension 2 16 840 1 113730 1 */
619&(nid_objs[59]),/* OBJ_netscape_data_type 2 16 840 1 113730 2 */
620&(nid_objs[108]),/* OBJ_cast5_cbc 1 2 840 113533 7 66 10 */
621&(nid_objs[112]),/* OBJ_pbeWithMD5AndCast5_CBC 1 2 840 113533 7 66 12 */
622&(nid_objs[ 6]),/* OBJ_rsaEncryption 1 2 840 113549 1 1 1 */
623&(nid_objs[ 7]),/* OBJ_md2WithRSAEncryption 1 2 840 113549 1 1 2 */
624&(nid_objs[ 8]),/* OBJ_md5WithRSAEncryption 1 2 840 113549 1 1 4 */
625&(nid_objs[65]),/* OBJ_sha1WithRSAEncryption 1 2 840 113549 1 1 5 */
626&(nid_objs[28]),/* OBJ_dhKeyAgreement 1 2 840 113549 1 3 1 */
627&(nid_objs[ 9]),/* OBJ_pbeWithMD2AndDES_CBC 1 2 840 113549 1 5 1 */
628&(nid_objs[10]),/* OBJ_pbeWithMD5AndDES_CBC 1 2 840 113549 1 5 3 */
629&(nid_objs[68]),/* OBJ_pbeWithSHA1AndRC2_CBC 1 2 840 113549 1 5 11 */
630&(nid_objs[69]),/* OBJ_pbeWithSHA1AndRC4 1 2 840 113549 1 5 12 */
631&(nid_objs[21]),/* OBJ_pkcs7_data 1 2 840 113549 1 7 1 */
632&(nid_objs[22]),/* OBJ_pkcs7_signed 1 2 840 113549 1 7 2 */
633&(nid_objs[23]),/* OBJ_pkcs7_enveloped 1 2 840 113549 1 7 3 */
634&(nid_objs[24]),/* OBJ_pkcs7_signedAndEnveloped 1 2 840 113549 1 7 4 */
635&(nid_objs[25]),/* OBJ_pkcs7_digest 1 2 840 113549 1 7 5 */
636&(nid_objs[26]),/* OBJ_pkcs7_encrypted 1 2 840 113549 1 7 6 */
637&(nid_objs[48]),/* OBJ_pkcs9_emailAddress 1 2 840 113549 1 9 1 */
638&(nid_objs[49]),/* OBJ_pkcs9_unstructuredName 1 2 840 113549 1 9 2 */
639&(nid_objs[50]),/* OBJ_pkcs9_contentType 1 2 840 113549 1 9 3 */
640&(nid_objs[51]),/* OBJ_pkcs9_messageDigest 1 2 840 113549 1 9 4 */
641&(nid_objs[52]),/* OBJ_pkcs9_signingTime 1 2 840 113549 1 9 5 */
642&(nid_objs[53]),/* OBJ_pkcs9_countersignature 1 2 840 113549 1 9 6 */
643&(nid_objs[54]),/* OBJ_pkcs9_challengePassword 1 2 840 113549 1 9 7 */
644&(nid_objs[55]),/* OBJ_pkcs9_unstructuredAddress 1 2 840 113549 1 9 8 */
645&(nid_objs[56]),/* OBJ_pkcs9_extCertAttributes 1 2 840 113549 1 9 9 */
646&(nid_objs[71]),/* OBJ_netscape_cert_type 2 16 840 1 113730 1 1 */
647&(nid_objs[72]),/* OBJ_netscape_base_url 2 16 840 1 113730 1 2 */
648&(nid_objs[73]),/* OBJ_netscape_revocation_url 2 16 840 1 113730 1 3 */
649&(nid_objs[74]),/* OBJ_netscape_ca_revocation_url 2 16 840 1 113730 1 4 */
650&(nid_objs[75]),/* OBJ_netscape_renewal_url 2 16 840 1 113730 1 7 */
651&(nid_objs[76]),/* OBJ_netscape_ca_policy_url 2 16 840 1 113730 1 8 */
652&(nid_objs[77]),/* OBJ_netscape_ssl_server_name 2 16 840 1 113730 1 12 */
653&(nid_objs[78]),/* OBJ_netscape_comment 2 16 840 1 113730 1 13 */
654&(nid_objs[79]),/* OBJ_netscape_cert_sequence 2 16 840 1 113730 2 5 */
655};
656
diff --git a/src/lib/libcrypto/objects/obj_dat.pl b/src/lib/libcrypto/objects/obj_dat.pl
index 4e7879d3f3..5043daef2a 100644
--- a/src/lib/libcrypto/objects/obj_dat.pl
+++ b/src/lib/libcrypto/objects/obj_dat.pl
@@ -1,4 +1,4 @@
1#!/usr/bin/perl 1#!/usr/local/bin/perl
2 2
3sub obj_cmp 3sub obj_cmp
4 { 4 {
@@ -252,7 +252,7 @@ sub der_it
252 $ret.=pack("C*",$a[0]*40+$a[1]); 252 $ret.=pack("C*",$a[0]*40+$a[1]);
253 shift @a; 253 shift @a;
254 shift @a; 254 shift @a;
255 while ($_=shift(@a)) 255 foreach (@a)
256 { 256 {
257 @r=(); 257 @r=();
258 $t=0; 258 $t=0;
diff --git a/src/lib/libcrypto/objects/obj_err.c b/src/lib/libcrypto/objects/obj_err.c
index 45206c616c..cef401db27 100644
--- a/src/lib/libcrypto/objects/obj_err.c
+++ b/src/lib/libcrypto/objects/obj_err.c
@@ -1,63 +1,65 @@
1/* lib/obj/obj_err.c */ 1/* crypto/objects/obj_err.c */
2/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) 2/* ====================================================================
3 * All rights reserved. 3 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
4 * 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 5 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
25 * are met: 7 * are met:
26 * 1. Redistributions of source code must retain the copyright 8 *
27 * notice, this list of conditions and the following disclaimer. 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 *
28 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in
30 * documentation and/or other materials provided with the distribution. 14 * the documentation and/or other materials provided with the
31 * 3. All advertising materials mentioning features or use of this software 15 * distribution.
32 * must display the following acknowledgement: 16 *
33 * "This product includes cryptographic software written by 17 * 3. All advertising materials mentioning features or use of this
34 * Eric Young (eay@cryptsoft.com)" 18 * software must display the following acknowledgment:
35 * The word 'cryptographic' can be left out if the rouines from the library 19 * "This product includes software developed by the OpenSSL Project
36 * being used are not cryptographic related :-). 20 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
37 * 4. If you include any Windows specific code (or a derivative thereof) from 21 *
38 * the apps directory (application code) you must include an acknowledgement: 22 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 23 * endorse or promote products derived from this software without
40 * 24 * prior written permission. For written permission, please contact
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 25 * openssl-core@OpenSSL.org.
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 *
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 * 5. Products derived from this software may not be called "OpenSSL"
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 28 * nor may "OpenSSL" appear in their names without prior written
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * permission of the OpenSSL Project.
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 *
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * 6. Redistributions of any form whatsoever must retain the following
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * acknowledgment:
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * "This product includes software developed by the OpenSSL Project
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
51 * SUCH DAMAGE. 35 *
52 * 36 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
53 * The licence and distribution terms for any publically available version or 37 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54 * derivative of this code cannot be changed. i.e. this code cannot simply be 38 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
55 * copied and put under another distribution licence 39 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
56 * [including the GNU Public Licence.] 40 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
42 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
43 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
44 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
45 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
46 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
47 * OF THE POSSIBILITY OF SUCH DAMAGE.
48 * ====================================================================
49 *
50 * This product includes cryptographic software written by Eric Young
51 * (eay@cryptsoft.com). This product includes software written by Tim
52 * Hudson (tjh@cryptsoft.com).
53 *
57 */ 54 */
55
56/* NOTE: this file was auto generated by the mkerr.pl script: any changes
57 * made to it will be overwritten when the script next updates this file.
58 */
59
58#include <stdio.h> 60#include <stdio.h>
59#include "err.h" 61#include <openssl/err.h>
60#include "objects.h" 62#include <openssl/objects.h>
61 63
62/* BEGIN ERROR CODES */ 64/* BEGIN ERROR CODES */
63#ifndef NO_ERR 65#ifndef NO_ERR
@@ -68,24 +70,24 @@ static ERR_STRING_DATA OBJ_str_functs[]=
68{ERR_PACK(0,OBJ_F_OBJ_NID2LN,0), "OBJ_nid2ln"}, 70{ERR_PACK(0,OBJ_F_OBJ_NID2LN,0), "OBJ_nid2ln"},
69{ERR_PACK(0,OBJ_F_OBJ_NID2OBJ,0), "OBJ_nid2obj"}, 71{ERR_PACK(0,OBJ_F_OBJ_NID2OBJ,0), "OBJ_nid2obj"},
70{ERR_PACK(0,OBJ_F_OBJ_NID2SN,0), "OBJ_nid2sn"}, 72{ERR_PACK(0,OBJ_F_OBJ_NID2SN,0), "OBJ_nid2sn"},
71{0,NULL}, 73{0,NULL}
72 }; 74 };
73 75
74static ERR_STRING_DATA OBJ_str_reasons[]= 76static ERR_STRING_DATA OBJ_str_reasons[]=
75 { 77 {
76{OBJ_R_MALLOC_FAILURE ,"malloc failure"}, 78{OBJ_R_MALLOC_FAILURE ,"malloc failure"},
77{OBJ_R_UNKNOWN_NID ,"unknown nid"}, 79{OBJ_R_UNKNOWN_NID ,"unknown nid"},
78{0,NULL}, 80{0,NULL}
79 }; 81 };
80 82
81#endif 83#endif
82 84
83void ERR_load_OBJ_strings() 85void ERR_load_OBJ_strings(void)
84 { 86 {
85 static int init=1; 87 static int init=1;
86 88
87 if (init); 89 if (init)
88 {; 90 {
89 init=0; 91 init=0;
90#ifndef NO_ERR 92#ifndef NO_ERR
91 ERR_load_strings(ERR_LIB_OBJ,OBJ_str_functs); 93 ERR_load_strings(ERR_LIB_OBJ,OBJ_str_functs);
diff --git a/src/lib/libcrypto/objects/obj_lib.c b/src/lib/libcrypto/objects/obj_lib.c
index 0a9c756197..1a1ba0fc06 100644
--- a/src/lib/libcrypto/objects/obj_lib.c
+++ b/src/lib/libcrypto/objects/obj_lib.c
@@ -58,27 +58,27 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "lhash.h" 61#include <openssl/lhash.h>
62#include "objects.h" 62#include <openssl/objects.h>
63#include "buffer.h" 63#include <openssl/buffer.h>
64 64
65ASN1_OBJECT *OBJ_dup(o) 65ASN1_OBJECT *OBJ_dup(ASN1_OBJECT *o)
66ASN1_OBJECT *o;
67 { 66 {
68 ASN1_OBJECT *r; 67 ASN1_OBJECT *r;
69 int i; 68 int i;
69 char *ln=NULL;
70 70
71 if (o == NULL) return(NULL); 71 if (o == NULL) return(NULL);
72 if (!(o->flags & ASN1_OBJECT_FLAG_DYNAMIC)) 72 if (!(o->flags & ASN1_OBJECT_FLAG_DYNAMIC))
73 return(o); 73 return(o);
74 74
75 r=(ASN1_OBJECT *)ASN1_OBJECT_new(); 75 r=ASN1_OBJECT_new();
76 if (r == NULL) 76 if (r == NULL)
77 { 77 {
78 OBJerr(OBJ_F_OBJ_DUP,ERR_R_ASN1_LIB); 78 OBJerr(OBJ_F_OBJ_DUP,ERR_R_ASN1_LIB);
79 return(NULL); 79 return(NULL);
80 } 80 }
81 r->data=(unsigned char *)Malloc(o->length); 81 r->data=Malloc(o->length);
82 if (r->data == NULL) 82 if (r->data == NULL)
83 goto err; 83 goto err;
84 memcpy(r->data,o->data,o->length); 84 memcpy(r->data,o->data,o->length);
@@ -88,35 +88,35 @@ ASN1_OBJECT *o;
88 if (o->ln != NULL) 88 if (o->ln != NULL)
89 { 89 {
90 i=strlen(o->ln)+1; 90 i=strlen(o->ln)+1;
91 r->ln=(char *)Malloc(i); 91 r->ln=ln=Malloc(i);
92 if (r->ln == NULL) goto err; 92 if (r->ln == NULL) goto err;
93 memcpy(r->ln,o->ln,i); 93 memcpy(ln,o->ln,i);
94 } 94 }
95 95
96 if (o->sn != NULL) 96 if (o->sn != NULL)
97 { 97 {
98 char *s;
99
98 i=strlen(o->sn)+1; 100 i=strlen(o->sn)+1;
99 r->sn=(char *)Malloc(i); 101 r->sn=s=Malloc(i);
100 if (r->sn == NULL) goto err; 102 if (r->sn == NULL) goto err;
101 memcpy(r->sn,o->sn,i); 103 memcpy(s,o->sn,i);
102 } 104 }
103 r->flags=o->flags|(ASN1_OBJECT_FLAG_DYNAMIC| 105 r->flags=o->flags|(ASN1_OBJECT_FLAG_DYNAMIC|
104 ASN1_OBJECT_FLAG_DYNAMIC_STRINGS); 106 ASN1_OBJECT_FLAG_DYNAMIC_STRINGS|ASN1_OBJECT_FLAG_DYNAMIC_DATA);
105 return(r); 107 return(r);
106err: 108err:
107 OBJerr(OBJ_F_OBJ_DUP,ERR_R_MALLOC_FAILURE); 109 OBJerr(OBJ_F_OBJ_DUP,ERR_R_MALLOC_FAILURE);
108 if (r != NULL) 110 if (r != NULL)
109 { 111 {
110 if (r->ln != NULL) Free(r->ln); 112 if (ln != NULL) Free(ln);
111 if (r->data != NULL) Free(r->data); 113 if (r->data != NULL) Free(r->data);
112 Free(r); 114 Free(r);
113 } 115 }
114 return(NULL); 116 return(NULL);
115 } 117 }
116 118
117int OBJ_cmp(a,b) 119int OBJ_cmp(ASN1_OBJECT *a, ASN1_OBJECT *b)
118ASN1_OBJECT *a;
119ASN1_OBJECT *b;
120 { 120 {
121 int ret; 121 int ret;
122 122
diff --git a/src/lib/libcrypto/objects/objects.err b/src/lib/libcrypto/objects/objects.err
deleted file mode 100644
index 8bec3eaea2..0000000000
--- a/src/lib/libcrypto/objects/objects.err
+++ /dev/null
@@ -1,12 +0,0 @@
1/* Error codes for the OBJ functions. */
2
3/* Function codes. */
4#define OBJ_F_OBJ_CREATE 100
5#define OBJ_F_OBJ_DUP 101
6#define OBJ_F_OBJ_NID2LN 102
7#define OBJ_F_OBJ_NID2OBJ 103
8#define OBJ_F_OBJ_NID2SN 104
9
10/* Reason codes. */
11#define OBJ_R_MALLOC_FAILURE 100
12#define OBJ_R_UNKNOWN_NID 101
diff --git a/src/lib/libcrypto/objects/objects.h b/src/lib/libcrypto/objects/objects.h
index e1d555b47c..d03748e022 100644
--- a/src/lib/libcrypto/objects/objects.h
+++ b/src/lib/libcrypto/objects/objects.h
@@ -66,6 +66,7 @@ extern "C" {
66#define SN_undef "UNDEF" 66#define SN_undef "UNDEF"
67#define LN_undef "undefined" 67#define LN_undef "undefined"
68#define NID_undef 0 68#define NID_undef 0
69#define OBJ_undef 0L
69 70
70#define SN_Algorithm "Algorithm" 71#define SN_Algorithm "Algorithm"
71#define LN_algorithm "algorithm" 72#define LN_algorithm "algorithm"
@@ -383,13 +384,16 @@ extern "C" {
383#define NID_pbeWithSHA1AndRC2_CBC 68 384#define NID_pbeWithSHA1AndRC2_CBC 68
384#define OBJ_pbeWithSHA1AndRC2_CBC OBJ_pkcs,5L,11L 385#define OBJ_pbeWithSHA1AndRC2_CBC OBJ_pkcs,5L,11L
385 386
386/* proposed by microsoft to RSA */ 387/* proposed by microsoft to RSA as pbeWithSHA1AndRC4: it is now
387#define LN_pbeWithSHA1AndRC4 "pbeWithSHA1AndRC4" 388 * defined explicitly in PKCS#5 v2.0 as id-PBKDF2 which is something
388#define NID_pbeWithSHA1AndRC4 69 389 * completely different.
389#define OBJ_pbeWithSHA1AndRC4 OBJ_pkcs,5L,12L 390 */
391#define LN_id_pbkdf2 "PBKDF2"
392#define NID_id_pbkdf2 69
393#define OBJ_id_pbkdf2 OBJ_pkcs,5L,12L
390 394
391#define SN_dsaWithSHA1_2 "DSA-SHA1-old" 395#define SN_dsaWithSHA1_2 "DSA-SHA1-old"
392#define LN_dsaWithSHA1_2 "dsaWithSHA1" 396#define LN_dsaWithSHA1_2 "dsaWithSHA1-old"
393#define NID_dsaWithSHA1_2 70 397#define NID_dsaWithSHA1_2 70
394/* Got this one from 'sdn706r20.pdf' which is actually an NSA document :-) */ 398/* Got this one from 'sdn706r20.pdf' which is actually an NSA document :-) */
395#define OBJ_dsaWithSHA1_2 OBJ_algorithm,27L 399#define OBJ_dsaWithSHA1_2 OBJ_algorithm,27L
@@ -654,21 +658,280 @@ extern "C" {
654#define LN_rc5_ofb64 "rc5-ofb" 658#define LN_rc5_ofb64 "rc5-ofb"
655#define NID_rc5_ofb64 123 659#define NID_rc5_ofb64 123
656 660
657#include "bio.h" 661#define SN_rle_compression "RLE"
658#include "asn1.h" 662#define LN_rle_compression "run length compression"
663#define NID_rle_compression 124
664#define OBJ_rle_compression 1L,1L,1L,1L,666L.1L
665
666#define SN_zlib_compression "ZLIB"
667#define LN_zlib_compression "zlib compression"
668#define NID_zlib_compression 125
669#define OBJ_zlib_compression 1L,1L,1L,1L,666L.2L
670
671#define SN_ext_key_usage "extendedKeyUsage"
672#define LN_ext_key_usage "X509v3 Extended Key Usage"
673#define NID_ext_key_usage 126
674#define OBJ_ext_key_usage OBJ_ld_ce,37
675
676#define SN_id_pkix "PKIX"
677#define NID_id_pkix 127
678#define OBJ_id_pkix 1L,3L,6L,1L,5L,5L,7L
679
680#define SN_id_kp "id-kp"
681#define NID_id_kp 128
682#define OBJ_id_kp OBJ_id_pkix,3L
683
684/* PKIX extended key usage OIDs */
685
686#define SN_server_auth "serverAuth"
687#define LN_server_auth "TLS Web Server Authentication"
688#define NID_server_auth 129
689#define OBJ_server_auth OBJ_id_kp,1L
690
691#define SN_client_auth "clientAuth"
692#define LN_client_auth "TLS Web Client Authentication"
693#define NID_client_auth 130
694#define OBJ_client_auth OBJ_id_kp,2L
695
696#define SN_code_sign "codeSigning"
697#define LN_code_sign "Code Signing"
698#define NID_code_sign 131
699#define OBJ_code_sign OBJ_id_kp,3L
700
701#define SN_email_protect "emailProtection"
702#define LN_email_protect "E-mail Protection"
703#define NID_email_protect 132
704#define OBJ_email_protect OBJ_id_kp,4L
705
706#define SN_time_stamp "timeStamping"
707#define LN_time_stamp "Time Stamping"
708#define NID_time_stamp 133
709#define OBJ_time_stamp OBJ_id_kp,8L
710
711/* Additional extended key usage OIDs: Microsoft */
712
713#define SN_ms_code_ind "msCodeInd"
714#define LN_ms_code_ind "Microsoft Individual Code Signing"
715#define NID_ms_code_ind 134
716#define OBJ_ms_code_ind 1L,3L,6L,1L,4L,1L,311L,2L,1L,21L
717
718#define SN_ms_code_com "msCodeCom"
719#define LN_ms_code_com "Microsoft Commercial Code Signing"
720#define NID_ms_code_com 135
721#define OBJ_ms_code_com 1L,3L,6L,1L,4L,1L,311L,2L,1L,22L
722
723#define SN_ms_ctl_sign "msCTLSign"
724#define LN_ms_ctl_sign "Microsoft Trust List Signing"
725#define NID_ms_ctl_sign 136
726#define OBJ_ms_ctl_sign 1L,3L,6L,1L,4L,1L,311L,10L,3L,1L
727
728#define SN_ms_sgc "msSGC"
729#define LN_ms_sgc "Microsoft Server Gated Crypto"
730#define NID_ms_sgc 137
731#define OBJ_ms_sgc 1L,3L,6L,1L,4L,1L,311L,10L,3L,3L
732
733#define SN_ms_efs "msEFS"
734#define LN_ms_efs "Microsoft Encrypted File System"
735#define NID_ms_efs 138
736#define OBJ_ms_efs 1L,3L,6L,1L,4L,1L,311L,10L,3L,4L
737
738/* Addidional usage: Netscape */
739
740#define SN_ns_sgc "nsSGC"
741#define LN_ns_sgc "Netscape Server Gated Crypto"
742#define NID_ns_sgc 139
743#define OBJ_ns_sgc OBJ_netscape,4L,1L
744
745#define SN_delta_crl "deltaCRL"
746#define LN_delta_crl "X509v3 Delta CRL Indicator"
747#define NID_delta_crl 140
748#define OBJ_delta_crl OBJ_ld_ce,27L
749
750#define SN_crl_reason "CRLReason"
751#define LN_crl_reason "CRL Reason Code"
752#define NID_crl_reason 141
753#define OBJ_crl_reason OBJ_ld_ce,21L
754
755#define SN_invalidity_date "invalidityDate"
756#define LN_invalidity_date "Invalidity Date"
757#define NID_invalidity_date 142
758#define OBJ_invalidity_date OBJ_ld_ce,24L
759
760#define SN_sxnet "SXNetID"
761#define LN_sxnet "Strong Extranet ID"
762#define NID_sxnet 143
763#define OBJ_sxnet 1L,3L,101L,1L,4L,1L
764
765/* PKCS12 and related OBJECT IDENTIFIERS */
766
767#define OBJ_pkcs12 OBJ_pkcs,12L
768#define OBJ_pkcs12_pbeids OBJ_pkcs12, 1
769
770#define LN_pbe_WithSHA1And128BitRC4 "pbeWithSHA1And128BitRC4"
771#define NID_pbe_WithSHA1And128BitRC4 144
772#define OBJ_pbe_WithSHA1And128BitRC4 OBJ_pkcs12_pbeids, 1L
773
774#define LN_pbe_WithSHA1And40BitRC4 "pbeWithSHA1And40BitRC4"
775#define NID_pbe_WithSHA1And40BitRC4 145
776#define OBJ_pbe_WithSHA1And40BitRC4 OBJ_pkcs12_pbeids, 2L
777
778#define LN_pbe_WithSHA1And3_Key_TripleDES_CBC "pbeWithSHA1And3-KeyTripleDES-CBC"
779#define NID_pbe_WithSHA1And3_Key_TripleDES_CBC 146
780#define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC OBJ_pkcs12_pbeids, 3L
781
782#define LN_pbe_WithSHA1And2_Key_TripleDES_CBC "pbeWithSHA1And2-KeyTripleDES-CBC"
783#define NID_pbe_WithSHA1And2_Key_TripleDES_CBC 147
784#define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC OBJ_pkcs12_pbeids, 4L
785
786#define LN_pbe_WithSHA1And128BitRC2_CBC "pbeWithSHA1And128BitRC2-CBC"
787#define NID_pbe_WithSHA1And128BitRC2_CBC 148
788#define OBJ_pbe_WithSHA1And128BitRC2_CBC OBJ_pkcs12_pbeids, 5L
789
790#define LN_pbe_WithSHA1And40BitRC2_CBC "pbeWithSHA1And40BitRC2-CBC"
791#define NID_pbe_WithSHA1And40BitRC2_CBC 149
792#define OBJ_pbe_WithSHA1And40BitRC2_CBC OBJ_pkcs12_pbeids, 6L
793
794#define OBJ_pkcs12_Version1 OBJ_pkcs12, 10L
795
796#define OBJ_pkcs12_BagIds OBJ_pkcs12_Version1, 1L
797
798#define LN_keyBag "keyBag"
799#define NID_keyBag 150
800#define OBJ_keyBag OBJ_pkcs12_BagIds, 1L
801
802#define LN_pkcs8ShroudedKeyBag "pkcs8ShroudedKeyBag"
803#define NID_pkcs8ShroudedKeyBag 151
804#define OBJ_pkcs8ShroudedKeyBag OBJ_pkcs12_BagIds, 2L
805
806#define LN_certBag "certBag"
807#define NID_certBag 152
808#define OBJ_certBag OBJ_pkcs12_BagIds, 3L
809
810#define LN_crlBag "crlBag"
811#define NID_crlBag 153
812#define OBJ_crlBag OBJ_pkcs12_BagIds, 4L
813
814#define LN_secretBag "secretBag"
815#define NID_secretBag 154
816#define OBJ_secretBag OBJ_pkcs12_BagIds, 5L
817
818#define LN_safeContentsBag "safeContentsBag"
819#define NID_safeContentsBag 155
820#define OBJ_safeContentsBag OBJ_pkcs12_BagIds, 6L
821
822#define LN_friendlyName "friendlyName"
823#define NID_friendlyName 156
824#define OBJ_friendlyName OBJ_pkcs9, 20L
825
826#define LN_localKeyID "localKeyID"
827#define NID_localKeyID 157
828#define OBJ_localKeyID OBJ_pkcs9, 21L
829
830#define OBJ_certTypes OBJ_pkcs9, 22L
831
832#define LN_x509Certificate "x509Certificate"
833#define NID_x509Certificate 158
834#define OBJ_x509Certificate OBJ_certTypes, 1L
835
836#define LN_sdsiCertificate "sdsiCertificate"
837#define NID_sdsiCertificate 159
838#define OBJ_sdsiCertificate OBJ_certTypes, 2L
839
840#define OBJ_crlTypes OBJ_pkcs9, 23L
841
842#define LN_x509Crl "x509Crl"
843#define NID_x509Crl 160
844#define OBJ_x509Crl OBJ_crlTypes, 1L
845
846/* PKCS#5 v2 OIDs */
847
848#define LN_pbes2 "PBES2"
849#define NID_pbes2 161
850#define OBJ_pbes2 OBJ_pkcs,5L,13L
851
852#define LN_pbmac1 "PBMAC1"
853#define NID_pbmac1 162
854#define OBJ_pbmac1 OBJ_pkcs,5L,14L
855
856#define LN_hmacWithSHA1 "hmacWithSHA1"
857#define NID_hmacWithSHA1 163
858#define OBJ_hmacWithSHA1 OBJ_rsadsi,2L,7L
859
860/* Policy Qualifier Ids */
861
862#define LN_id_qt_cps "Policy Qualifier CPS"
863#define SN_id_qt_cps "id-qt-cps"
864#define NID_id_qt_cps 164
865#define OBJ_id_qt_cps OBJ_id_pkix,2L,1L
866
867#define LN_id_qt_unotice "Policy Qualifier User Notice"
868#define SN_id_qt_unotice "id-qt-unotice"
869#define NID_id_qt_unotice 165
870#define OBJ_id_qt_unotice OBJ_id_pkix,2L,2L
871
872#define SN_rc2_64_cbc "RC2-64-CBC"
873#define LN_rc2_64_cbc "rc2-64-cbc"
874#define NID_rc2_64_cbc 166
875
876#define SN_SMIMECapabilities "SMIME-CAPS"
877#define LN_SMIMECapabilities "S/MIME Capabilities"
878#define NID_SMIMECapabilities 167
879#define OBJ_SMIMECapabilities OBJ_id_pkcs9,15L
880
881#define LN_pbeWithMD2AndRC2_CBC "pbeWithMD2AndRC2-CBC"
882#define NID_pbeWithMD2AndRC2_CBC 168
883#define OBJ_pbeWithMD2AndRC2_CBC OBJ_pkcs,5L,4L
884
885#define LN_pbeWithMD5AndRC2_CBC "pbeWithMD5AndRC2-CBC"
886#define NID_pbeWithMD5AndRC2_CBC 169
887#define OBJ_pbeWithMD5AndRC2_CBC OBJ_pkcs,5L,6L
888
889#define LN_pbeWithSHA1AndDES_CBC "pbeWithSHA1AndDES-CBC"
890#define NID_pbeWithSHA1AndDES_CBC 170
891#define OBJ_pbeWithSHA1AndDES_CBC OBJ_pkcs,5L,10L
892
893#include <openssl/bio.h>
894#include <openssl/asn1.h>
895
896#define OBJ_NAME_TYPE_UNDEF 0x00
897#define OBJ_NAME_TYPE_MD_METH 0x01
898#define OBJ_NAME_TYPE_CIPHER_METH 0x02
899#define OBJ_NAME_TYPE_PKEY_METH 0x03
900#define OBJ_NAME_TYPE_COMP_METH 0x04
901#define OBJ_NAME_TYPE_NUM 0x05
902
903#define OBJ_NAME_ALIAS 0x8000
904
905
906typedef struct obj_name_st
907 {
908 int type;
909 int alias;
910 const char *name;
911 const char *data;
912 } OBJ_NAME;
659 913
660#define OBJ_create_and_add_object(a,b,c) OBJ_create(a,b,c) 914#define OBJ_create_and_add_object(a,b,c) OBJ_create(a,b,c)
661 915
662#ifndef NOPROTO 916
917int OBJ_NAME_init(void);
918int OBJ_NAME_new_index(unsigned long (*hash_func)(),int (*cmp_func)(),
919 void (*free_func)());
920const char *OBJ_NAME_get(const char *name,int type);
921int OBJ_NAME_add(const char *name,int type,const char *data);
922int OBJ_NAME_remove(const char *name,int type);
923void OBJ_NAME_cleanup(int type); /* -1 for everything */
663 924
664ASN1_OBJECT * OBJ_dup(ASN1_OBJECT *o); 925ASN1_OBJECT * OBJ_dup(ASN1_OBJECT *o);
665ASN1_OBJECT * OBJ_nid2obj(int n); 926ASN1_OBJECT * OBJ_nid2obj(int n);
666char * OBJ_nid2ln(int n); 927const char * OBJ_nid2ln(int n);
667char * OBJ_nid2sn(int n); 928const char * OBJ_nid2sn(int n);
668int OBJ_obj2nid(ASN1_OBJECT *o); 929int OBJ_obj2nid(ASN1_OBJECT *o);
930ASN1_OBJECT * OBJ_txt2obj(const char *s, int no_name);
931int OBJ_obj2txt(char *buf, int buf_len, ASN1_OBJECT *a, int no_name);
669int OBJ_txt2nid(char *s); 932int OBJ_txt2nid(char *s);
670int OBJ_ln2nid(char *s); 933int OBJ_ln2nid(const char *s);
671int OBJ_sn2nid(char *s); 934int OBJ_sn2nid(const char *s);
672int OBJ_cmp(ASN1_OBJECT *a,ASN1_OBJECT *b); 935int OBJ_cmp(ASN1_OBJECT *a,ASN1_OBJECT *b);
673char * OBJ_bsearch(char *key,char *base,int num,int size,int (*cmp)()); 936char * OBJ_bsearch(char *key,char *base,int num,int size,int (*cmp)());
674 937
@@ -680,30 +943,11 @@ int OBJ_create(char *oid,char *sn,char *ln);
680void OBJ_cleanup(void ); 943void OBJ_cleanup(void );
681int OBJ_create_objects(BIO *in); 944int OBJ_create_objects(BIO *in);
682 945
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 */ 946/* BEGIN ERROR CODES */
947/* The following lines are auto generated by the script mkerr.pl. Any changes
948 * made after this point may be overwritten when the script is next run.
949 */
950
707/* Error codes for the OBJ functions. */ 951/* Error codes for the OBJ functions. */
708 952
709/* Function codes. */ 953/* Function codes. */
@@ -716,7 +960,7 @@ int OBJ_create_objects();
716/* Reason codes. */ 960/* Reason codes. */
717#define OBJ_R_MALLOC_FAILURE 100 961#define OBJ_R_MALLOC_FAILURE 100
718#define OBJ_R_UNKNOWN_NID 101 962#define OBJ_R_UNKNOWN_NID 101
719 963
720#ifdef __cplusplus 964#ifdef __cplusplus
721} 965}
722#endif 966#endif