summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/err
diff options
context:
space:
mode:
authorryker <>1998-10-05 20:13:16 +0000
committerryker <>1998-10-05 20:13:16 +0000
commit9e43e2ac1373d5be5c6500c1bc3b1dd6ee9584b4 (patch)
tree51ff319f3510104698e541954d10ad98f9125f36 /src/lib/libcrypto/err
parent9e77c62555877f9a64805c49d0dcd7dbfbb40f4e (diff)
downloadopenbsd-9e43e2ac1373d5be5c6500c1bc3b1dd6ee9584b4.tar.gz
openbsd-9e43e2ac1373d5be5c6500c1bc3b1dd6ee9584b4.tar.bz2
openbsd-9e43e2ac1373d5be5c6500c1bc3b1dd6ee9584b4.zip
Import of SSLeay-0.9.0b with RSA and IDEA stubbed + OpenBSD build
functionality for shared libs. Note that routines such as sslv2_init and friends that use RSA will not work due to lack of RSA in this library. Needs documentation and help from ports for easy upgrade to full functionality where legally possible.
Diffstat (limited to 'src/lib/libcrypto/err')
-rw-r--r--src/lib/libcrypto/err/err_code.pl105
-rw-r--r--src/lib/libcrypto/err/err_genc.pl198
-rw-r--r--src/lib/libcrypto/err/error.err13
-rw-r--r--src/lib/libcrypto/err/ssleay.ec57
4 files changed, 373 insertions, 0 deletions
diff --git a/src/lib/libcrypto/err/err_code.pl b/src/lib/libcrypto/err/err_code.pl
new file mode 100644
index 0000000000..ebc8eef913
--- /dev/null
+++ b/src/lib/libcrypto/err/err_code.pl
@@ -0,0 +1,105 @@
1#!/usr/bin/perl
2
3while (@ARGV)
4 {
5 $in=shift(@ARGV);
6 if ($in =~ /^-conf$/)
7 {
8 $in=shift(@ARGV);
9 open(IN,"<$in") || die "unable to open '$in'\n";
10 while (<IN>)
11 {
12 s/#.*$//;
13 s/\s+$//;
14 next if (/^$/);
15 if (/^L\s+(\S+)\s+(\S+)$/)
16 { $errfile{$1}=$2; }
17 elsif (/^F\s+(\S+)$/)
18 { $function{$1}=1; }
19 elsif (/^R\s+(\S+)\s+(\S+)$/)
20 { $r_value{$1}=$2; }
21 else { die "bad input line: $in:$.\n"; }
22 }
23 close(IN);
24 next;
25 }
26
27 open(IN,"<$in") || die "unable to open '$in'\n";
28 $last="";
29 while (<IN>)
30 {
31 if (/err\(([A-Z0-9]+_F_[0-9A-Z_]+)\s*,\s*([0-9A-Z]+_R_[0-9A-Z_]+)\s*\)/)
32 {
33 if ($1 != $last)
34 {
35 if ($function{$1} == 0)
36 {
37 printf STDERR "$. $1 is bad\n";
38 }
39 }
40 $function{$1}++;
41 $last=$1;
42 $reason{$2}++;
43 }
44 }
45 close(IN);
46 }
47
48foreach (keys %function,keys %reason)
49 {
50 /^([A-Z0-9]+)_/;
51 $prefix{$1}++;
52 }
53
54@F=sort keys %function;
55@R=sort keys %reason;
56foreach $j (sort keys %prefix)
57 {
58 next if $errfile{$j} eq "NONE";
59 printf STDERR "doing %-6s - ",$j;
60 if (defined($errfile{$j}))
61 {
62 open(OUT,">$errfile{$j}") ||
63 die "unable to open '$errfile{$j}':$!\n";
64 $close_file=1;
65 }
66 else
67 {
68 *OUT=*STDOUT;
69 $close=0;
70 }
71 @f=grep(/^${j}_/,@F);
72 @r=grep(/^${j}_/,@R);
73 $num=100;
74 print OUT "/* Error codes for the $j functions. */\n\n";
75 print OUT "/* Function codes. */\n";
76 $f_count=0;
77 foreach $i (@f)
78 {
79 $z=6-int(length($i)/8);
80 printf OUT "#define $i%s $num\n","\t" x $z;
81 $num++;
82 $f_count++;
83 }
84 $num=100;
85 print OUT "\n/* Reason codes. */\n";
86 $r_count=0;
87 foreach $i (@r)
88 {
89 $z=6-int(length($i)/8);
90 if (defined($r_value{$i}))
91 {
92 printf OUT "#define $i%s $r_value{$i}\n","\t" x $z;
93 }
94 else
95 {
96 printf OUT "#define $i%s $num\n","\t" x $z;
97 $num++;
98 }
99 $r_count++;
100 }
101 close(OUT) if $close_file;
102
103 printf STDERR "%3d functions, %3d reasons\n",$f_count,$r_count;
104 }
105
diff --git a/src/lib/libcrypto/err/err_genc.pl b/src/lib/libcrypto/err/err_genc.pl
new file mode 100644
index 0000000000..a8e36c2f0c
--- /dev/null
+++ b/src/lib/libcrypto/err/err_genc.pl
@@ -0,0 +1,198 @@
1#!/usr/bin/perl
2
3if ($ARGV[0] eq "-s") { $static=1; shift @ARGV; }
4
5($#ARGV == 1) || die "usage: $0 [-s] <header file> <output C file>\n";
6open(IN,"<$ARGV[0]") || die "unable to open $ARGV[0]:$!\n";
7open(STDOUT,">$ARGV[1]") || die "unable to open $ARGV[1]:$!\n";
8
9$Func=0;
10$Reas=0;
11$fuction{'FOPEN'}='fopen';
12while (<IN>)
13 {
14 if (/(\S+)\s*\(\);/)
15 {
16 $t=$1;
17 $t =~ s/\*//;
18 ($upper=$t) =~ tr/a-z/A-Z/;
19 $fuction{$upper}=$t;
20 }
21 next unless (/^#define\s+(\S+)\s/);
22
23 $o=$1;
24 if ($o =~ /^([^_]+)_F_(.*)/)
25 {
26 $type=$1;
27 $Func++;
28 $n=$2;
29 $n=$fuction{$n} if (defined($fuction{$n}));
30 $out{$1."_str_functs"}.=
31 sprintf("{ERR_PACK(0,%s,0),\t\"$n\"},\n",$o);
32 }
33 elsif ($o =~ /^([^_]+)_R_(.*)/)
34 {
35 $type=$1;
36 $Reas++;
37 $r=$2;
38 $r =~ tr/A-Z_/a-z /;
39 $pkg{$type."_str_reasons"}=$type;
40 $out{$type."_str_reasons"}.=sprintf("{%-40s,\"$r\"},\n",$o);
41 }
42 elsif ($ARGV[0] =~ /rsaref/ && $o =~ /^RE_(.*)/)
43 {
44 $type="RSAREF";
45 $Reas++;
46 $r=$1;
47 $r =~ tr/A-Z_/a-z /;
48 $pkg{$type."_str_reasons"}=$type;
49 $out{$type."_str_reasons"}.=sprintf("{%-40s,\"$r\"},\n",$o);
50 }
51 }
52close(IN);
53
54&header($type,$ARGV[0]);
55
56foreach (sort keys %out)
57 {
58 print "static ERR_STRING_DATA ${_}[]=\n\t{\n";
59 print $out{$_};
60 print "{0,NULL},\n";
61 print "\t};\n\n";
62 }
63print "#endif\n";
64
65if ($static)
66 { $lib="ERR_LIB_$type"; }
67else
68 { $lib="${type}_lib_error_code"; }
69
70$str="";
71$str.="#ifndef NO_ERR\n";
72$str.="\t\tERR_load_strings($lib,${type}_str_functs);\n" if $Func;
73$str.="\t\tERR_load_strings($lib,${type}_str_reasons);\n" if $Reas;
74$str.="#endif\n";
75
76if (!$static)
77 {
78print <<"EOF";
79
80static int ${type}_lib_error_code=0;
81
82void ERR_load_${type}_strings()
83 {
84 static int init=1;
85
86 if (${type}_lib_error_code == 0)
87 ${type}_lib_error_code=ERR_get_next_error_library();
88
89 if (init);
90 {;
91 init=0;
92$str
93 }
94 }
95
96void ERR_${type}_error(function,reason,file,line)
97int function;
98int reason;
99char *file;
100int line;
101 {
102 if (${type}_lib_error_code == 0)
103 ${type}_lib_error_code=ERR_get_next_error_library();
104 ERR_PUT_error(${type}_lib_error_code,function,reason,file,line);
105 }
106EOF
107 }
108else # $static
109 {
110 print <<"EOF";
111
112void ERR_load_${type}_strings()
113 {
114 static int init=1;
115
116 if (init);
117 {;
118 init=0;
119$str
120 }
121 }
122EOF
123 }
124
125sub header
126 {
127 ($type,$header)=@_;
128
129 ($lc=$type) =~ tr/A-Z/a-z/;
130 $header =~ s/^.*\///;
131
132 print "/* lib/$lc/${lc}\_err.c */\n";
133 print <<'EOF';
134/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com)
135 * All rights reserved.
136 *
137 * This package is an SSL implementation written
138 * by Eric Young (eay@cryptsoft.com).
139 * The implementation was written so as to conform with Netscapes SSL.
140 *
141 * This library is free for commercial and non-commercial use as long as
142 * the following conditions are aheared to. The following conditions
143 * apply to all code found in this distribution, be it the RC4, RSA,
144 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
145 * included with this distribution is covered by the same copyright terms
146 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
147 *
148 * Copyright remains Eric Young's, and as such any Copyright notices in
149 * the code are not to be removed.
150 * If this package is used in a product, Eric Young should be given attribution
151 * as the author of the parts of the library used.
152 * This can be in the form of a textual message at program startup or
153 * in documentation (online or textual) provided with the package.
154 *
155 * Redistribution and use in source and binary forms, with or without
156 * modification, are permitted provided that the following conditions
157 * are met:
158 * 1. Redistributions of source code must retain the copyright
159 * notice, this list of conditions and the following disclaimer.
160 * 2. Redistributions in binary form must reproduce the above copyright
161 * notice, this list of conditions and the following disclaimer in the
162 * documentation and/or other materials provided with the distribution.
163 * 3. All advertising materials mentioning features or use of this software
164 * must display the following acknowledgement:
165 * "This product includes cryptographic software written by
166 * Eric Young (eay@cryptsoft.com)"
167 * The word 'cryptographic' can be left out if the rouines from the library
168 * being used are not cryptographic related :-).
169 * 4. If you include any Windows specific code (or a derivative thereof) from
170 * the apps directory (application code) you must include an acknowledgement:
171 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
172 *
173 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
174 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
175 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
176 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
177 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
178 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
179 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
180 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
181 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
182 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
183 * SUCH DAMAGE.
184 *
185 * The licence and distribution terms for any publically available version or
186 * derivative of this code cannot be changed. i.e. this code cannot simply be
187 * copied and put under another distribution licence
188 * [including the GNU Public Licence.]
189 */
190EOF
191
192 print "#include <stdio.h>\n";
193 print "#include \"err.h\"\n";
194 print "#include \"$header\"\n";
195 print "\n/* BEGIN ERROR CODES */\n";
196 print "#ifndef NO_ERR\n";
197 }
198
diff --git a/src/lib/libcrypto/err/error.err b/src/lib/libcrypto/err/error.err
new file mode 100644
index 0000000000..f09557d8d9
--- /dev/null
+++ b/src/lib/libcrypto/err/error.err
@@ -0,0 +1,13 @@
1/* Error codes for the ERR functions. */
2
3/* Function codes. */
4
5/* Reason codes. */
6#define ERR_R_BN_LIB 100
7#define ERR_R_DER_LIB 101
8#define ERR_R_MALLOC_FAILURE 102
9#define ERR_R_PEM_LIB 103
10#define ERR_R_RSA_LIB 104
11#define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED 105
12#define ERR_R_SYS_LIB 106
13#define ERR_R_X509_LIB 107
diff --git a/src/lib/libcrypto/err/ssleay.ec b/src/lib/libcrypto/err/ssleay.ec
new file mode 100644
index 0000000000..10b5dbb59d
--- /dev/null
+++ b/src/lib/libcrypto/err/ssleay.ec
@@ -0,0 +1,57 @@
1L ERR NONE
2L CRYPTO crypto.err
3L BN bn/bn.err
4L RSA rsa/rsa.err
5L DSA dsa/dsa.err
6L DH dh/dh.err
7L EVP evp/evp.err
8L BUF buffer/buffer.err
9L BIO bio/bio.err
10L OBJ objects/objects.err
11L PEM pem/pem.err
12L X509 x509/x509.err
13L METH meth/meth.err
14L ASN1 asn1/asn1.err
15L CONF conf/conf.err
16L PROXY proxy/proxy.err
17L PKCS7 pkcs7/pkcs7.err
18L RSAREF ../rsaref/rsaref.err
19L SSL ../ssl/ssl.err
20L SSL2 ../ssl/ssl2.err
21L SSL3 ../ssl/ssl3.err
22L SSL23 ../ssl/ssl23.err
23
24F RSAREF_F_RSA_BN2BIN
25F RSAREF_F_RSA_PRIVATE_DECRYPT
26F RSAREF_F_RSA_PRIVATE_ENCRYPT
27F RSAREF_F_RSA_PUBLIC_DECRYPT
28F RSAREF_F_RSA_PUBLIC_ENCRYPT
29#F SSL_F_CLIENT_CERTIFICATE
30
31R SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE 1010
32R SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020
33R SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE 1030
34R SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE 1040
35R SSL_R_SSLV3_ALERT_NO_CERTIFICATE 1041
36R SSL_R_SSLV3_ALERT_BAD_CERTIFICATE 1042
37R SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE 1043
38R SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED 1044
39R SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED 1045
40R SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN 1046
41R SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER 1047
42
43R RSAREF_R_CONTENT_ENCODING 0x0400
44R RSAREF_R_DATA 0x0401
45R RSAREF_R_DIGEST_ALGORITHM 0x0402
46R RSAREF_R_ENCODING 0x0403
47R RSAREF_R_KEY 0x0404
48R RSAREF_R_KEY_ENCODING 0x0405
49R RSAREF_R_LEN 0x0406
50R RSAREF_R_MODULUS_LEN 0x0407
51R RSAREF_R_NEED_RANDOM 0x0408
52R RSAREF_R_PRIVATE_KEY 0x0409
53R RSAREF_R_PUBLIC_KEY 0x040a
54R RSAREF_R_SIGNATURE 0x040b
55R RSAREF_R_SIGNATURE_ENCODING 0x040c
56R RSAREF_R_ENCRYPTION_ALGORITHM 0x040d
57