diff options
Diffstat (limited to 'src/lib/libcrypto/objects')
-rw-r--r-- | src/lib/libcrypto/objects/Makefile.ssl | 3 | ||||
-rw-r--r-- | src/lib/libcrypto/objects/o_names.c | 106 | ||||
-rw-r--r-- | src/lib/libcrypto/objects/obj_dat.c | 22 | ||||
-rw-r--r-- | src/lib/libcrypto/objects/obj_dat.pl | 54 | ||||
-rw-r--r-- | src/lib/libcrypto/objects/objects.h | 74 |
5 files changed, 172 insertions, 87 deletions
diff --git a/src/lib/libcrypto/objects/Makefile.ssl b/src/lib/libcrypto/objects/Makefile.ssl index 53450f8754..f05e15df96 100644 --- a/src/lib/libcrypto/objects/Makefile.ssl +++ b/src/lib/libcrypto/objects/Makefile.ssl | |||
@@ -37,9 +37,6 @@ top: | |||
37 | 37 | ||
38 | all: obj_dat.h lib | 38 | all: obj_dat.h lib |
39 | 39 | ||
40 | obj_dat.h: objects.h obj_dat.pl | ||
41 | $(PERL) ./obj_dat.pl < objects.h > obj_dat.h | ||
42 | |||
43 | lib: $(LIBOBJ) | 40 | lib: $(LIBOBJ) |
44 | $(AR) $(LIB) $(LIBOBJ) | 41 | $(AR) $(LIB) $(LIBOBJ) |
45 | $(RANLIB) $(LIB) | 42 | $(RANLIB) $(LIB) |
diff --git a/src/lib/libcrypto/objects/o_names.c b/src/lib/libcrypto/objects/o_names.c index 4da5e45b9c..d654eb220e 100644 --- a/src/lib/libcrypto/objects/o_names.c +++ b/src/lib/libcrypto/objects/o_names.c | |||
@@ -4,15 +4,25 @@ | |||
4 | 4 | ||
5 | #include <openssl/lhash.h> | 5 | #include <openssl/lhash.h> |
6 | #include <openssl/objects.h> | 6 | #include <openssl/objects.h> |
7 | #include <openssl/safestack.h> | ||
7 | 8 | ||
8 | /* I use the ex_data stuff to manage the identifiers for the obj_name_types | 9 | /* 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 | * that applications may define. I only really use the free function field. |
10 | */ | 11 | */ |
11 | static LHASH *names_lh=NULL; | 12 | static LHASH *names_lh=NULL; |
12 | static int names_type_num=OBJ_NAME_TYPE_NUM; | 13 | static int names_type_num=OBJ_NAME_TYPE_NUM; |
13 | static STACK *names_cmp=NULL; | 14 | |
14 | static STACK *names_hash=NULL; | 15 | typedef struct name_funcs_st |
15 | static STACK *names_free=NULL; | 16 | { |
17 | unsigned long (*hash_func)(); | ||
18 | int (*cmp_func)(); | ||
19 | void (*free_func)(); | ||
20 | } NAME_FUNCS; | ||
21 | |||
22 | DECLARE_STACK_OF(NAME_FUNCS) | ||
23 | IMPLEMENT_STACK_OF(NAME_FUNCS) | ||
24 | |||
25 | STACK_OF(NAME_FUNCS) *name_funcs_stack; | ||
16 | 26 | ||
17 | static unsigned long obj_name_hash(OBJ_NAME *a); | 27 | static unsigned long obj_name_hash(OBJ_NAME *a); |
18 | static int obj_name_cmp(OBJ_NAME *a,OBJ_NAME *b); | 28 | static int obj_name_cmp(OBJ_NAME *a,OBJ_NAME *b); |
@@ -31,51 +41,57 @@ int OBJ_NAME_new_index(unsigned long (*hash_func)(), int (*cmp_func)(), | |||
31 | { | 41 | { |
32 | int ret; | 42 | int ret; |
33 | int i; | 43 | int i; |
44 | NAME_FUNCS *name_funcs; | ||
34 | 45 | ||
35 | if (names_free == NULL) | 46 | if (name_funcs_stack == NULL) |
36 | { | 47 | { |
37 | MemCheck_off(); | 48 | MemCheck_off(); |
38 | names_hash=sk_new_null(); | 49 | name_funcs_stack=sk_NAME_FUNCS_new_null(); |
39 | names_cmp=sk_new_null(); | ||
40 | names_free=sk_new_null(); | ||
41 | MemCheck_on(); | 50 | MemCheck_on(); |
42 | } | 51 | } |
43 | if ((names_free == NULL) || (names_hash == NULL) || (names_cmp == NULL)) | 52 | if ((name_funcs_stack == NULL)) |
44 | { | 53 | { |
45 | /* ERROR */ | 54 | /* ERROR */ |
46 | return(0); | 55 | return(0); |
47 | } | 56 | } |
48 | ret=names_type_num; | 57 | ret=names_type_num; |
49 | names_type_num++; | 58 | names_type_num++; |
50 | for (i=sk_num(names_free); i<names_type_num; i++) | 59 | for (i=sk_NAME_FUNCS_num(name_funcs_stack); i<names_type_num; i++) |
51 | { | 60 | { |
52 | MemCheck_off(); | 61 | MemCheck_off(); |
53 | sk_push(names_hash,(char *)strcmp); | 62 | name_funcs = Malloc(sizeof(NAME_FUNCS)); |
54 | sk_push(names_cmp,(char *)lh_strhash); | 63 | name_funcs->hash_func = lh_strhash; |
55 | sk_push(names_free,NULL); | 64 | name_funcs->cmp_func = (int (*)())strcmp; |
65 | name_funcs->free_func = 0; /* NULL is often declared to | ||
66 | * ((void *)0), which according | ||
67 | * to Compaq C is not really | ||
68 | * compatible with a function | ||
69 | * pointer. -- Richard Levitte*/ | ||
70 | sk_NAME_FUNCS_push(name_funcs_stack,name_funcs); | ||
56 | MemCheck_on(); | 71 | MemCheck_on(); |
57 | } | 72 | } |
73 | name_funcs = sk_NAME_FUNCS_value(name_funcs_stack, ret); | ||
58 | if (hash_func != NULL) | 74 | if (hash_func != NULL) |
59 | sk_set(names_hash,ret,(char *)hash_func); | 75 | name_funcs->hash_func = hash_func; |
60 | if (cmp_func != NULL) | 76 | if (cmp_func != NULL) |
61 | sk_set(names_cmp,ret,(char *)cmp_func); | 77 | name_funcs->cmp_func = cmp_func; |
62 | if (free_func != NULL) | 78 | if (free_func != NULL) |
63 | sk_set(names_free,ret,(char *)free_func); | 79 | name_funcs->free_func = free_func; |
64 | return(ret); | 80 | return(ret); |
65 | } | 81 | } |
66 | 82 | ||
67 | static int obj_name_cmp(OBJ_NAME *a, OBJ_NAME *b) | 83 | static int obj_name_cmp(OBJ_NAME *a, OBJ_NAME *b) |
68 | { | 84 | { |
69 | int ret; | 85 | int ret; |
70 | int (*cmp)(); | ||
71 | 86 | ||
72 | ret=a->type-b->type; | 87 | ret=a->type-b->type; |
73 | if (ret == 0) | 88 | if (ret == 0) |
74 | { | 89 | { |
75 | if ((names_cmp != NULL) && (sk_num(names_cmp) > a->type)) | 90 | if ((name_funcs_stack != NULL) |
91 | && (sk_NAME_FUNCS_num(name_funcs_stack) > a->type)) | ||
76 | { | 92 | { |
77 | cmp=(int (*)())sk_value(names_cmp,a->type); | 93 | ret=sk_NAME_FUNCS_value(name_funcs_stack,a->type) |
78 | ret=cmp(a->name,b->name); | 94 | ->cmp_func(a->name,b->name); |
79 | } | 95 | } |
80 | else | 96 | else |
81 | ret=strcmp(a->name,b->name); | 97 | ret=strcmp(a->name,b->name); |
@@ -86,12 +102,11 @@ static int obj_name_cmp(OBJ_NAME *a, OBJ_NAME *b) | |||
86 | static unsigned long obj_name_hash(OBJ_NAME *a) | 102 | static unsigned long obj_name_hash(OBJ_NAME *a) |
87 | { | 103 | { |
88 | unsigned long ret; | 104 | unsigned long ret; |
89 | unsigned long (*hash)(); | ||
90 | 105 | ||
91 | if ((names_hash != NULL) && (sk_num(names_hash) > a->type)) | 106 | if ((name_funcs_stack != NULL) && (sk_NAME_FUNCS_num(name_funcs_stack) > a->type)) |
92 | { | 107 | { |
93 | hash=(unsigned long (*)())sk_value(names_hash,a->type); | 108 | ret=sk_NAME_FUNCS_value(name_funcs_stack,a->type) |
94 | ret=hash(a->name); | 109 | ->hash_func(a->name); |
95 | } | 110 | } |
96 | else | 111 | else |
97 | { | 112 | { |
@@ -117,7 +132,7 @@ const char *OBJ_NAME_get(const char *name, int type) | |||
117 | 132 | ||
118 | for (;;) | 133 | for (;;) |
119 | { | 134 | { |
120 | ret=(OBJ_NAME *)lh_retrieve(names_lh,(char *)&on); | 135 | ret=(OBJ_NAME *)lh_retrieve(names_lh,&on); |
121 | if (ret == NULL) return(NULL); | 136 | if (ret == NULL) return(NULL); |
122 | if ((ret->alias) && !alias) | 137 | if ((ret->alias) && !alias) |
123 | { | 138 | { |
@@ -133,7 +148,6 @@ const char *OBJ_NAME_get(const char *name, int type) | |||
133 | 148 | ||
134 | int OBJ_NAME_add(const char *name, int type, const char *data) | 149 | int OBJ_NAME_add(const char *name, int type, const char *data) |
135 | { | 150 | { |
136 | void (*f)(); | ||
137 | OBJ_NAME *onp,*ret; | 151 | OBJ_NAME *onp,*ret; |
138 | int alias; | 152 | int alias; |
139 | 153 | ||
@@ -154,16 +168,20 @@ int OBJ_NAME_add(const char *name, int type, const char *data) | |||
154 | onp->type=type; | 168 | onp->type=type; |
155 | onp->data=data; | 169 | onp->data=data; |
156 | 170 | ||
157 | ret=(OBJ_NAME *)lh_insert(names_lh,(char *)onp); | 171 | ret=(OBJ_NAME *)lh_insert(names_lh,onp); |
158 | if (ret != NULL) | 172 | if (ret != NULL) |
159 | { | 173 | { |
160 | /* free things */ | 174 | /* free things */ |
161 | if ((names_free != NULL) && (sk_num(names_free) > ret->type)) | 175 | if ((name_funcs_stack != NULL) && (sk_NAME_FUNCS_num(name_funcs_stack) > ret->type)) |
162 | { | 176 | { |
163 | f=(void (*)())sk_value(names_free,ret->type); | 177 | /* XXX: I'm not sure I understand why the free |
164 | f(ret->name,ret->type,ret->data); | 178 | * function should get three arguments... |
179 | * -- Richard Levitte | ||
180 | */ | ||
181 | sk_NAME_FUNCS_value(name_funcs_stack,ret->type) | ||
182 | ->free_func(ret->name,ret->type,ret->data); | ||
165 | } | 183 | } |
166 | Free((char *)ret); | 184 | Free(ret); |
167 | } | 185 | } |
168 | else | 186 | else |
169 | { | 187 | { |
@@ -179,23 +197,26 @@ int OBJ_NAME_add(const char *name, int type, const char *data) | |||
179 | int OBJ_NAME_remove(const char *name, int type) | 197 | int OBJ_NAME_remove(const char *name, int type) |
180 | { | 198 | { |
181 | OBJ_NAME on,*ret; | 199 | OBJ_NAME on,*ret; |
182 | void (*f)(); | ||
183 | 200 | ||
184 | if (names_lh == NULL) return(0); | 201 | if (names_lh == NULL) return(0); |
185 | 202 | ||
186 | type&= ~OBJ_NAME_ALIAS; | 203 | type&= ~OBJ_NAME_ALIAS; |
187 | on.name=name; | 204 | on.name=name; |
188 | on.type=type; | 205 | on.type=type; |
189 | ret=(OBJ_NAME *)lh_delete(names_lh,(char *)&on); | 206 | ret=(OBJ_NAME *)lh_delete(names_lh,&on); |
190 | if (ret != NULL) | 207 | if (ret != NULL) |
191 | { | 208 | { |
192 | /* free things */ | 209 | /* free things */ |
193 | if ((names_free != NULL) && (sk_num(names_free) > type)) | 210 | if ((name_funcs_stack != NULL) && (sk_NAME_FUNCS_num(name_funcs_stack) > ret->type)) |
194 | { | 211 | { |
195 | f=(void (*)())sk_value(names_free,type); | 212 | /* XXX: I'm not sure I understand why the free |
196 | f(ret->name,ret->type,ret->data); | 213 | * function should get three arguments... |
214 | * -- Richard Levitte | ||
215 | */ | ||
216 | sk_NAME_FUNCS_value(name_funcs_stack,ret->type) | ||
217 | ->free_func(ret->name,ret->type,ret->data); | ||
197 | } | 218 | } |
198 | Free((char *)ret); | 219 | Free(ret); |
199 | return(1); | 220 | return(1); |
200 | } | 221 | } |
201 | else | 222 | else |
@@ -215,6 +236,11 @@ static void names_lh_free(OBJ_NAME *onp, int type) | |||
215 | } | 236 | } |
216 | } | 237 | } |
217 | 238 | ||
239 | static void name_funcs_free(NAME_FUNCS *ptr) | ||
240 | { | ||
241 | Free(ptr); | ||
242 | } | ||
243 | |||
218 | void OBJ_NAME_cleanup(int type) | 244 | void OBJ_NAME_cleanup(int type) |
219 | { | 245 | { |
220 | unsigned long down_load; | 246 | unsigned long down_load; |
@@ -229,13 +255,9 @@ void OBJ_NAME_cleanup(int type) | |||
229 | if (type < 0) | 255 | if (type < 0) |
230 | { | 256 | { |
231 | lh_free(names_lh); | 257 | lh_free(names_lh); |
232 | sk_free(names_hash); | 258 | sk_NAME_FUNCS_pop_free(name_funcs_stack,name_funcs_free); |
233 | sk_free(names_cmp); | ||
234 | sk_free(names_free); | ||
235 | names_lh=NULL; | 259 | names_lh=NULL; |
236 | names_hash=NULL; | 260 | name_funcs_stack = NULL; |
237 | names_cmp=NULL; | ||
238 | names_free=NULL; | ||
239 | } | 261 | } |
240 | else | 262 | else |
241 | names_lh->down_load=down_load; | 263 | names_lh->down_load=down_load; |
diff --git a/src/lib/libcrypto/objects/obj_dat.c b/src/lib/libcrypto/objects/obj_dat.c index d47b874399..da6df3762a 100644 --- a/src/lib/libcrypto/objects/obj_dat.c +++ b/src/lib/libcrypto/objects/obj_dat.c | |||
@@ -214,16 +214,12 @@ int OBJ_new_nid(int num) | |||
214 | int OBJ_add_object(ASN1_OBJECT *obj) | 214 | int OBJ_add_object(ASN1_OBJECT *obj) |
215 | { | 215 | { |
216 | ASN1_OBJECT *o; | 216 | ASN1_OBJECT *o; |
217 | ADDED_OBJ *ao[4],*aop; | 217 | ADDED_OBJ *ao[4]={NULL,NULL,NULL,NULL},*aop; |
218 | int i; | 218 | int i; |
219 | 219 | ||
220 | if (added == NULL) | 220 | if (added == NULL) |
221 | if (!init_added()) return(0); | 221 | if (!init_added()) return(0); |
222 | if ((o=OBJ_dup(obj)) == NULL) goto err; | 222 | if ((o=OBJ_dup(obj)) == NULL) goto err; |
223 | ao[ADDED_DATA]=NULL; | ||
224 | ao[ADDED_SNAME]=NULL; | ||
225 | ao[ADDED_LNAME]=NULL; | ||
226 | ao[ADDED_NID]=NULL; | ||
227 | ao[ADDED_NID]=(ADDED_OBJ *)Malloc(sizeof(ADDED_OBJ)); | 223 | ao[ADDED_NID]=(ADDED_OBJ *)Malloc(sizeof(ADDED_OBJ)); |
228 | if ((o->length != 0) && (obj->data != NULL)) | 224 | if ((o->length != 0) && (obj->data != NULL)) |
229 | ao[ADDED_DATA]=(ADDED_OBJ *)Malloc(sizeof(ADDED_OBJ)); | 225 | ao[ADDED_DATA]=(ADDED_OBJ *)Malloc(sizeof(ADDED_OBJ)); |
@@ -238,7 +234,7 @@ int OBJ_add_object(ASN1_OBJECT *obj) | |||
238 | { | 234 | { |
239 | ao[i]->type=i; | 235 | ao[i]->type=i; |
240 | ao[i]->obj=o; | 236 | ao[i]->obj=o; |
241 | aop=(ADDED_OBJ *)lh_insert(added,(char *)ao[i]); | 237 | aop=(ADDED_OBJ *)lh_insert(added,ao[i]); |
242 | /* memory leak, buit should not normally matter */ | 238 | /* memory leak, buit should not normally matter */ |
243 | if (aop != NULL) | 239 | if (aop != NULL) |
244 | Free(aop); | 240 | Free(aop); |
@@ -276,7 +272,7 @@ ASN1_OBJECT *OBJ_nid2obj(int n) | |||
276 | ad.type=ADDED_NID; | 272 | ad.type=ADDED_NID; |
277 | ad.obj= &ob; | 273 | ad.obj= &ob; |
278 | ob.nid=n; | 274 | ob.nid=n; |
279 | adp=(ADDED_OBJ *)lh_retrieve(added,(char *)&ad); | 275 | adp=(ADDED_OBJ *)lh_retrieve(added,&ad); |
280 | if (adp != NULL) | 276 | if (adp != NULL) |
281 | return(adp->obj); | 277 | return(adp->obj); |
282 | else | 278 | else |
@@ -308,7 +304,7 @@ const char *OBJ_nid2sn(int n) | |||
308 | ad.type=ADDED_NID; | 304 | ad.type=ADDED_NID; |
309 | ad.obj= &ob; | 305 | ad.obj= &ob; |
310 | ob.nid=n; | 306 | ob.nid=n; |
311 | adp=(ADDED_OBJ *)lh_retrieve(added,(char *)&ad); | 307 | adp=(ADDED_OBJ *)lh_retrieve(added,&ad); |
312 | if (adp != NULL) | 308 | if (adp != NULL) |
313 | return(adp->obj->sn); | 309 | return(adp->obj->sn); |
314 | else | 310 | else |
@@ -340,7 +336,7 @@ const char *OBJ_nid2ln(int n) | |||
340 | ad.type=ADDED_NID; | 336 | ad.type=ADDED_NID; |
341 | ad.obj= &ob; | 337 | ad.obj= &ob; |
342 | ob.nid=n; | 338 | ob.nid=n; |
343 | adp=(ADDED_OBJ *)lh_retrieve(added,(char *)&ad); | 339 | adp=(ADDED_OBJ *)lh_retrieve(added,&ad); |
344 | if (adp != NULL) | 340 | if (adp != NULL) |
345 | return(adp->obj->ln); | 341 | return(adp->obj->ln); |
346 | else | 342 | else |
@@ -365,7 +361,7 @@ int OBJ_obj2nid(ASN1_OBJECT *a) | |||
365 | { | 361 | { |
366 | ad.type=ADDED_DATA; | 362 | ad.type=ADDED_DATA; |
367 | ad.obj=a; | 363 | ad.obj=a; |
368 | adp=(ADDED_OBJ *)lh_retrieve(added,(char *)&ad); | 364 | adp=(ADDED_OBJ *)lh_retrieve(added,&ad); |
369 | if (adp != NULL) return (adp->obj->nid); | 365 | if (adp != NULL) return (adp->obj->nid); |
370 | } | 366 | } |
371 | op=(ASN1_OBJECT **)OBJ_bsearch((char *)&a,(char *)obj_objs,NUM_OBJ, | 367 | op=(ASN1_OBJECT **)OBJ_bsearch((char *)&a,(char *)obj_objs,NUM_OBJ, |
@@ -504,7 +500,7 @@ int OBJ_ln2nid(const char *s) | |||
504 | { | 500 | { |
505 | ad.type=ADDED_LNAME; | 501 | ad.type=ADDED_LNAME; |
506 | ad.obj= &o; | 502 | ad.obj= &o; |
507 | adp=(ADDED_OBJ *)lh_retrieve(added,(char *)&ad); | 503 | adp=(ADDED_OBJ *)lh_retrieve(added,&ad); |
508 | if (adp != NULL) return (adp->obj->nid); | 504 | if (adp != NULL) return (adp->obj->nid); |
509 | } | 505 | } |
510 | op=(ASN1_OBJECT **)OBJ_bsearch((char *)&oo,(char *)ln_objs,NUM_LN, | 506 | op=(ASN1_OBJECT **)OBJ_bsearch((char *)&oo,(char *)ln_objs,NUM_LN, |
@@ -523,7 +519,7 @@ int OBJ_sn2nid(const char *s) | |||
523 | { | 519 | { |
524 | ad.type=ADDED_SNAME; | 520 | ad.type=ADDED_SNAME; |
525 | ad.obj= &o; | 521 | ad.obj= &o; |
526 | adp=(ADDED_OBJ *)lh_retrieve(added,(char *)&ad); | 522 | adp=(ADDED_OBJ *)lh_retrieve(added,&ad); |
527 | if (adp != NULL) return (adp->obj->nid); | 523 | if (adp != NULL) return (adp->obj->nid); |
528 | } | 524 | } |
529 | op=(ASN1_OBJECT **)OBJ_bsearch((char *)&oo,(char *)sn_objs,NUM_SN, | 525 | op=(ASN1_OBJECT **)OBJ_bsearch((char *)&oo,(char *)sn_objs,NUM_SN, |
@@ -647,7 +643,7 @@ int OBJ_create(char *oid, char *sn, char *ln) | |||
647 | ok=OBJ_add_object(op); | 643 | ok=OBJ_add_object(op); |
648 | err: | 644 | err: |
649 | ASN1_OBJECT_free(op); | 645 | ASN1_OBJECT_free(op); |
650 | Free((char *)buf); | 646 | Free(buf); |
651 | return(ok); | 647 | return(ok); |
652 | } | 648 | } |
653 | 649 | ||
diff --git a/src/lib/libcrypto/objects/obj_dat.pl b/src/lib/libcrypto/objects/obj_dat.pl index 5043daef2a..e6e3c3b9c0 100644 --- a/src/lib/libcrypto/objects/obj_dat.pl +++ b/src/lib/libcrypto/objects/obj_dat.pl | |||
@@ -38,7 +38,10 @@ sub expand_obj | |||
38 | return(%objn); | 38 | return(%objn); |
39 | } | 39 | } |
40 | 40 | ||
41 | while (<>) | 41 | open (IN,"$ARGV[0]") || die "Can't open input file $ARGV[0]"; |
42 | open (OUT,">$ARGV[1]") || die "Can't open output file $ARGV[1]"; | ||
43 | |||
44 | while (<IN>) | ||
42 | { | 45 | { |
43 | next unless /^\#define\s+(\S+)\s+(.*)$/; | 46 | next unless /^\#define\s+(\S+)\s+(.*)$/; |
44 | $v=$1; | 47 | $v=$1; |
@@ -55,6 +58,7 @@ while (<>) | |||
55 | $objd{$v}=$d; | 58 | $objd{$v}=$d; |
56 | } | 59 | } |
57 | } | 60 | } |
61 | close IN; | ||
58 | 62 | ||
59 | %ob=&expand_obj(*objd); | 63 | %ob=&expand_obj(*objd); |
60 | 64 | ||
@@ -132,7 +136,7 @@ foreach (sort obj_cmp @a) | |||
132 | push(@ob,sprintf("&(nid_objs[%2d]),/* %-32s %s */\n",$_,$m,$v)); | 136 | push(@ob,sprintf("&(nid_objs[%2d]),/* %-32s %s */\n",$_,$m,$v)); |
133 | } | 137 | } |
134 | 138 | ||
135 | print <<'EOF'; | 139 | print OUT <<'EOF'; |
136 | /* lib/obj/obj_dat.h */ | 140 | /* lib/obj/obj_dat.h */ |
137 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) | 141 | /* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) |
138 | * All rights reserved. | 142 | * All rights reserved. |
@@ -193,21 +197,21 @@ print <<'EOF'; | |||
193 | 197 | ||
194 | /* THIS FILE IS GENERATED FROM Objects.h by obj_dat.pl via the | 198 | /* THIS FILE IS GENERATED FROM Objects.h by obj_dat.pl via the |
195 | * following command: | 199 | * following command: |
196 | * perl obj_dat.pl < objects.h > obj_dat.h | 200 | * perl obj_dat.pl objects.h obj_dat.h |
197 | */ | 201 | */ |
198 | 202 | ||
199 | EOF | 203 | EOF |
200 | 204 | ||
201 | printf "#define NUM_NID %d\n",$n; | 205 | printf OUT "#define NUM_NID %d\n",$n; |
202 | printf "#define NUM_SN %d\n",$#sn+1; | 206 | printf OUT "#define NUM_SN %d\n",$#sn+1; |
203 | printf "#define NUM_LN %d\n",$#ln+1; | 207 | printf OUT "#define NUM_LN %d\n",$#ln+1; |
204 | printf "#define NUM_OBJ %d\n\n",$#ob+1; | 208 | printf OUT "#define NUM_OBJ %d\n\n",$#ob+1; |
205 | 209 | ||
206 | printf "static unsigned char lvalues[%d]={\n",$lvalues+1; | 210 | printf OUT "static unsigned char lvalues[%d]={\n",$lvalues+1; |
207 | print @lvalues; | 211 | print OUT @lvalues; |
208 | print "};\n\n"; | 212 | print OUT "};\n\n"; |
209 | 213 | ||
210 | printf "static ASN1_OBJECT nid_objs[NUM_NID]={\n"; | 214 | printf OUT "static ASN1_OBJECT nid_objs[NUM_NID]={\n"; |
211 | foreach (@out) | 215 | foreach (@out) |
212 | { | 216 | { |
213 | if (length($_) > 75) | 217 | if (length($_) > 75) |
@@ -218,30 +222,32 @@ foreach (@out) | |||
218 | $t=$out.$_.","; | 222 | $t=$out.$_.","; |
219 | if (length($t) > 70) | 223 | if (length($t) > 70) |
220 | { | 224 | { |
221 | print "$out\n"; | 225 | print OUT "$out\n"; |
222 | $t="\t$_,"; | 226 | $t="\t$_,"; |
223 | } | 227 | } |
224 | $out=$t; | 228 | $out=$t; |
225 | } | 229 | } |
226 | chop $out; | 230 | chop $out; |
227 | print "$out"; | 231 | print OUT "$out"; |
228 | } | 232 | } |
229 | else | 233 | else |
230 | { print $_; } | 234 | { print OUT $_; } |
231 | } | 235 | } |
232 | print "};\n\n"; | 236 | print OUT "};\n\n"; |
237 | |||
238 | printf OUT "static ASN1_OBJECT *sn_objs[NUM_SN]={\n"; | ||
239 | print OUT @sn; | ||
240 | print OUT "};\n\n"; | ||
233 | 241 | ||
234 | printf "static ASN1_OBJECT *sn_objs[NUM_SN]={\n"; | 242 | printf OUT "static ASN1_OBJECT *ln_objs[NUM_LN]={\n"; |
235 | print @sn; | 243 | print OUT @ln; |
236 | print "};\n\n"; | 244 | print OUT "};\n\n"; |
237 | 245 | ||
238 | printf "static ASN1_OBJECT *ln_objs[NUM_LN]={\n"; | 246 | printf OUT "static ASN1_OBJECT *obj_objs[NUM_OBJ]={\n"; |
239 | print @ln; | 247 | print OUT @ob; |
240 | print "};\n\n"; | 248 | print OUT "};\n\n"; |
241 | 249 | ||
242 | printf "static ASN1_OBJECT *obj_objs[NUM_OBJ]={\n"; | 250 | close OUT; |
243 | print @ob; | ||
244 | print "};\n\n"; | ||
245 | 251 | ||
246 | sub der_it | 252 | sub der_it |
247 | { | 253 | { |
diff --git a/src/lib/libcrypto/objects/objects.h b/src/lib/libcrypto/objects/objects.h index d03748e022..d1a5ad2502 100644 --- a/src/lib/libcrypto/objects/objects.h +++ b/src/lib/libcrypto/objects/objects.h | |||
@@ -110,10 +110,12 @@ extern "C" { | |||
110 | #define NID_md5WithRSAEncryption 8 | 110 | #define NID_md5WithRSAEncryption 8 |
111 | #define OBJ_md5WithRSAEncryption OBJ_pkcs,1L,4L | 111 | #define OBJ_md5WithRSAEncryption OBJ_pkcs,1L,4L |
112 | 112 | ||
113 | #define SN_pbeWithMD2AndDES_CBC "PBE-MD2-DES" | ||
113 | #define LN_pbeWithMD2AndDES_CBC "pbeWithMD2AndDES-CBC" | 114 | #define LN_pbeWithMD2AndDES_CBC "pbeWithMD2AndDES-CBC" |
114 | #define NID_pbeWithMD2AndDES_CBC 9 | 115 | #define NID_pbeWithMD2AndDES_CBC 9 |
115 | #define OBJ_pbeWithMD2AndDES_CBC OBJ_pkcs,5L,1L | 116 | #define OBJ_pbeWithMD2AndDES_CBC OBJ_pkcs,5L,1L |
116 | 117 | ||
118 | #define SN_pbeWithMD5AndDES_CBC "PBE-MD5-DES" | ||
117 | #define LN_pbeWithMD5AndDES_CBC "pbeWithMD5AndDES-CBC" | 119 | #define LN_pbeWithMD5AndDES_CBC "pbeWithMD5AndDES-CBC" |
118 | #define NID_pbeWithMD5AndDES_CBC 10 | 120 | #define NID_pbeWithMD5AndDES_CBC 10 |
119 | #define OBJ_pbeWithMD5AndDES_CBC OBJ_pkcs,5L,3L | 121 | #define OBJ_pbeWithMD5AndDES_CBC OBJ_pkcs,5L,3L |
@@ -230,6 +232,7 @@ extern "C" { | |||
230 | #define SN_idea_cbc "IDEA-CBC" | 232 | #define SN_idea_cbc "IDEA-CBC" |
231 | #define LN_idea_cbc "idea-cbc" | 233 | #define LN_idea_cbc "idea-cbc" |
232 | #define NID_idea_cbc 34 | 234 | #define NID_idea_cbc 34 |
235 | #define OBJ_idea_cbc 1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L | ||
233 | 236 | ||
234 | #define SN_idea_cfb64 "IDEA-CFB" | 237 | #define SN_idea_cfb64 "IDEA-CFB" |
235 | #define LN_idea_cfb64 "idea-cfb" | 238 | #define LN_idea_cfb64 "idea-cfb" |
@@ -380,6 +383,7 @@ extern "C" { | |||
380 | #define OBJ_dsa_2 OBJ_algorithm,12L | 383 | #define OBJ_dsa_2 OBJ_algorithm,12L |
381 | 384 | ||
382 | /* proposed by microsoft to RSA */ | 385 | /* proposed by microsoft to RSA */ |
386 | #define SN_pbeWithSHA1AndRC2_CBC "PBE-SHA1-RC2-64" | ||
383 | #define LN_pbeWithSHA1AndRC2_CBC "pbeWithSHA1AndRC2-CBC" | 387 | #define LN_pbeWithSHA1AndRC2_CBC "pbeWithSHA1AndRC2-CBC" |
384 | #define NID_pbeWithSHA1AndRC2_CBC 68 | 388 | #define NID_pbeWithSHA1AndRC2_CBC 68 |
385 | #define OBJ_pbeWithSHA1AndRC2_CBC OBJ_pkcs,5L,11L | 389 | #define OBJ_pbeWithSHA1AndRC2_CBC OBJ_pkcs,5L,11L |
@@ -499,6 +503,7 @@ extern "C" { | |||
499 | #define SN_bf_cbc "BF-CBC" | 503 | #define SN_bf_cbc "BF-CBC" |
500 | #define LN_bf_cbc "bf-cbc" | 504 | #define LN_bf_cbc "bf-cbc" |
501 | #define NID_bf_cbc 91 | 505 | #define NID_bf_cbc 91 |
506 | #define OBJ_bf_cbc 1L,3L,6L,1L,4L,1L,3029L,1L,2L | ||
502 | 507 | ||
503 | #define SN_bf_ecb "BF-ECB" | 508 | #define SN_bf_ecb "BF-ECB" |
504 | #define LN_bf_ecb "bf-ecb" | 509 | #define LN_bf_ecb "bf-ecb" |
@@ -627,7 +632,7 @@ extern "C" { | |||
627 | #define OBJ_ripemd160 1L,3L,36L,3L,2L,1L | 632 | #define OBJ_ripemd160 1L,3L,36L,3L,2L,1L |
628 | 633 | ||
629 | /* The name should actually be rsaSignatureWithripemd160, but I'm going | 634 | /* The name should actually be rsaSignatureWithripemd160, but I'm going |
630 | * to contiune using the convention I'm using with the other ciphers */ | 635 | * to continue using the convention I'm using with the other ciphers */ |
631 | #define SN_ripemd160WithRSA "RSA-RIPEMD160" | 636 | #define SN_ripemd160WithRSA "RSA-RIPEMD160" |
632 | #define LN_ripemd160WithRSA "ripemd160WithRSA" | 637 | #define LN_ripemd160WithRSA "ripemd160WithRSA" |
633 | #define NID_ripemd160WithRSA 119 | 638 | #define NID_ripemd160WithRSA 119 |
@@ -661,12 +666,12 @@ extern "C" { | |||
661 | #define SN_rle_compression "RLE" | 666 | #define SN_rle_compression "RLE" |
662 | #define LN_rle_compression "run length compression" | 667 | #define LN_rle_compression "run length compression" |
663 | #define NID_rle_compression 124 | 668 | #define NID_rle_compression 124 |
664 | #define OBJ_rle_compression 1L,1L,1L,1L,666L.1L | 669 | #define OBJ_rle_compression 1L,1L,1L,1L,666L,1L |
665 | 670 | ||
666 | #define SN_zlib_compression "ZLIB" | 671 | #define SN_zlib_compression "ZLIB" |
667 | #define LN_zlib_compression "zlib compression" | 672 | #define LN_zlib_compression "zlib compression" |
668 | #define NID_zlib_compression 125 | 673 | #define NID_zlib_compression 125 |
669 | #define OBJ_zlib_compression 1L,1L,1L,1L,666L.2L | 674 | #define OBJ_zlib_compression 1L,1L,1L,1L,666L,2L |
670 | 675 | ||
671 | #define SN_ext_key_usage "extendedKeyUsage" | 676 | #define SN_ext_key_usage "extendedKeyUsage" |
672 | #define LN_ext_key_usage "X509v3 Extended Key Usage" | 677 | #define LN_ext_key_usage "X509v3 Extended Key Usage" |
@@ -735,7 +740,7 @@ extern "C" { | |||
735 | #define NID_ms_efs 138 | 740 | #define NID_ms_efs 138 |
736 | #define OBJ_ms_efs 1L,3L,6L,1L,4L,1L,311L,10L,3L,4L | 741 | #define OBJ_ms_efs 1L,3L,6L,1L,4L,1L,311L,10L,3L,4L |
737 | 742 | ||
738 | /* Addidional usage: Netscape */ | 743 | /* Additional usage: Netscape */ |
739 | 744 | ||
740 | #define SN_ns_sgc "nsSGC" | 745 | #define SN_ns_sgc "nsSGC" |
741 | #define LN_ns_sgc "Netscape Server Gated Crypto" | 746 | #define LN_ns_sgc "Netscape Server Gated Crypto" |
@@ -767,26 +772,32 @@ extern "C" { | |||
767 | #define OBJ_pkcs12 OBJ_pkcs,12L | 772 | #define OBJ_pkcs12 OBJ_pkcs,12L |
768 | #define OBJ_pkcs12_pbeids OBJ_pkcs12, 1 | 773 | #define OBJ_pkcs12_pbeids OBJ_pkcs12, 1 |
769 | 774 | ||
775 | #define SN_pbe_WithSHA1And128BitRC4 "PBE-SHA1-RC4-128" | ||
770 | #define LN_pbe_WithSHA1And128BitRC4 "pbeWithSHA1And128BitRC4" | 776 | #define LN_pbe_WithSHA1And128BitRC4 "pbeWithSHA1And128BitRC4" |
771 | #define NID_pbe_WithSHA1And128BitRC4 144 | 777 | #define NID_pbe_WithSHA1And128BitRC4 144 |
772 | #define OBJ_pbe_WithSHA1And128BitRC4 OBJ_pkcs12_pbeids, 1L | 778 | #define OBJ_pbe_WithSHA1And128BitRC4 OBJ_pkcs12_pbeids, 1L |
773 | 779 | ||
780 | #define SN_pbe_WithSHA1And40BitRC4 "PBE-SHA1-RC4-40" | ||
774 | #define LN_pbe_WithSHA1And40BitRC4 "pbeWithSHA1And40BitRC4" | 781 | #define LN_pbe_WithSHA1And40BitRC4 "pbeWithSHA1And40BitRC4" |
775 | #define NID_pbe_WithSHA1And40BitRC4 145 | 782 | #define NID_pbe_WithSHA1And40BitRC4 145 |
776 | #define OBJ_pbe_WithSHA1And40BitRC4 OBJ_pkcs12_pbeids, 2L | 783 | #define OBJ_pbe_WithSHA1And40BitRC4 OBJ_pkcs12_pbeids, 2L |
777 | 784 | ||
785 | #define SN_pbe_WithSHA1And3_Key_TripleDES_CBC "PBE-SHA1-3DES" | ||
778 | #define LN_pbe_WithSHA1And3_Key_TripleDES_CBC "pbeWithSHA1And3-KeyTripleDES-CBC" | 786 | #define LN_pbe_WithSHA1And3_Key_TripleDES_CBC "pbeWithSHA1And3-KeyTripleDES-CBC" |
779 | #define NID_pbe_WithSHA1And3_Key_TripleDES_CBC 146 | 787 | #define NID_pbe_WithSHA1And3_Key_TripleDES_CBC 146 |
780 | #define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC OBJ_pkcs12_pbeids, 3L | 788 | #define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC OBJ_pkcs12_pbeids, 3L |
781 | 789 | ||
790 | #define SN_pbe_WithSHA1And2_Key_TripleDES_CBC "PBE-SHA1-2DES" | ||
782 | #define LN_pbe_WithSHA1And2_Key_TripleDES_CBC "pbeWithSHA1And2-KeyTripleDES-CBC" | 791 | #define LN_pbe_WithSHA1And2_Key_TripleDES_CBC "pbeWithSHA1And2-KeyTripleDES-CBC" |
783 | #define NID_pbe_WithSHA1And2_Key_TripleDES_CBC 147 | 792 | #define NID_pbe_WithSHA1And2_Key_TripleDES_CBC 147 |
784 | #define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC OBJ_pkcs12_pbeids, 4L | 793 | #define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC OBJ_pkcs12_pbeids, 4L |
785 | 794 | ||
795 | #define SN_pbe_WithSHA1And128BitRC2_CBC "PBE-SHA1-RC2-128" | ||
786 | #define LN_pbe_WithSHA1And128BitRC2_CBC "pbeWithSHA1And128BitRC2-CBC" | 796 | #define LN_pbe_WithSHA1And128BitRC2_CBC "pbeWithSHA1And128BitRC2-CBC" |
787 | #define NID_pbe_WithSHA1And128BitRC2_CBC 148 | 797 | #define NID_pbe_WithSHA1And128BitRC2_CBC 148 |
788 | #define OBJ_pbe_WithSHA1And128BitRC2_CBC OBJ_pkcs12_pbeids, 5L | 798 | #define OBJ_pbe_WithSHA1And128BitRC2_CBC OBJ_pkcs12_pbeids, 5L |
789 | 799 | ||
800 | #define SN_pbe_WithSHA1And40BitRC2_CBC "PBE-SHA1-RC2-40" | ||
790 | #define LN_pbe_WithSHA1And40BitRC2_CBC "pbeWithSHA1And40BitRC2-CBC" | 801 | #define LN_pbe_WithSHA1And40BitRC2_CBC "pbeWithSHA1And40BitRC2-CBC" |
791 | #define NID_pbe_WithSHA1And40BitRC2_CBC 149 | 802 | #define NID_pbe_WithSHA1And40BitRC2_CBC 149 |
792 | #define OBJ_pbe_WithSHA1And40BitRC2_CBC OBJ_pkcs12_pbeids, 6L | 803 | #define OBJ_pbe_WithSHA1And40BitRC2_CBC OBJ_pkcs12_pbeids, 6L |
@@ -876,20 +887,73 @@ extern "C" { | |||
876 | #define SN_SMIMECapabilities "SMIME-CAPS" | 887 | #define SN_SMIMECapabilities "SMIME-CAPS" |
877 | #define LN_SMIMECapabilities "S/MIME Capabilities" | 888 | #define LN_SMIMECapabilities "S/MIME Capabilities" |
878 | #define NID_SMIMECapabilities 167 | 889 | #define NID_SMIMECapabilities 167 |
879 | #define OBJ_SMIMECapabilities OBJ_id_pkcs9,15L | 890 | #define OBJ_SMIMECapabilities OBJ_pkcs9,15L |
880 | 891 | ||
892 | #define SN_pbeWithMD2AndRC2_CBC "PBE-MD2-RC2-64" | ||
881 | #define LN_pbeWithMD2AndRC2_CBC "pbeWithMD2AndRC2-CBC" | 893 | #define LN_pbeWithMD2AndRC2_CBC "pbeWithMD2AndRC2-CBC" |
882 | #define NID_pbeWithMD2AndRC2_CBC 168 | 894 | #define NID_pbeWithMD2AndRC2_CBC 168 |
883 | #define OBJ_pbeWithMD2AndRC2_CBC OBJ_pkcs,5L,4L | 895 | #define OBJ_pbeWithMD2AndRC2_CBC OBJ_pkcs,5L,4L |
884 | 896 | ||
897 | #define SN_pbeWithMD5AndRC2_CBC "PBE-MD5-RC2-64" | ||
885 | #define LN_pbeWithMD5AndRC2_CBC "pbeWithMD5AndRC2-CBC" | 898 | #define LN_pbeWithMD5AndRC2_CBC "pbeWithMD5AndRC2-CBC" |
886 | #define NID_pbeWithMD5AndRC2_CBC 169 | 899 | #define NID_pbeWithMD5AndRC2_CBC 169 |
887 | #define OBJ_pbeWithMD5AndRC2_CBC OBJ_pkcs,5L,6L | 900 | #define OBJ_pbeWithMD5AndRC2_CBC OBJ_pkcs,5L,6L |
888 | 901 | ||
902 | #define SN_pbeWithSHA1AndDES_CBC "PBE-SHA1-DES" | ||
889 | #define LN_pbeWithSHA1AndDES_CBC "pbeWithSHA1AndDES-CBC" | 903 | #define LN_pbeWithSHA1AndDES_CBC "pbeWithSHA1AndDES-CBC" |
890 | #define NID_pbeWithSHA1AndDES_CBC 170 | 904 | #define NID_pbeWithSHA1AndDES_CBC 170 |
891 | #define OBJ_pbeWithSHA1AndDES_CBC OBJ_pkcs,5L,10L | 905 | #define OBJ_pbeWithSHA1AndDES_CBC OBJ_pkcs,5L,10L |
892 | 906 | ||
907 | /* Extension request OIDs */ | ||
908 | |||
909 | #define LN_ms_ext_req "Microsoft Extension Request" | ||
910 | #define SN_ms_ext_req "msExtReq" | ||
911 | #define NID_ms_ext_req 171 | ||
912 | #define OBJ_ms_ext_req 1L,3L,6L,1L,4L,1L,311L,2L,1L,14L | ||
913 | |||
914 | #define LN_ext_req "Extension Request" | ||
915 | #define SN_ext_req "extReq" | ||
916 | #define NID_ext_req 172 | ||
917 | #define OBJ_ext_req OBJ_pkcs9,14L | ||
918 | |||
919 | #define SN_name "name" | ||
920 | #define LN_name "name" | ||
921 | #define NID_name 173 | ||
922 | #define OBJ_name OBJ_X509,41L | ||
923 | |||
924 | #define SN_dnQualifier "dnQualifier" | ||
925 | #define LN_dnQualifier "dnQualifier" | ||
926 | #define NID_dnQualifier 174 | ||
927 | #define OBJ_dnQualifier OBJ_X509,46L | ||
928 | |||
929 | #define SN_id_pe "id-pe" | ||
930 | #define NID_id_pe 175 | ||
931 | #define OBJ_id_pe OBJ_id_pkix,1L | ||
932 | |||
933 | #define SN_id_ad "id-ad" | ||
934 | #define NID_id_ad 176 | ||
935 | #define OBJ_id_ad OBJ_id_pkix,48L | ||
936 | |||
937 | #define SN_info_access "authorityInfoAccess" | ||
938 | #define LN_info_access "Authority Information Access" | ||
939 | #define NID_info_access 177 | ||
940 | #define OBJ_info_access OBJ_id_pe,1L | ||
941 | |||
942 | #define SN_ad_OCSP "OCSP" | ||
943 | #define LN_ad_OCSP "OCSP" | ||
944 | #define NID_ad_OCSP 178 | ||
945 | #define OBJ_ad_OCSP OBJ_id_ad,1L | ||
946 | |||
947 | #define SN_ad_ca_issuers "caIssuers" | ||
948 | #define LN_ad_ca_issuers "CA Issuers" | ||
949 | #define NID_ad_ca_issuers 179 | ||
950 | #define OBJ_ad_ca_issuers OBJ_id_ad,2L | ||
951 | |||
952 | #define SN_OSCP_sign "OCSPSigning" | ||
953 | #define LN_OCSP_sign "OCSP Signing" | ||
954 | #define NID_OCSP_sign 180 | ||
955 | #define OBJ_OCSP_sign OBJ_id_kp,9L | ||
956 | |||
893 | #include <openssl/bio.h> | 957 | #include <openssl/bio.h> |
894 | #include <openssl/asn1.h> | 958 | #include <openssl/asn1.h> |
895 | 959 | ||