| OLD | NEW |
| 1 #!/usr/local/bin/perl | 1 #!/usr/local/bin/perl |
| 2 | 2 |
| 3 # fixes bug in floating point emulation on sparc64 when | 3 # fixes bug in floating point emulation on sparc64 when |
| 4 # this script produces off-by-one output on sparc64 | 4 # this script produces off-by-one output on sparc64 |
| 5 eval 'use integer;'; | 5 use integer; |
| 6 | |
| 7 print STDERR "Warning: perl module integer not found.\n" if ($@); | |
| 8 | 6 |
| 9 sub obj_cmp | 7 sub obj_cmp |
| 10 { | 8 { |
| 11 local(@a,@b,$_,$r); | 9 local(@a,@b,$_,$r); |
| 12 | 10 |
| 13 $A=$obj_len{$obj{$nid{$a}}}; | 11 $A=$obj_len{$obj{$nid{$a}}}; |
| 14 $B=$obj_len{$obj{$nid{$b}}}; | 12 $B=$obj_len{$obj{$nid{$b}}}; |
| 15 | 13 |
| 16 $r=($A-$B); | 14 $r=($A-$B); |
| 17 return($r) if $r != 0; | 15 return($r) if $r != 0; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 $out.="0,NULL,0"; | 141 $out.="0,NULL,0"; |
| 144 } | 142 } |
| 145 $out.="},\n"; | 143 $out.="},\n"; |
| 146 push(@out,$out); | 144 push(@out,$out); |
| 147 } | 145 } |
| 148 } | 146 } |
| 149 | 147 |
| 150 @a=grep(defined($sn{$nid{$_}}),0 .. $n); | 148 @a=grep(defined($sn{$nid{$_}}),0 .. $n); |
| 151 foreach (sort { $sn{$nid{$a}} cmp $sn{$nid{$b}} } @a) | 149 foreach (sort { $sn{$nid{$a}} cmp $sn{$nid{$b}} } @a) |
| 152 { | 150 { |
| 153 » push(@sn,sprintf("&(nid_objs[%2d]),/* \"$sn{$nid{$_}}\" */\n",$_)); | 151 » push(@sn,sprintf("%2d,\t/* \"$sn{$nid{$_}}\" */\n",$_)); |
| 154 } | 152 } |
| 155 | 153 |
| 156 @a=grep(defined($ln{$nid{$_}}),0 .. $n); | 154 @a=grep(defined($ln{$nid{$_}}),0 .. $n); |
| 157 foreach (sort { $ln{$nid{$a}} cmp $ln{$nid{$b}} } @a) | 155 foreach (sort { $ln{$nid{$a}} cmp $ln{$nid{$b}} } @a) |
| 158 { | 156 { |
| 159 » push(@ln,sprintf("&(nid_objs[%2d]),/* \"$ln{$nid{$_}}\" */\n",$_)); | 157 » push(@ln,sprintf("%2d,\t/* \"$ln{$nid{$_}}\" */\n",$_)); |
| 160 } | 158 } |
| 161 | 159 |
| 162 @a=grep(defined($obj{$nid{$_}}),0 .. $n); | 160 @a=grep(defined($obj{$nid{$_}}),0 .. $n); |
| 163 foreach (sort obj_cmp @a) | 161 foreach (sort obj_cmp @a) |
| 164 { | 162 { |
| 165 $m=$obj{$nid{$_}}; | 163 $m=$obj{$nid{$_}}; |
| 166 $v=$objd{$m}; | 164 $v=$objd{$m}; |
| 167 $v =~ s/L//g; | 165 $v =~ s/L//g; |
| 168 $v =~ s/,/ /g; | 166 $v =~ s/,/ /g; |
| 169 » push(@ob,sprintf("&(nid_objs[%2d]),/* %-32s %s */\n",$_,$m,$v)); | 167 » push(@ob,sprintf("%2d,\t/* %-32s %s */\n",$_,$m,$v)); |
| 170 } | 168 } |
| 171 | 169 |
| 172 print OUT <<'EOF'; | 170 print OUT <<'EOF'; |
| 173 /* crypto/objects/obj_dat.h */ | 171 /* crypto/objects/obj_dat.h */ |
| 174 | 172 |
| 175 /* THIS FILE IS GENERATED FROM objects.h by obj_dat.pl via the | 173 /* THIS FILE IS GENERATED FROM objects.h by obj_dat.pl via the |
| 176 * following command: | 174 * following command: |
| 177 * perl obj_dat.pl obj_mac.h obj_dat.h | 175 * perl obj_dat.pl obj_mac.h obj_dat.h |
| 178 */ | 176 */ |
| 179 | 177 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 * [including the GNU Public Licence.] | 232 * [including the GNU Public Licence.] |
| 235 */ | 233 */ |
| 236 | 234 |
| 237 EOF | 235 EOF |
| 238 | 236 |
| 239 printf OUT "#define NUM_NID %d\n",$n; | 237 printf OUT "#define NUM_NID %d\n",$n; |
| 240 printf OUT "#define NUM_SN %d\n",$#sn+1; | 238 printf OUT "#define NUM_SN %d\n",$#sn+1; |
| 241 printf OUT "#define NUM_LN %d\n",$#ln+1; | 239 printf OUT "#define NUM_LN %d\n",$#ln+1; |
| 242 printf OUT "#define NUM_OBJ %d\n\n",$#ob+1; | 240 printf OUT "#define NUM_OBJ %d\n\n",$#ob+1; |
| 243 | 241 |
| 244 printf OUT "static unsigned char lvalues[%d]={\n",$lvalues+1; | 242 printf OUT "static const unsigned char lvalues[%d]={\n",$lvalues+1; |
| 245 print OUT @lvalues; | 243 print OUT @lvalues; |
| 246 print OUT "};\n\n"; | 244 print OUT "};\n\n"; |
| 247 | 245 |
| 248 printf OUT "static ASN1_OBJECT nid_objs[NUM_NID]={\n"; | 246 printf OUT "static const ASN1_OBJECT nid_objs[NUM_NID]={\n"; |
| 249 foreach (@out) | 247 foreach (@out) |
| 250 { | 248 { |
| 251 if (length($_) > 75) | 249 if (length($_) > 75) |
| 252 { | 250 { |
| 253 $out=""; | 251 $out=""; |
| 254 foreach (split(/,/)) | 252 foreach (split(/,/)) |
| 255 { | 253 { |
| 256 $t=$out.$_.","; | 254 $t=$out.$_.","; |
| 257 if (length($t) > 70) | 255 if (length($t) > 70) |
| 258 { | 256 { |
| 259 print OUT "$out\n"; | 257 print OUT "$out\n"; |
| 260 $t="\t$_,"; | 258 $t="\t$_,"; |
| 261 } | 259 } |
| 262 $out=$t; | 260 $out=$t; |
| 263 } | 261 } |
| 264 chop $out; | 262 chop $out; |
| 265 print OUT "$out"; | 263 print OUT "$out"; |
| 266 } | 264 } |
| 267 else | 265 else |
| 268 { print OUT $_; } | 266 { print OUT $_; } |
| 269 } | 267 } |
| 270 print OUT "};\n\n"; | 268 print OUT "};\n\n"; |
| 271 | 269 |
| 272 printf OUT "static ASN1_OBJECT *sn_objs[NUM_SN]={\n"; | 270 printf OUT "static const unsigned int sn_objs[NUM_SN]={\n"; |
| 273 print OUT @sn; | 271 print OUT @sn; |
| 274 print OUT "};\n\n"; | 272 print OUT "};\n\n"; |
| 275 | 273 |
| 276 printf OUT "static ASN1_OBJECT *ln_objs[NUM_LN]={\n"; | 274 printf OUT "static const unsigned int ln_objs[NUM_LN]={\n"; |
| 277 print OUT @ln; | 275 print OUT @ln; |
| 278 print OUT "};\n\n"; | 276 print OUT "};\n\n"; |
| 279 | 277 |
| 280 printf OUT "static ASN1_OBJECT *obj_objs[NUM_OBJ]={\n"; | 278 printf OUT "static const unsigned int obj_objs[NUM_OBJ]={\n"; |
| 281 print OUT @ob; | 279 print OUT @ob; |
| 282 print OUT "};\n\n"; | 280 print OUT "};\n\n"; |
| 283 | 281 |
| 284 close OUT; | 282 close OUT; |
| 285 | 283 |
| 286 sub der_it | 284 sub der_it |
| 287 { | 285 { |
| 288 local($v)=@_; | 286 local($v)=@_; |
| 289 local(@a,$i,$ret,@r); | 287 local(@a,$i,$ret,@r); |
| 290 | 288 |
| 291 @a=split(/\s+/,$v); | 289 @a=split(/\s+/,$v); |
| 292 $ret.=pack("C*",$a[0]*40+$a[1]); | 290 $ret.=pack("C*",$a[0]*40+$a[1]); |
| 293 shift @a; | 291 shift @a; |
| 294 shift @a; | 292 shift @a; |
| 295 foreach (@a) | 293 foreach (@a) |
| 296 { | 294 { |
| 297 @r=(); | 295 @r=(); |
| 298 $t=0; | 296 $t=0; |
| 299 while ($_ >= 128) | 297 while ($_ >= 128) |
| 300 { | 298 { |
| 301 $x=$_%128; | 299 $x=$_%128; |
| 302 $_/=128; | 300 $_/=128; |
| 303 push(@r,((($t++)?0x80:0)|$x)); | 301 push(@r,((($t++)?0x80:0)|$x)); |
| 304 } | 302 } |
| 305 push(@r,((($t++)?0x80:0)|$_)); | 303 push(@r,((($t++)?0x80:0)|$_)); |
| 306 $ret.=pack("C*",reverse(@r)); | 304 $ret.=pack("C*",reverse(@r)); |
| 307 } | 305 } |
| 308 return($ret); | 306 return($ret); |
| 309 } | 307 } |
| OLD | NEW |