summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/err
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/err')
-rw-r--r--src/lib/libcrypto/err/Makefile.ssl60
-rw-r--r--src/lib/libcrypto/err/err.c185
-rw-r--r--src/lib/libcrypto/err/err.h82
-rw-r--r--src/lib/libcrypto/err/err_all.c34
-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/err_prn.c20
-rw-r--r--src/lib/libcrypto/err/error.err13
-rw-r--r--src/lib/libcrypto/err/openssl.ec71
-rw-r--r--src/lib/libcrypto/err/ssleay.ec57
10 files changed, 266 insertions, 559 deletions
diff --git a/src/lib/libcrypto/err/Makefile.ssl b/src/lib/libcrypto/err/Makefile.ssl
index 57c87eb041..e0f5128f43 100644
--- a/src/lib/libcrypto/err/Makefile.ssl
+++ b/src/lib/libcrypto/err/Makefile.ssl
@@ -7,9 +7,11 @@ TOP= ../..
7CC= cc 7CC= cc
8INCLUDES= -I.. -I../../include 8INCLUDES= -I.. -I../../include
9CFLAG=-g 9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
10INSTALLTOP=/usr/local/ssl 12INSTALLTOP=/usr/local/ssl
11MAKE= make -f Makefile.ssl 13MAKE= make -f Makefile.ssl
12MAKEDEPEND= makedepend -f Makefile.ssl 14MAKEDEPEND= $(TOP)/util/domd $(TOP)
13MAKEFILE= Makefile.ssl 15MAKEFILE= Makefile.ssl
14AR= ar r 16AR= ar r
15 17
@@ -37,24 +39,23 @@ all: lib
37 39
38lib: $(LIBOBJ) 40lib: $(LIBOBJ)
39 $(AR) $(LIB) $(LIBOBJ) 41 $(AR) $(LIB) $(LIBOBJ)
40 sh $(TOP)/util/ranlib.sh $(LIB) 42 $(RANLIB) $(LIB)
41 @touch lib 43 @touch lib
42 44
43files: 45files:
44 perl $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO 46 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
45 47
46links: 48links:
47 /bin/rm -f Makefile 49 @$(TOP)/util/point.sh Makefile.ssl Makefile
48 $(TOP)/util/point.sh Makefile.ssl Makefile ; 50 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
49 $(TOP)/util/mklink.sh ../../include $(EXHEADER) 51 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
50 $(TOP)/util/mklink.sh ../../test $(TEST) 52 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
51 $(TOP)/util/mklink.sh ../../apps $(APPS)
52 53
53install: 54install:
54 @for i in $(EXHEADER) ; \ 55 @for i in $(EXHEADER) ; \
55 do \ 56 do \
56 (cp $$i $(INSTALLTOP)/include/$$i; \ 57 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
57 chmod 644 $(INSTALLTOP)/include/$$i ); \ 58 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
58 done; 59 done;
59 60
60tags: 61tags:
@@ -66,15 +67,44 @@ lint:
66 lint -DLINT $(INCLUDES) $(SRC)>fluff 67 lint -DLINT $(INCLUDES) $(SRC)>fluff
67 68
68depend: 69depend:
69 $(MAKEDEPEND) $(INCLUDES) $(PROGS) $(LIBSRC) 70 $(MAKEDEPEND) $(INCLUDES) $(DEPFLAG) $(PROGS) $(LIBSRC)
70 71
71dclean: 72dclean:
72 perl -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new 73 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
73 mv -f Makefile.new $(MAKEFILE) 74 mv -f Makefile.new $(MAKEFILE)
74 75
75clean: 76clean:
76 /bin/rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff 77 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
77
78errors:
79 78
80# DO NOT DELETE THIS LINE -- make depend depends on it. 79# DO NOT DELETE THIS LINE -- make depend depends on it.
80
81err.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
82err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
83err.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
84err.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
85err.o: ../../include/openssl/opensslv.h ../../include/openssl/stack.h
86err.o: ../cryptlib.h
87err_all.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
88err_all.o: ../../include/openssl/blowfish.h ../../include/openssl/bn.h
89err_all.o: ../../include/openssl/buffer.h ../../include/openssl/cast.h
90err_all.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
91err_all.o: ../../include/openssl/des.h ../../include/openssl/dh.h
92err_all.o: ../../include/openssl/dsa.h ../../include/openssl/e_os2.h
93err_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h
94err_all.o: ../../include/openssl/idea.h ../../include/openssl/lhash.h
95err_all.o: ../../include/openssl/md2.h ../../include/openssl/md5.h
96err_all.o: ../../include/openssl/mdc2.h ../../include/openssl/objects.h
97err_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
98err_all.o: ../../include/openssl/pem2.h ../../include/openssl/pkcs12.h
99err_all.o: ../../include/openssl/pkcs7.h ../../include/openssl/rc2.h
100err_all.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
101err_all.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
102err_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
103err_all.o: ../../include/openssl/stack.h ../../include/openssl/x509.h
104err_all.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
105err_prn.o: ../../include/openssl/bio.h ../../include/openssl/buffer.h
106err_prn.o: ../../include/openssl/crypto.h ../../include/openssl/e_os.h
107err_prn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
108err_prn.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
109err_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/stack.h
110err_prn.o: ../cryptlib.h
diff --git a/src/lib/libcrypto/err/err.c b/src/lib/libcrypto/err/err.c
index 5aef6a1259..8810d838c6 100644
--- a/src/lib/libcrypto/err/err.c
+++ b/src/lib/libcrypto/err/err.c
@@ -57,34 +57,25 @@
57 */ 57 */
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "lhash.h" 60#include <stdarg.h>
61#include "crypto.h" 61#include <openssl/lhash.h>
62#include <openssl/crypto.h>
62#include "cryptlib.h" 63#include "cryptlib.h"
63#include "buffer.h" 64#include <openssl/buffer.h>
64#include "err.h" 65#include <openssl/err.h>
65#include "crypto.h" 66#include <openssl/crypto.h>
66 67
67 68
68static LHASH *error_hash=NULL; 69static LHASH *error_hash=NULL;
69static LHASH *thread_hash=NULL; 70static LHASH *thread_hash=NULL;
70 71
71#ifndef NOPROTO
72static unsigned long err_hash(ERR_STRING_DATA *a); 72static unsigned long err_hash(ERR_STRING_DATA *a);
73static int err_cmp(ERR_STRING_DATA *a, ERR_STRING_DATA *b); 73static int err_cmp(ERR_STRING_DATA *a, ERR_STRING_DATA *b);
74static unsigned long pid_hash(ERR_STATE *pid); 74static unsigned long pid_hash(ERR_STATE *pid);
75static int pid_cmp(ERR_STATE *a,ERR_STATE *pid); 75static int pid_cmp(ERR_STATE *a,ERR_STATE *pid);
76static unsigned long get_error_values(int inc,char **file,int *line, 76static unsigned long get_error_values(int inc,const char **file,int *line,
77 char **data,int *flags); 77 const char **data,int *flags);
78static void ERR_STATE_free(ERR_STATE *s); 78static void ERR_STATE_free(ERR_STATE *s);
79#else
80static unsigned long err_hash();
81static int err_cmp();
82static unsigned long pid_hash();
83static int pid_cmp();
84static void ERR_STATE_free();
85ERR_STATE *s;
86#endif
87
88#ifndef NO_ERR 79#ifndef NO_ERR
89static ERR_STRING_DATA ERR_str_libraries[]= 80static ERR_STRING_DATA ERR_str_libraries[]=
90 { 81 {
@@ -107,6 +98,8 @@ static ERR_STRING_DATA ERR_str_libraries[]=
107{ERR_PACK(ERR_LIB_PROXY,0,0) ,"Proxy routines"}, 98{ERR_PACK(ERR_LIB_PROXY,0,0) ,"Proxy routines"},
108{ERR_PACK(ERR_LIB_BIO,0,0) ,"BIO routines"}, 99{ERR_PACK(ERR_LIB_BIO,0,0) ,"BIO routines"},
109{ERR_PACK(ERR_LIB_PKCS7,0,0) ,"PKCS7 routines"}, 100{ERR_PACK(ERR_LIB_PKCS7,0,0) ,"PKCS7 routines"},
101{ERR_PACK(ERR_LIB_X509V3,0,0) ,"X509 V3 routines"},
102{ERR_PACK(ERR_LIB_PKCS12,0,0) ,"PKCS12 routines"},
110{0,NULL}, 103{0,NULL},
111 }; 104 };
112 105
@@ -123,6 +116,7 @@ static ERR_STRING_DATA ERR_str_functs[]=
123#ifdef WINDOWS 116#ifdef WINDOWS
124 {ERR_PACK(0,SYS_F_WSASTARTUP,0), "WSAstartup"}, 117 {ERR_PACK(0,SYS_F_WSASTARTUP,0), "WSAstartup"},
125#endif 118#endif
119 {ERR_PACK(0,SYS_F_OPENDIR,0), "opendir"},
126 {0,NULL}, 120 {0,NULL},
127 }; 121 };
128 122
@@ -146,8 +140,17 @@ static ERR_STRING_DATA ERR_str_reasons[]=
146{ERR_R_PROXY_LIB ,"PROXY lib"}, 140{ERR_R_PROXY_LIB ,"PROXY lib"},
147{ERR_R_BIO_LIB ,"BIO lib"}, 141{ERR_R_BIO_LIB ,"BIO lib"},
148{ERR_R_PKCS7_LIB ,"PKCS7 lib"}, 142{ERR_R_PKCS7_LIB ,"PKCS7 lib"},
143{ERR_R_PKCS12_LIB ,"PKCS12 lib"},
149{ERR_R_MALLOC_FAILURE ,"Malloc failure"}, 144{ERR_R_MALLOC_FAILURE ,"Malloc failure"},
150{ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED ,"called a fuction you should not call"}, 145{ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED ,"called a function you should not call"},
146{ERR_R_PASSED_NULL_PARAMETER ,"passed a null parameter"},
147{ERR_R_NESTED_ASN1_ERROR ,"nested asn1 error"},
148{ERR_R_BAD_ASN1_OBJECT_HEADER ,"bad asn1 object header"},
149{ERR_R_BAD_GET_ASN1_OBJECT_CALL ,"bad get asn1 object call"},
150{ERR_R_EXPECTING_AN_ASN1_SEQUENCE ,"expecting an asn1 sequence"},
151{ERR_R_ASN1_LENGTH_MISMATCH ,"asn1 length mismatch"},
152{ERR_R_MISSING_ASN1_EOS ,"missing asn1 eos"},
153
151{0,NULL}, 154{0,NULL},
152 }; 155 };
153#endif 156#endif
@@ -161,11 +164,13 @@ static ERR_STRING_DATA ERR_str_reasons[]=
161 } \ 164 } \
162 (p)->err_data_flags[i]=0; 165 (p)->err_data_flags[i]=0;
163 166
164static void ERR_STATE_free(s) 167static void ERR_STATE_free(ERR_STATE *s)
165ERR_STATE *s;
166 { 168 {
167 int i; 169 int i;
168 170
171 if(s == NULL)
172 return;
173
169 for (i=0; i<ERR_NUM_ERRORS; i++) 174 for (i=0; i<ERR_NUM_ERRORS; i++)
170 { 175 {
171 err_clear_data(s,i); 176 err_clear_data(s,i);
@@ -173,7 +178,7 @@ ERR_STATE *s;
173 Free(s); 178 Free(s);
174 } 179 }
175 180
176void ERR_load_ERR_strings() 181void ERR_load_ERR_strings(void)
177 { 182 {
178 static int init=1; 183 static int init=1;
179 184
@@ -196,9 +201,7 @@ void ERR_load_ERR_strings()
196 } 201 }
197 } 202 }
198 203
199void ERR_load_strings(lib,str) 204void ERR_load_strings(int lib, ERR_STRING_DATA *str)
200int lib;
201ERR_STRING_DATA *str;
202 { 205 {
203 if (error_hash == NULL) 206 if (error_hash == NULL)
204 { 207 {
@@ -224,7 +227,7 @@ ERR_STRING_DATA *str;
224 CRYPTO_w_unlock(CRYPTO_LOCK_ERR_HASH); 227 CRYPTO_w_unlock(CRYPTO_LOCK_ERR_HASH);
225 } 228 }
226 229
227void ERR_free_strings() 230void ERR_free_strings(void)
228 { 231 {
229 CRYPTO_w_lock(CRYPTO_LOCK_ERR); 232 CRYPTO_w_lock(CRYPTO_LOCK_ERR);
230 233
@@ -239,13 +242,30 @@ void ERR_free_strings()
239 242
240/********************************************************/ 243/********************************************************/
241 244
242void ERR_put_error(lib,func,reason,file,line) 245void ERR_put_error(int lib, int func, int reason, const char *file,
243int lib,func,reason; 246 int line)
244char *file;
245int line;
246 { 247 {
247 ERR_STATE *es; 248 ERR_STATE *es;
248 249
250#ifdef _OSD_POSIX
251 /* In the BS2000-OSD POSIX subsystem, the compiler generates
252 * path names in the form "*POSIX(/etc/passwd)".
253 * This dirty hack strips them to something sensible.
254 * @@@ We shouldn't modify a const string, though.
255 */
256 if (strncmp(file,"*POSIX(", sizeof("*POSIX(")-1) == 0) {
257 char *end;
258
259 /* Skip the "*POSIX(" prefix */
260 file += sizeof("*POSIX(")-1;
261 end = &file[strlen(file)-1];
262 if (*end == ')')
263 *end = '\0';
264 /* Optional: use the basename of the path only. */
265 if ((end = strrchr(file, '/')) != NULL)
266 file = &end[1];
267 }
268#endif
249 es=ERR_get_state(); 269 es=ERR_get_state();
250 270
251 es->top=(es->top+1)%ERR_NUM_ERRORS; 271 es->top=(es->top+1)%ERR_NUM_ERRORS;
@@ -257,7 +277,7 @@ int line;
257 err_clear_data(es,es->top); 277 err_clear_data(es,es->top);
258 } 278 }
259 279
260void ERR_clear_error() 280void ERR_clear_error(void)
261 { 281 {
262 ERR_STATE *es; 282 ERR_STATE *es;
263 283
@@ -277,42 +297,32 @@ void ERR_clear_error()
277 } 297 }
278 298
279 299
280unsigned long ERR_get_error() 300unsigned long ERR_get_error(void)
281 { return(get_error_values(1,NULL,NULL,NULL,NULL)); } 301 { return(get_error_values(1,NULL,NULL,NULL,NULL)); }
282 302
283unsigned long ERR_get_error_line(file,line) 303unsigned long ERR_get_error_line(const char **file,
284char **file; 304 int *line)
285int *line;
286 { return(get_error_values(1,file,line,NULL,NULL)); } 305 { return(get_error_values(1,file,line,NULL,NULL)); }
287 306
288unsigned long ERR_get_error_line_data(file,line,data,flags) 307unsigned long ERR_get_error_line_data(const char **file, int *line,
289char **file; 308 const char **data, int *flags)
290int *line; 309 { return(get_error_values(1,file,line,
291char **data; 310 data,flags)); }
292int *flags;
293 { return(get_error_values(1,file,line,data,flags)); }
294 311
295unsigned long ERR_peek_error() 312unsigned long ERR_peek_error(void)
296 { return(get_error_values(0,NULL,NULL,NULL,NULL)); } 313 { return(get_error_values(0,NULL,NULL,NULL,NULL)); }
297 314
298unsigned long ERR_peek_error_line(file,line) 315unsigned long ERR_peek_error_line(const char **file,
299char **file; 316 int *line)
300int *line;
301 { return(get_error_values(0,file,line,NULL,NULL)); } 317 { return(get_error_values(0,file,line,NULL,NULL)); }
302 318
303unsigned long ERR_peek_error_line_data(file,line,data,flags) 319unsigned long ERR_peek_error_line_data(const char **file, int *line,
304char **file; 320 const char **data, int *flags)
305int *line; 321 { return(get_error_values(0,file,line,
306char **data; 322 data,flags)); }
307int *flags; 323
308 { return(get_error_values(0,file,line,data,flags)); } 324static unsigned long get_error_values(int inc, const char **file, int *line,
309 325 const char **data, int *flags)
310static unsigned long get_error_values(inc,file,line,data,flags)
311int inc;
312char **file;
313int *line;
314char **data;
315int *flags;
316 { 326 {
317 int i=0; 327 int i=0;
318 ERR_STATE *es; 328 ERR_STATE *es;
@@ -361,12 +371,10 @@ int *flags;
361 } 371 }
362 372
363/* BAD for multi-threaded, uses a local buffer if ret == NULL */ 373/* BAD for multi-threaded, uses a local buffer if ret == NULL */
364char *ERR_error_string(e,ret) 374char *ERR_error_string(unsigned long e, char *ret)
365unsigned long e;
366char *ret;
367 { 375 {
368 static char buf[256]; 376 static char buf[256];
369 char *ls,*fs,*rs; 377 const char *ls,*fs,*rs;
370 unsigned long l,f,r; 378 unsigned long l,f,r;
371 int i; 379 int i;
372 380
@@ -397,18 +405,17 @@ char *ret;
397 return(ret); 405 return(ret);
398 } 406 }
399 407
400LHASH *ERR_get_string_table() 408LHASH *ERR_get_string_table(void)
401 { 409 {
402 return(error_hash); 410 return(error_hash);
403 } 411 }
404 412
405LHASH *ERR_get_err_state_table() 413LHASH *ERR_get_err_state_table(void)
406 { 414 {
407 return(thread_hash); 415 return(thread_hash);
408 } 416 }
409 417
410char *ERR_lib_error_string(e) 418const char *ERR_lib_error_string(unsigned long e)
411unsigned long e;
412 { 419 {
413 ERR_STRING_DATA d,*p=NULL; 420 ERR_STRING_DATA d,*p=NULL;
414 unsigned long l; 421 unsigned long l;
@@ -428,8 +435,7 @@ unsigned long e;
428 return((p == NULL)?NULL:p->string); 435 return((p == NULL)?NULL:p->string);
429 } 436 }
430 437
431char *ERR_func_error_string(e) 438const char *ERR_func_error_string(unsigned long e)
432unsigned long e;
433 { 439 {
434 ERR_STRING_DATA d,*p=NULL; 440 ERR_STRING_DATA d,*p=NULL;
435 unsigned long l,f; 441 unsigned long l,f;
@@ -450,8 +456,7 @@ unsigned long e;
450 return((p == NULL)?NULL:p->string); 456 return((p == NULL)?NULL:p->string);
451 } 457 }
452 458
453char *ERR_reason_error_string(e) 459const char *ERR_reason_error_string(unsigned long e)
454unsigned long e;
455 { 460 {
456 ERR_STRING_DATA d,*p=NULL; 461 ERR_STRING_DATA d,*p=NULL;
457 unsigned long l,r; 462 unsigned long l,r;
@@ -478,8 +483,7 @@ unsigned long e;
478 return((p == NULL)?NULL:p->string); 483 return((p == NULL)?NULL:p->string);
479 } 484 }
480 485
481static unsigned long err_hash(a) 486static unsigned long err_hash(ERR_STRING_DATA *a)
482ERR_STRING_DATA *a;
483 { 487 {
484 unsigned long ret,l; 488 unsigned long ret,l;
485 489
@@ -488,26 +492,22 @@ ERR_STRING_DATA *a;
488 return(ret^ret%19*13); 492 return(ret^ret%19*13);
489 } 493 }
490 494
491static int err_cmp(a,b) 495static int err_cmp(ERR_STRING_DATA *a, ERR_STRING_DATA *b)
492ERR_STRING_DATA *a,*b;
493 { 496 {
494 return((int)(a->error-b->error)); 497 return((int)(a->error-b->error));
495 } 498 }
496 499
497static unsigned long pid_hash(a) 500static unsigned long pid_hash(ERR_STATE *a)
498ERR_STATE *a;
499 { 501 {
500 return(a->pid*13); 502 return(a->pid*13);
501 } 503 }
502 504
503static int pid_cmp(a,b) 505static int pid_cmp(ERR_STATE *a, ERR_STATE *b)
504ERR_STATE *a,*b;
505 { 506 {
506 return((int)((long)a->pid - (long)b->pid)); 507 return((int)((long)a->pid - (long)b->pid));
507 } 508 }
508 509
509void ERR_remove_state(pid) 510void ERR_remove_state(unsigned long pid)
510unsigned long pid;
511 { 511 {
512 ERR_STATE *p,tmp; 512 ERR_STATE *p,tmp;
513 513
@@ -523,7 +523,7 @@ unsigned long pid;
523 if (p != NULL) ERR_STATE_free(p); 523 if (p != NULL) ERR_STATE_free(p);
524 } 524 }
525 525
526ERR_STATE *ERR_get_state() 526ERR_STATE *ERR_get_state(void)
527 { 527 {
528 static ERR_STATE fallback; 528 static ERR_STATE fallback;
529 ERR_STATE *ret=NULL,tmp,*tmpp; 529 ERR_STATE *ret=NULL,tmp,*tmpp;
@@ -539,7 +539,9 @@ ERR_STATE *ERR_get_state()
539 CRYPTO_w_lock(CRYPTO_LOCK_ERR); 539 CRYPTO_w_lock(CRYPTO_LOCK_ERR);
540 if (thread_hash == NULL) 540 if (thread_hash == NULL)
541 { 541 {
542 MemCheck_off();
542 thread_hash=lh_new(pid_hash,pid_cmp); 543 thread_hash=lh_new(pid_hash,pid_cmp);
544 MemCheck_on();
543 CRYPTO_w_unlock(CRYPTO_LOCK_ERR); 545 CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
544 if (thread_hash == NULL) return(&fallback); 546 if (thread_hash == NULL) return(&fallback);
545 } 547 }
@@ -577,16 +579,14 @@ ERR_STATE *ERR_get_state()
577 return(ret); 579 return(ret);
578 } 580 }
579 581
580int ERR_get_next_error_library() 582int ERR_get_next_error_library(void)
581 { 583 {
582 static int value=ERR_LIB_USER; 584 static int value=ERR_LIB_USER;
583 585
584 return(value++); 586 return(value++);
585 } 587 }
586 588
587void ERR_set_error_data(data,flags) 589void ERR_set_error_data(char *data, int flags)
588char *data;
589int flags;
590 { 590 {
591 ERR_STATE *es; 591 ERR_STATE *es;
592 int i; 592 int i;
@@ -601,10 +601,9 @@ int flags;
601 es->err_data_flags[es->top]=flags; 601 es->err_data_flags[es->top]=flags;
602 } 602 }
603 603
604void ERR_add_error_data( VAR_PLIST(int , num)) 604void ERR_add_error_data(int num, ...)
605VAR_ALIST 605 {
606 { 606 va_list args;
607 VAR_BDEFN(args, int, num);
608 int i,n,s; 607 int i,n,s;
609 char *str,*p,*a; 608 char *str,*p,*a;
610 609
@@ -613,12 +612,14 @@ VAR_ALIST
613 if (str == NULL) return; 612 if (str == NULL) return;
614 str[0]='\0'; 613 str[0]='\0';
615 614
616 VAR_INIT(args,int,num); 615 va_start(args, num);
617 n=0; 616 n=0;
618 for (i=0; i<num; i++) 617 for (i=0; i<num; i++)
619 { 618 {
620 VAR_ARG(args,char *,a); 619 a=va_arg(args, char*);
621 if (a != NULL) { 620 /* ignore NULLs, thanks to Bob Beck <beck@obtuse.com> */
621 if (a != NULL)
622 {
622 n+=strlen(a); 623 n+=strlen(a);
623 if (n > s) 624 if (n > s)
624 { 625 {
@@ -637,6 +638,6 @@ VAR_ALIST
637 } 638 }
638 ERR_set_error_data(str,ERR_TXT_MALLOCED|ERR_TXT_STRING); 639 ERR_set_error_data(str,ERR_TXT_MALLOCED|ERR_TXT_STRING);
639 640
640 VAR_END( args ); 641 va_end(args);
641 } 642 }
642 643
diff --git a/src/lib/libcrypto/err/err.h b/src/lib/libcrypto/err/err.h
index 75f931be11..9411fb3568 100644
--- a/src/lib/libcrypto/err/err.h
+++ b/src/lib/libcrypto/err/err.h
@@ -63,6 +63,10 @@
63extern "C" { 63extern "C" {
64#endif 64#endif
65 65
66#ifndef NO_FP_API
67#include <stdio.h>
68#endif
69
66/* The following is a bit of a trick to help the object files only contain 70/* The following is a bit of a trick to help the object files only contain
67 * the 'name of the file' string once. Since 'err.h' is protected by the 71 * the 'name of the file' string once. Since 'err.h' is protected by the
68 * HEADER_ERR_H stuff, this should be included only once per file. */ 72 * HEADER_ERR_H stuff, this should be included only once per file. */
@@ -87,7 +91,7 @@ typedef struct err_state_st
87 unsigned long err_buffer[ERR_NUM_ERRORS]; 91 unsigned long err_buffer[ERR_NUM_ERRORS];
88 char *err_data[ERR_NUM_ERRORS]; 92 char *err_data[ERR_NUM_ERRORS];
89 int err_data_flags[ERR_NUM_ERRORS]; 93 int err_data_flags[ERR_NUM_ERRORS];
90 char *err_file[ERR_NUM_ERRORS]; 94 const char *err_file[ERR_NUM_ERRORS];
91 int err_line[ERR_NUM_ERRORS]; 95 int err_line[ERR_NUM_ERRORS];
92 int top,bottom; 96 int top,bottom;
93 } ERR_STATE; 97 } ERR_STATE;
@@ -116,6 +120,8 @@ typedef struct err_state_st
116#define ERR_LIB_PROXY 31 120#define ERR_LIB_PROXY 31
117#define ERR_LIB_BIO 32 121#define ERR_LIB_BIO 32
118#define ERR_LIB_PKCS7 33 122#define ERR_LIB_PKCS7 33
123#define ERR_LIB_X509V3 34
124#define ERR_LIB_PKCS12 35
119 125
120#define ERR_LIB_USER 128 126#define ERR_LIB_USER 128
121 127
@@ -141,6 +147,8 @@ typedef struct err_state_st
141#define RSAREFerr(f,r) ERR_PUT_error(ERR_LIB_RSAREF,(f),(r),ERR_file_name,__LINE__) 147#define RSAREFerr(f,r) ERR_PUT_error(ERR_LIB_RSAREF,(f),(r),ERR_file_name,__LINE__)
142#define PROXYerr(f,r) ERR_PUT_error(ERR_LIB_PROXY,(f),(r),ERR_file_name,__LINE__) 148#define PROXYerr(f,r) ERR_PUT_error(ERR_LIB_PROXY,(f),(r),ERR_file_name,__LINE__)
143#define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),ERR_file_name,__LINE__) 149#define PKCS7err(f,r) ERR_PUT_error(ERR_LIB_PKCS7,(f),(r),ERR_file_name,__LINE__)
150#define X509V3err(f,r) ERR_PUT_error(ERR_LIB_X509V3,(f),(r),ERR_file_name,__LINE__)
151#define PKCS12err(f,r) ERR_PUT_error(ERR_LIB_PKCS12,(f),(r),ERR_file_name,__LINE__)
144 152
145/* Borland C seems too stupid to be able to shift and do longs in 153/* Borland C seems too stupid to be able to shift and do longs in
146 * the pre-processor :-( */ 154 * the pre-processor :-( */
@@ -162,6 +170,7 @@ typedef struct err_state_st
162#define SYS_F_LISTEN 7 170#define SYS_F_LISTEN 7
163#define SYS_F_ACCEPT 8 171#define SYS_F_ACCEPT 8
164#define SYS_F_WSASTARTUP 9 /* Winsock stuff */ 172#define SYS_F_WSASTARTUP 9 /* Winsock stuff */
173#define SYS_F_OPENDIR 10
165 174
166#define ERR_R_FATAL 32 175#define ERR_R_FATAL 32
167/* reasons */ 176/* reasons */
@@ -187,41 +196,47 @@ typedef struct err_state_st
187#define ERR_R_PROXY_LIB ERR_LIB_PROXY 196#define ERR_R_PROXY_LIB ERR_LIB_PROXY
188#define ERR_R_BIO_LIB ERR_LIB_BIO 197#define ERR_R_BIO_LIB ERR_LIB_BIO
189#define ERR_R_PKCS7_LIB ERR_LIB_PKCS7 198#define ERR_R_PKCS7_LIB ERR_LIB_PKCS7
199#define ERR_R_PKCS12_LIB ERR_LIB_PKCS12
190 200
191/* fatal error */ 201/* fatal error */
192#define ERR_R_MALLOC_FAILURE (1|ERR_R_FATAL) 202#define ERR_R_MALLOC_FAILURE (1|ERR_R_FATAL)
193#define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED (2|ERR_R_FATAL) 203#define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED (2|ERR_R_FATAL)
194#define ERR_R_PASSED_NULL_PARAMETER (3|ERR_R_FATAL) 204#define ERR_R_PASSED_NULL_PARAMETER (3|ERR_R_FATAL)
205#define ERR_R_NESTED_ASN1_ERROR (4)
206#define ERR_R_BAD_ASN1_OBJECT_HEADER (5)
207#define ERR_R_BAD_GET_ASN1_OBJECT_CALL (6)
208#define ERR_R_EXPECTING_AN_ASN1_SEQUENCE (7)
209#define ERR_R_ASN1_LENGTH_MISMATCH (8)
210#define ERR_R_MISSING_ASN1_EOS (9)
195 211
196typedef struct ERR_string_data_st 212typedef struct ERR_string_data_st
197 { 213 {
198 unsigned long error; 214 unsigned long error;
199 char *string; 215 const char *string;
200 } ERR_STRING_DATA; 216 } ERR_STRING_DATA;
201 217
202#ifndef NOPROTO 218void ERR_put_error(int lib, int func,int reason,const char *file,int line);
203void ERR_put_error(int lib, int func,int reason,char *file,int line);
204void ERR_set_error_data(char *data,int flags); 219void ERR_set_error_data(char *data,int flags);
205 220
206unsigned long ERR_get_error(void ); 221unsigned long ERR_get_error(void );
207unsigned long ERR_get_error_line(char **file,int *line); 222unsigned long ERR_get_error_line(const char **file,int *line);
208unsigned long ERR_get_error_line_data(char **file,int *line, 223unsigned long ERR_get_error_line_data(const char **file,int *line,
209 char **data, int *flags); 224 const char **data, int *flags);
210unsigned long ERR_peek_error(void ); 225unsigned long ERR_peek_error(void );
211unsigned long ERR_peek_error_line(char **file,int *line); 226unsigned long ERR_peek_error_line(const char **file,int *line);
212unsigned long ERR_peek_error_line_data(char **file,int *line, 227unsigned long ERR_peek_error_line_data(const char **file,int *line,
213 char **data,int *flags); 228 const char **data,int *flags);
214void ERR_clear_error(void ); 229void ERR_clear_error(void );
215char *ERR_error_string(unsigned long e,char *buf); 230char *ERR_error_string(unsigned long e,char *buf);
216char *ERR_lib_error_string(unsigned long e); 231const char *ERR_lib_error_string(unsigned long e);
217char *ERR_func_error_string(unsigned long e); 232const char *ERR_func_error_string(unsigned long e);
218char *ERR_reason_error_string(unsigned long e); 233const char *ERR_reason_error_string(unsigned long e);
219#ifndef NO_FP_API 234#ifndef NO_FP_API
220void ERR_print_errors_fp(FILE *fp); 235void ERR_print_errors_fp(FILE *fp);
221#endif 236#endif
222#ifdef HEADER_BIO_H 237#ifdef HEADER_BIO_H
223void ERR_print_errors(BIO *bp); 238void ERR_print_errors(BIO *bp);
224void ERR_add_error_data( VAR_PLIST( int, num ) ); 239void ERR_add_error_data(int num, ...);
225#endif 240#endif
226void ERR_load_strings(int lib,ERR_STRING_DATA str[]); 241void ERR_load_strings(int lib,ERR_STRING_DATA str[]);
227void ERR_load_ERR_strings(void ); 242void ERR_load_ERR_strings(void );
@@ -241,45 +256,6 @@ char *ERR_get_err_state_table(void );
241 256
242int ERR_get_next_error_library(void ); 257int ERR_get_next_error_library(void );
243 258
244#else
245
246void ERR_put_error();
247void ERR_set_error_data();
248
249unsigned long ERR_get_error();
250unsigned long ERR_get_error_line();
251unsigned long ERR_peek_error();
252unsigned long ERR_peek_error_line();
253void ERR_clear_error();
254char *ERR_error_string();
255char *ERR_lib_error_string();
256char *ERR_func_error_string();
257char *ERR_reason_error_string();
258#ifndef NO_FP_API
259void ERR_print_errors_fp();
260#endif
261void ERR_print_errors();
262void ERR_add_error_data();
263void ERR_load_strings();
264void ERR_load_ERR_strings();
265void ERR_load_crypto_strings();
266void ERR_free_strings();
267
268void ERR_remove_state();
269ERR_STATE *ERR_get_state();
270
271#ifdef HEADER_LHASH_H
272LHASH *ERR_get_string_table();
273LHASH *ERR_get_err_state_table();
274#else
275char *ERR_get_string_table();
276char *ERR_get_err_state_table();
277#endif
278
279int ERR_get_next_error_library();
280
281#endif
282
283#ifdef __cplusplus 259#ifdef __cplusplus
284} 260}
285#endif 261#endif
diff --git a/src/lib/libcrypto/err/err_all.c b/src/lib/libcrypto/err/err_all.c
index f874268e1a..ad820227d2 100644
--- a/src/lib/libcrypto/err/err_all.c
+++ b/src/lib/libcrypto/err/err_all.c
@@ -57,30 +57,32 @@
57 */ 57 */
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "asn1.h" 60#include <openssl/asn1.h>
61#include "bn.h" 61#include <openssl/bn.h>
62#include "buffer.h" 62#include <openssl/buffer.h>
63#include "bio.h" 63#include <openssl/bio.h>
64#ifndef NO_RSA 64#ifndef NO_RSA
65#include "rsa.h" 65#include <openssl/rsa.h>
66#endif 66#endif
67#ifdef RSAref 67#ifdef RSAref
68#include "rsaref.h" 68#include <openssl/rsaref.h>
69#endif 69#endif
70#ifndef NO_DH 70#ifndef NO_DH
71#include "dh.h" 71#include <openssl/dh.h>
72#endif 72#endif
73#ifndef NO_DSA 73#ifndef NO_DSA
74#include "dsa.h" 74#include <openssl/dsa.h>
75#endif 75#endif
76#include "evp.h" 76#include <openssl/evp.h>
77#include "objects.h" 77#include <openssl/objects.h>
78#include "pem.h" 78#include <openssl/pem2.h>
79#include "x509.h" 79#include <openssl/x509.h>
80#include "conf.h" 80#include <openssl/x509v3.h>
81#include "err.h" 81#include <openssl/conf.h>
82#include <openssl/pkcs12.h>
83#include <openssl/err.h>
82 84
83void ERR_load_crypto_strings() 85void ERR_load_crypto_strings(void)
84 { 86 {
85 static int done=0; 87 static int done=0;
86 88
@@ -110,7 +112,9 @@ void ERR_load_crypto_strings()
110 ERR_load_OBJ_strings(); 112 ERR_load_OBJ_strings();
111 ERR_load_PEM_strings(); 113 ERR_load_PEM_strings();
112 ERR_load_X509_strings(); 114 ERR_load_X509_strings();
115 ERR_load_X509V3_strings();
113 ERR_load_CRYPTO_strings(); 116 ERR_load_CRYPTO_strings();
114 ERR_load_PKCS7_strings(); 117 ERR_load_PKCS7_strings();
118 ERR_load_PKCS12_strings();
115#endif 119#endif
116 } 120 }
diff --git a/src/lib/libcrypto/err/err_code.pl b/src/lib/libcrypto/err/err_code.pl
deleted file mode 100644
index ebc8eef913..0000000000
--- a/src/lib/libcrypto/err/err_code.pl
+++ /dev/null
@@ -1,105 +0,0 @@
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
deleted file mode 100644
index a8e36c2f0c..0000000000
--- a/src/lib/libcrypto/err/err_genc.pl
+++ /dev/null
@@ -1,198 +0,0 @@
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/err_prn.c b/src/lib/libcrypto/err/err_prn.c
index ecd0e7c4fa..0999ff214b 100644
--- a/src/lib/libcrypto/err/err_prn.c
+++ b/src/lib/libcrypto/err/err_prn.c
@@ -57,20 +57,19 @@
57 */ 57 */
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "lhash.h" 60#include <openssl/lhash.h>
61#include "crypto.h" 61#include <openssl/crypto.h>
62#include "cryptlib.h" 62#include "cryptlib.h"
63#include "buffer.h" 63#include <openssl/buffer.h>
64#include "err.h" 64#include <openssl/err.h>
65#include "crypto.h" 65#include <openssl/crypto.h>
66 66
67#ifndef NO_FP_API 67#ifndef NO_FP_API
68void ERR_print_errors_fp(fp) 68void ERR_print_errors_fp(FILE *fp)
69FILE *fp;
70 { 69 {
71 unsigned long l; 70 unsigned long l;
72 char buf[200]; 71 char buf[200];
73 char *file,*data; 72 const char *file,*data;
74 int line,flags; 73 int line,flags;
75 unsigned long es; 74 unsigned long es;
76 75
@@ -83,13 +82,12 @@ FILE *fp;
83 } 82 }
84#endif 83#endif
85 84
86void ERR_print_errors(bp) 85void ERR_print_errors(BIO *bp)
87BIO *bp;
88 { 86 {
89 unsigned long l; 87 unsigned long l;
90 char buf[256]; 88 char buf[256];
91 char buf2[256]; 89 char buf2[256];
92 char *file,*data; 90 const char *file,*data;
93 int line,flags; 91 int line,flags;
94 unsigned long es; 92 unsigned long es;
95 93
diff --git a/src/lib/libcrypto/err/error.err b/src/lib/libcrypto/err/error.err
deleted file mode 100644
index f09557d8d9..0000000000
--- a/src/lib/libcrypto/err/error.err
+++ /dev/null
@@ -1,13 +0,0 @@
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/openssl.ec b/src/lib/libcrypto/err/openssl.ec
new file mode 100644
index 0000000000..c2a8acff0c
--- /dev/null
+++ b/src/lib/libcrypto/err/openssl.ec
@@ -0,0 +1,71 @@
1L ERR NONE NONE
2L CRYPTO crypto/crypto.h crypto/cpt_err.c
3L BN crypto/bn/bn.h crypto/bn/bn_err.c
4L RSA crypto/rsa/rsa.h crypto/rsa/rsa_err.c
5L DSA crypto/dsa/dsa.h crypto/dsa/dsa_err.c
6L DH crypto/dh/dh.h crypto/dh/dh_err.c
7L EVP crypto/evp/evp.h crypto/evp/evp_err.c
8L BUF crypto/buffer/buffer.h crypto/buffer/buf_err.c
9L BIO crypto/bio/bio.h crypto/bio/bio_err.c
10L OBJ crypto/objects/objects.h crypto/objects/obj_err.c
11L PEM crypto/pem/pem.h crypto/pem/pem_err.c
12L X509 crypto/x509/x509.h crypto/x509/x509_err.c
13L NONE crypto/x509/x509_vfy.h NONE
14L X509V3 crypto/x509v3/x509v3.h crypto/x509v3/v3err.c
15#L METH crypto/meth/meth.h crypto/meth/meth_err.c
16L ASN1 crypto/asn1/asn1.h crypto/asn1/asn1_err.c
17L CONF crypto/conf/conf.h crypto/conf/conf_err.c
18#L PROXY crypto/proxy/proxy.h crypto/proxy/proxy_err.c
19L PKCS7 crypto/pkcs7/pkcs7.h crypto/pkcs7/pkcs7err.c
20L PKCS12 crypto/pkcs12/pkcs12.h crypto/pkcs12/pk12err.c
21L RSAREF rsaref/rsaref.h rsaref/rsar_err.c
22L SSL ssl/ssl.h ssl/ssl_err.c
23L COMP crypto/comp/comp.h crypto/comp/comp_err.c
24
25
26F RSAREF_F_RSA_BN2BIN
27F RSAREF_F_RSA_PRIVATE_DECRYPT
28F RSAREF_F_RSA_PRIVATE_ENCRYPT
29F RSAREF_F_RSA_PUBLIC_DECRYPT
30F RSAREF_F_RSA_PUBLIC_ENCRYPT
31#F SSL_F_CLIENT_CERTIFICATE
32
33R SSL_R_SSLV3_ALERT_UNEXPECTED_MESSAGE 1010
34R SSL_R_SSLV3_ALERT_BAD_RECORD_MAC 1020
35R SSL_R_TLSV1_ALERT_DECRYPTION_FAILED 1021
36R SSL_R_TLSV1_ALERT_RECORD_OVERFLOW 1022
37R SSL_R_SSLV3_ALERT_DECOMPRESSION_FAILURE 1030
38R SSL_R_SSLV3_ALERT_HANDSHAKE_FAILURE 1040
39R SSL_R_SSLV3_ALERT_NO_CERTIFICATE 1041
40R SSL_R_SSLV3_ALERT_BAD_CERTIFICATE 1042
41R SSL_R_SSLV3_ALERT_UNSUPPORTED_CERTIFICATE 1043
42R SSL_R_SSLV3_ALERT_CERTIFICATE_REVOKED 1044
43R SSL_R_SSLV3_ALERT_CERTIFICATE_EXPIRED 1045
44R SSL_R_SSLV3_ALERT_CERTIFICATE_UNKNOWN 1046
45R SSL_R_SSLV3_ALERT_ILLEGAL_PARAMETER 1047
46R SSL_R_TLSV1_ALERT_UNKNOWN_CA 1048
47R SSL_R_TLSV1_ALERT_ACCESS_DENIED 1049
48R SSL_R_TLSV1_ALERT_DECODE_ERROR 1050
49R SSL_R_TLSV1_ALERT_DECRYPT_ERROR 1051
50R SSL_R_TLSV1_ALERT_EXPORT_RESTRICION 1060
51R SSL_R_TLSV1_ALERT_PROTOCOL_VERSION 1070
52R SSL_R_TLSV1_ALERT_INSUFFICIENT_SECURITY 1071
53R SSL_R_TLSV1_ALERT_INTERNAL_ERROR 1080
54R SSL_R_TLSV1_ALERT_USER_CANCLED 1090
55R SSL_R_TLSV1_ALERT_NO_RENEGOTIATION 1100
56
57R RSAREF_R_CONTENT_ENCODING 0x0400
58R RSAREF_R_DATA 0x0401
59R RSAREF_R_DIGEST_ALGORITHM 0x0402
60R RSAREF_R_ENCODING 0x0403
61R RSAREF_R_KEY 0x0404
62R RSAREF_R_KEY_ENCODING 0x0405
63R RSAREF_R_LEN 0x0406
64R RSAREF_R_MODULUS_LEN 0x0407
65R RSAREF_R_NEED_RANDOM 0x0408
66R RSAREF_R_PRIVATE_KEY 0x0409
67R RSAREF_R_PUBLIC_KEY 0x040a
68R RSAREF_R_SIGNATURE 0x040b
69R RSAREF_R_SIGNATURE_ENCODING 0x040c
70R RSAREF_R_ENCRYPTION_ALGORITHM 0x040d
71
diff --git a/src/lib/libcrypto/err/ssleay.ec b/src/lib/libcrypto/err/ssleay.ec
deleted file mode 100644
index 10b5dbb59d..0000000000
--- a/src/lib/libcrypto/err/ssleay.ec
+++ /dev/null
@@ -1,57 +0,0 @@
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