diff options
Diffstat (limited to 'src/lib/libcrypto/util/mkerr.pl')
-rw-r--r-- | src/lib/libcrypto/util/mkerr.pl | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/src/lib/libcrypto/util/mkerr.pl b/src/lib/libcrypto/util/mkerr.pl index 60e534807e..9678514604 100644 --- a/src/lib/libcrypto/util/mkerr.pl +++ b/src/lib/libcrypto/util/mkerr.pl | |||
@@ -9,6 +9,9 @@ my $reindex = 0; | |||
9 | my $dowrite = 0; | 9 | my $dowrite = 0; |
10 | my $staticloader = ""; | 10 | my $staticloader = ""; |
11 | 11 | ||
12 | my $pack_errcode; | ||
13 | my $load_errcode; | ||
14 | |||
12 | while (@ARGV) { | 15 | while (@ARGV) { |
13 | my $arg = $ARGV[0]; | 16 | my $arg = $ARGV[0]; |
14 | if($arg eq "-conf") { | 17 | if($arg eq "-conf") { |
@@ -41,8 +44,8 @@ while (@ARGV) { | |||
41 | } | 44 | } |
42 | 45 | ||
43 | if($recurse) { | 46 | if($recurse) { |
44 | @source = (<crypto/*.c>, <crypto/*/*.c>, <ssl/*.c>, <fips/*.c>, | 47 | @source = (<crypto/*.c>, <crypto/*/*.c>, <ssl/*.c>, <fips-1.0/*.c>, |
45 | <fips/*/*.c>); | 48 | <fips-1.0/*/*.c>); |
46 | } else { | 49 | } else { |
47 | @source = @ARGV; | 50 | @source = @ARGV; |
48 | } | 51 | } |
@@ -399,6 +402,20 @@ EOF | |||
399 | $hincf = "\"$hfile\""; | 402 | $hincf = "\"$hfile\""; |
400 | } | 403 | } |
401 | 404 | ||
405 | # If static we know the error code at compile time so use it | ||
406 | # in error definitions. | ||
407 | |||
408 | if ($static) | ||
409 | { | ||
410 | $pack_errcode = "ERR_LIB_${lib}"; | ||
411 | $load_errcode = "0"; | ||
412 | } | ||
413 | else | ||
414 | { | ||
415 | $pack_errcode = "0"; | ||
416 | $load_errcode = "ERR_LIB_${lib}"; | ||
417 | } | ||
418 | |||
402 | 419 | ||
403 | open (OUT,">$cfile") || die "Can't open $cfile for writing"; | 420 | open (OUT,">$cfile") || die "Can't open $cfile for writing"; |
404 | 421 | ||
@@ -469,6 +486,10 @@ EOF | |||
469 | 486 | ||
470 | /* BEGIN ERROR CODES */ | 487 | /* BEGIN ERROR CODES */ |
471 | #ifndef OPENSSL_NO_ERR | 488 | #ifndef OPENSSL_NO_ERR |
489 | |||
490 | #define ERR_FUNC(func) ERR_PACK($pack_errcode,func,0) | ||
491 | #define ERR_REASON(reason) ERR_PACK($pack_errcode,0,reason) | ||
492 | |||
472 | static ERR_STRING_DATA ${lib}_str_functs[]= | 493 | static ERR_STRING_DATA ${lib}_str_functs[]= |
473 | { | 494 | { |
474 | EOF | 495 | EOF |
@@ -480,7 +501,8 @@ EOF | |||
480 | if(exists $ftrans{$fn}) { | 501 | if(exists $ftrans{$fn}) { |
481 | $fn = $ftrans{$fn}; | 502 | $fn = $ftrans{$fn}; |
482 | } | 503 | } |
483 | print OUT "{ERR_PACK(0,$i,0),\t\"$fn\"},\n"; | 504 | # print OUT "{ERR_PACK($pack_errcode,$i,0),\t\"$fn\"},\n"; |
505 | print OUT "{ERR_FUNC($i),\t\"$fn\"},\n"; | ||
484 | } | 506 | } |
485 | print OUT <<"EOF"; | 507 | print OUT <<"EOF"; |
486 | {0,NULL} | 508 | {0,NULL} |
@@ -492,6 +514,7 @@ EOF | |||
492 | # Add each reason code. | 514 | # Add each reason code. |
493 | foreach $i (@reasons) { | 515 | foreach $i (@reasons) { |
494 | my $rn; | 516 | my $rn; |
517 | my $rstr = "ERR_REASON($i)"; | ||
495 | my $nspc = 0; | 518 | my $nspc = 0; |
496 | if (exists $err_reason_strings{$i}) { | 519 | if (exists $err_reason_strings{$i}) { |
497 | $rn = $err_reason_strings{$i}; | 520 | $rn = $err_reason_strings{$i}; |
@@ -500,9 +523,9 @@ EOF | |||
500 | $rn = $1; | 523 | $rn = $1; |
501 | $rn =~ tr/_[A-Z]/ [a-z]/; | 524 | $rn =~ tr/_[A-Z]/ [a-z]/; |
502 | } | 525 | } |
503 | $nspc = 40 - length($i) unless length($i) > 40; | 526 | $nspc = 40 - length($rstr) unless length($rstr) > 40; |
504 | $nspc = " " x $nspc; | 527 | $nspc = " " x $nspc; |
505 | print OUT "{${i}${nspc},\"$rn\"},\n"; | 528 | print OUT "{${rstr}${nspc},\"$rn\"},\n"; |
506 | } | 529 | } |
507 | if($static) { | 530 | if($static) { |
508 | print OUT <<"EOF"; | 531 | print OUT <<"EOF"; |
@@ -519,8 +542,8 @@ ${staticloader}void ERR_load_${lib}_strings(void) | |||
519 | { | 542 | { |
520 | init=0; | 543 | init=0; |
521 | #ifndef OPENSSL_NO_ERR | 544 | #ifndef OPENSSL_NO_ERR |
522 | ERR_load_strings(ERR_LIB_${lib},${lib}_str_functs); | 545 | ERR_load_strings($load_errcode,${lib}_str_functs); |
523 | ERR_load_strings(ERR_LIB_${lib},${lib}_str_reasons); | 546 | ERR_load_strings($load_errcode,${lib}_str_reasons); |
524 | #endif | 547 | #endif |
525 | 548 | ||
526 | } | 549 | } |