summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGES10
-rw-r--r--crypto/Makefile.ssl13
-rw-r--r--crypto/asn1/Makefile.ssl4
-rw-r--r--crypto/bio/Makefile.ssl4
-rw-r--r--crypto/bn/Makefile.ssl4
-rw-r--r--crypto/buffer/Makefile.ssl4
-rw-r--r--crypto/comp/Makefile.ssl10
-rw-r--r--crypto/conf/Makefile.ssl4
-rw-r--r--crypto/dh/Makefile.ssl4
-rw-r--r--crypto/dsa/Makefile.ssl4
-rw-r--r--crypto/err/err_code.pl117
-rw-r--r--crypto/evp/Makefile.ssl4
-rw-r--r--crypto/md2/Makefile.ssl2
-rw-r--r--crypto/objects/Makefile.ssl4
-rw-r--r--crypto/pem/Makefile.ssl6
-rw-r--r--crypto/pkcs7/Makefile.ssl4
-rw-r--r--crypto/rsa/Makefile.ssl4
-rw-r--r--crypto/x509/Makefile.ssl4
-rw-r--r--rsaref/Makefile.ssl4
-rw-r--r--ssl/Makefile.ssl4
20 files changed, 169 insertions, 45 deletions
diff --git a/CHANGES b/CHANGES
index 2235c937e3..33afc413b7 100644
--- a/CHANGES
+++ b/CHANGES
@@ -5,6 +5,16 @@
Changes between 0.9.1c and 0.9.2
+ *) Changes to the error generation code. The perl script err-code.pl
+ now reads in the old error codes and retains the old numbers, only
+ adding new ones if necessary. It also only changes the .err files if new
+ codes are added. The makefiles have been modified to only insert errors
+ when needed (to avoid needlessly modifying header files). This is done
+ by only inserting errors if the .err file is newer than the auto generated
+ C file. To rebuild all the error codes from scratch (the old behaviour)
+ either modify crypto/Makefile.ssl to pass the -regen flag to err_code.pl
+ or delete all the .err files.
+
*) CAST-128 was incorrectly implemented for short keys. The C version has
been fixed, but is untested. The assembler versions are also fixed, but
new assembler HAS NOT BEEN GENERATED FOR WIN32 - the Makefile needs fixing
diff --git a/crypto/Makefile.ssl b/crypto/Makefile.ssl
index 3303523e08..b91baad738 100644
--- a/crypto/Makefile.ssl
+++ b/crypto/Makefile.ssl
@@ -15,10 +15,6 @@ MAKEFILE= Makefile.ssl
RM= /bin/rm -f
AR= ar r
-MAKE= make -f Makefile.ssl
-MAKEDEPEND= makedepend -f Makefile.ssl
-MAKEFILE= Makefile.ssl
-
PEX_LIBS=
EX_LIBS=
@@ -148,14 +144,19 @@ dclean:
$(MAKE) CC='$(CC)' CFLAG='${CFLAG}' INSTALLTOP='${INSTALLTOP}' PEX_LIBS='${PEX_LIBS}' EX_LIBS='${EX_LIBS}' dclean ); \
done;
-errors:
- perl ./err/err_code.pl -conf err/ssleay.ec *.c */*.c ../ssl/*.c ../rsaref/*.c
+errors: errgen $(ERRC).c
+
+$(ERRC).c: $(ERR).err
perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h
perl err/err_genc.pl -s $(ERR).h $(ERRC).c
+
+errgen:
+ perl ./err/err_code.pl -conf err/ssleay.ec *.c */*.c ../ssl/*.c ../rsaref/*.c
@for i in $(SDIRS) ;\
do \
(cd $$i; echo "making errors in $$i..."; \
$(MAKE) errors ); \
done;
+
# DO NOT DELETE THIS LINE -- make depend depends on it.
diff --git a/crypto/asn1/Makefile.ssl b/crypto/asn1/Makefile.ssl
index fb2c7f36bc..84a4b04d8f 100644
--- a/crypto/asn1/Makefile.ssl
+++ b/crypto/asn1/Makefile.ssl
@@ -113,7 +113,9 @@ dclean:
clean:
/bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
-errors:
+errors: $(ERRC).c
+
+$(ERRC).c: $(ERR).err
perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h
perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c
diff --git a/crypto/bio/Makefile.ssl b/crypto/bio/Makefile.ssl
index 42e11e1c94..3cb667047a 100644
--- a/crypto/bio/Makefile.ssl
+++ b/crypto/bio/Makefile.ssl
@@ -85,7 +85,9 @@ dclean:
clean:
/bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
-errors:
+errors: $(ERRC).c
+
+$(ERRC).c: $(ERR).err
perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h
perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c
diff --git a/crypto/bn/Makefile.ssl b/crypto/bn/Makefile.ssl
index 0a365fca6a..bf3423415b 100644
--- a/crypto/bn/Makefile.ssl
+++ b/crypto/bn/Makefile.ssl
@@ -149,7 +149,9 @@ dclean:
clean:
/bin/rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff bn_asm.s
-errors:
+errors: $(ERRC).c
+
+$(ERRC).c: $(ERR).err
perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).org # special case .org
perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h
perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c
diff --git a/crypto/buffer/Makefile.ssl b/crypto/buffer/Makefile.ssl
index a5f150e523..756e8b1e2d 100644
--- a/crypto/buffer/Makefile.ssl
+++ b/crypto/buffer/Makefile.ssl
@@ -77,7 +77,9 @@ dclean:
clean:
/bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
-errors:
+errors: $(ERRC).c
+
+$(ERRC).c: $(ERR).err
perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h
perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c
diff --git a/crypto/comp/Makefile.ssl b/crypto/comp/Makefile.ssl
index 8673626c94..401651d142 100644
--- a/crypto/comp/Makefile.ssl
+++ b/crypto/comp/Makefile.ssl
@@ -80,7 +80,15 @@ dclean:
clean:
/bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
-errors:
+# This is a dummy to create comp.err: remove if we add any real errors to this
+# stuff.
+
+comp.err:
+ touch comp.err
+
+errors: $(ERRC).c
+
+$(ERRC).c: $(ERR).err
perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h
perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c
diff --git a/crypto/conf/Makefile.ssl b/crypto/conf/Makefile.ssl
index 00e917aa44..720ac43c5d 100644
--- a/crypto/conf/Makefile.ssl
+++ b/crypto/conf/Makefile.ssl
@@ -78,7 +78,9 @@ dclean:
clean:
/bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
-errors:
+errors: $(ERRC).c
+
+$(ERRC).c: $(ERR).err
perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h
perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c
diff --git a/crypto/dh/Makefile.ssl b/crypto/dh/Makefile.ssl
index dfa7e4525d..e634731aa3 100644
--- a/crypto/dh/Makefile.ssl
+++ b/crypto/dh/Makefile.ssl
@@ -77,7 +77,9 @@ dclean:
clean:
/bin/rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
-errors:
+errors: $(ERRC).c
+
+$(ERRC).c: $(ERR).err
perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h
perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c
diff --git a/crypto/dsa/Makefile.ssl b/crypto/dsa/Makefile.ssl
index 2cc4ddb39e..3482f6d652 100644
--- a/crypto/dsa/Makefile.ssl
+++ b/crypto/dsa/Makefile.ssl
@@ -77,7 +77,9 @@ dclean:
clean:
/bin/rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
-errors:
+errors: $(ERRC).c
+
+$(ERRC).c: $(ERR).err
perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h
perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c
diff --git a/crypto/err/err_code.pl b/crypto/err/err_code.pl
index 7f4cd7c216..8b510c96fc 100644
--- a/crypto/err/err_code.pl
+++ b/crypto/err/err_code.pl
@@ -1,4 +1,16 @@
-#!/usr/local/bin/perl
+#!/usr/local/bin/perl -w
+
+# Modified by Steve Henson. It should now read in the .err
+# file and only add new error codes, retaining the old
+# numbers.
+
+# Before it re-sorted new codes and re-ordered the whole thing.
+# This is the motivation for the change: the re numbering caused large
+# patch files even if only one error or reason code was added.
+# To force regeneration of all error codes (the old behaviour) use the
+# -regen flag.
+
+$regen = 0;
while (@ARGV)
{
@@ -23,6 +35,11 @@ while (@ARGV)
close(IN);
next;
}
+ elsif ($in =~ /^-regen/)
+ {
+ $regen = 1;
+ next;
+ }
open(IN,"<$in") || die "unable to open '$in'\n";
$last="";
@@ -30,13 +47,14 @@ while (@ARGV)
{
if (/err\(([A-Z0-9]+_F_[0-9A-Z_]+)\s*,\s*([0-9A-Z]+_R_[0-9A-Z_]+)\s*\)/)
{
- if ($1 != $last)
- {
- if ($function{$1} == 0)
- {
- printf STDERR "$. $1 is bad\n";
- }
- }
+# Not sure what this was supposed to be for: it's broken anyway [steve]
+# if ($1 != $last)
+# {
+# if ($function{$1} == 0)
+# {
+# printf STDERR "$. $1 is bad\n";
+# }
+# }
$function{$1}++;
$last=$1;
$reason{$2}++;
@@ -55,47 +73,74 @@ foreach (keys %function,keys %reason)
@R=sort keys %reason;
foreach $j (sort keys %prefix)
{
+ next if !defined $errfile{$j};
next if $errfile{$j} eq "NONE";
printf STDERR "doing %-6s - ",$j;
+ @f=grep(/^${j}_/,@F);
+ @r=grep(/^${j}_/,@R);
if (defined($errfile{$j}))
{
+ read_errcodes($errfile{$j});
+ # Check to see if any new codes: if not ignore.
+ $new_codes = 0;
+ foreach (@f) {
+ if(!exists $func_codes{$_}) {
+ $new_codes = 1;
+ last;
+ }
+ }
+ if(!$new_codes) {
+ foreach (@r) {
+ if(!exists $reason_codes{$_}) {
+ $new_codes = 1;
+ last;
+ }
+ }
+ }
+ if(!$new_codes) {
+ print STDERR "No New Codes\n";
+ next;
+ }
open(OUT,">$errfile{$j}") ||
die "unable to open '$errfile{$j}':$!\n";
$close_file=1;
}
else
{
+ $min_func = 100;
+ $min_reason = 100;
*OUT=*STDOUT;
- $close=0;
+ $close_file=0;
}
- @f=grep(/^${j}_/,@F);
- @r=grep(/^${j}_/,@R);
- $num=100;
+ $num=$min_func;
print OUT "/* Error codes for the $j functions. */\n\n";
print OUT "/* Function codes. */\n";
$f_count=0;
foreach $i (@f)
{
$z=6-int(length($i)/8);
- printf OUT "#define $i%s $num\n","\t" x $z;
- $num++;
+ if(exists $func_codes{$i}) {
+ printf OUT "#define $i%s $func_codes{$i}\n","\t" x $z;
+ } else {
+ printf OUT "#define $i%s $num\n","\t" x $z;
+ $num++;
+ }
$f_count++;
}
- $num=100;
+ $num=$min_reason;
print OUT "\n/* Reason codes. */\n";
$r_count=0;
foreach $i (@r)
{
$z=6-int(length($i)/8);
- if (defined($r_value{$i}))
- {
+ if (exists $reason_codes{$i}) {
+ printf OUT "#define $i%s $reason_codes{$i}\n","\t" x $z;
+ } elsif (exists $r_value{$i}) {
printf OUT "#define $i%s $r_value{$i}\n","\t" x $z;
- }
- else
- {
+ } else {
printf OUT "#define $i%s $num\n","\t" x $z;
$num++;
- }
+ }
$r_count++;
}
close(OUT) if $close_file;
@@ -103,3 +148,33 @@ foreach $j (sort keys %prefix)
printf STDERR "%3d functions, %3d reasons\n",$f_count,$r_count;
}
+# Read in the error codes and populate %function and %reason with the
+# old codes. Also define $min_func and $min_reason with the smallest
+# unused function and reason codes. Care is needed because the
+# config file can define larger reason codes and these should be
+# ignored.
+
+sub read_errcodes {
+$file = $_[0];
+$min_func = 100;
+$min_reason = 100;
+undef %func_codes;
+undef %reason_codes;
+return if ($regen);
+if (open IN, $file) {
+ while(<IN>) {
+ if(/^#define\s*(\S*)\s*(\S*)/) {
+ if (exists $function{$1} ) {
+ if($2 >= $min_func) {$min_func = $2 + 1;}
+ $func_codes{$1} = $2;
+ } elsif ((defined %reason) && exists $reason{$1}) {
+ $reason_codes{$1} = $2;
+ if( !(exists $r_value{$1}) &&
+ ($2 >= $min_reason))
+ {$min_reason = $2 + 1;}
+ }
+ }
+ }
+ close IN;
+}
+}
diff --git a/crypto/evp/Makefile.ssl b/crypto/evp/Makefile.ssl
index 8bf2516458..902d6fba0d 100644
--- a/crypto/evp/Makefile.ssl
+++ b/crypto/evp/Makefile.ssl
@@ -104,7 +104,9 @@ dclean:
clean:
/bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
-errors:
+errors: $(ERRC).c
+
+$(ERRC).c: $(ERR).err
perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h
perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c
diff --git a/crypto/md2/Makefile.ssl b/crypto/md2/Makefile.ssl
index d8e7200c83..5ea3149438 100644
--- a/crypto/md2/Makefile.ssl
+++ b/crypto/md2/Makefile.ssl
@@ -20,7 +20,7 @@ TEST=md2test.c
APPS=
LIB=$(TOP)/libcrypto.a
-LIBSRC=md2_dgst.c md5_one.c
+LIBSRC=md2_dgst.c md2_one.c
LIBOBJ=md2_dgst.o md2_one.o
SRC= $(LIBSRC)
diff --git a/crypto/objects/Makefile.ssl b/crypto/objects/Makefile.ssl
index 4fa4a7dbf4..a61cde7fec 100644
--- a/crypto/objects/Makefile.ssl
+++ b/crypto/objects/Makefile.ssl
@@ -80,7 +80,9 @@ dclean:
clean:
/bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
-errors:
+errors: $(ERRC).c
+
+$(ERRC).c: $(ERR).err
perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h
perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c
diff --git a/crypto/pem/Makefile.ssl b/crypto/pem/Makefile.ssl
index fc04a88fd9..cbc2d98210 100644
--- a/crypto/pem/Makefile.ssl
+++ b/crypto/pem/Makefile.ssl
@@ -56,7 +56,7 @@ lib: $(LIBOBJ)
files:
perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
-links:
+links: $(EXHEADER)
/bin/rm -f Makefile
$(TOP)/util/point.sh Makefile.ssl Makefile ;
$(TOP)/util/mklink.sh ../../include $(EXHEADER)
@@ -88,7 +88,9 @@ dclean:
clean:
/bin/rm -f $(CTX_SIZE) *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
-errors:
+errors: $(ERRC).c
+
+$(ERRC).c: $(ERR).err
perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).org # SPECIAL CASE .org
perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h
perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c
diff --git a/crypto/pkcs7/Makefile.ssl b/crypto/pkcs7/Makefile.ssl
index a88359b320..7cffde48ef 100644
--- a/crypto/pkcs7/Makefile.ssl
+++ b/crypto/pkcs7/Makefile.ssl
@@ -79,7 +79,9 @@ dclean:
clean:
/bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
-errors:
+errors: $(ERRC).c
+
+$(ERRC).c: $(ERR).err
perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h
perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c
diff --git a/crypto/rsa/Makefile.ssl b/crypto/rsa/Makefile.ssl
index d52f2e609e..f706c41880 100644
--- a/crypto/rsa/Makefile.ssl
+++ b/crypto/rsa/Makefile.ssl
@@ -79,7 +79,9 @@ dclean:
clean:
/bin/rm -f *.o */*.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
-errors:
+errors: $(ERRC).c
+
+$(ERRC).c: $(ERR).err
perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h
perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c
diff --git a/crypto/x509/Makefile.ssl b/crypto/x509/Makefile.ssl
index 1c1ca2ffa0..63c0e214bf 100644
--- a/crypto/x509/Makefile.ssl
+++ b/crypto/x509/Makefile.ssl
@@ -89,7 +89,9 @@ dclean:
clean:
/bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
-errors:
+errors: $(ERRC).c
+
+$(ERRC).c: $(ERR).err
perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h
perl ../err/err_genc.pl -s $(ERR).h $(ERRC).c
diff --git a/rsaref/Makefile.ssl b/rsaref/Makefile.ssl
index f75f0eac32..5f5e742ce1 100644
--- a/rsaref/Makefile.ssl
+++ b/rsaref/Makefile.ssl
@@ -78,7 +78,9 @@ dclean:
clean:
/bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
-errors:
+errors: $(ERRC).c
+
+$(ERRC).c: $(ERR).err
perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h
perl ../crypto/err/err_genc.pl -s $(ERR).h $(ERRC).c
diff --git a/ssl/Makefile.ssl b/ssl/Makefile.ssl
index f4b13bf83b..50b4d6aa45 100644
--- a/ssl/Makefile.ssl
+++ b/ssl/Makefile.ssl
@@ -93,7 +93,9 @@ dclean:
clean:
/bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
-errors:
+errors: $(ERRC).c
+
+$(ERRC).c: $(ERR).err
perl $(TOP)/util/err-ins.pl $(ERR).err $(ERR).h
perl ../crypto/err/err_genc.pl -s $(ERR).h $(ERRC).c