diff options
Diffstat (limited to 'src/lib/libcrypto/objects/obj_dat.pl')
-rw-r--r-- | src/lib/libcrypto/objects/obj_dat.pl | 54 |
1 files changed, 30 insertions, 24 deletions
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 | { |