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/Makefile109
-rw-r--r--src/lib/libcrypto/err/Makefile.ssl119
-rw-r--r--src/lib/libcrypto/err/err.c86
-rw-r--r--src/lib/libcrypto/err/err.h28
-rw-r--r--src/lib/libcrypto/err/err_all.c25
-rw-r--r--src/lib/libcrypto/err/err_prn.c9
-rw-r--r--src/lib/libcrypto/err/openssl.ec7
7 files changed, 261 insertions, 122 deletions
diff --git a/src/lib/libcrypto/err/Makefile b/src/lib/libcrypto/err/Makefile
new file mode 100644
index 0000000000..23e38409c8
--- /dev/null
+++ b/src/lib/libcrypto/err/Makefile
@@ -0,0 +1,109 @@
1#
2# OpenSSL/crypto/err/Makefile
3#
4
5DIR= err
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10MAKEFILE= Makefile
11AR= ar r
12
13CFLAGS= $(INCLUDES) $(CFLAG)
14
15GENERAL=Makefile
16TEST=
17APPS=
18
19LIB=$(TOP)/libcrypto.a
20LIBSRC=err.c err_all.c err_prn.c
21LIBOBJ=err.o err_all.o err_prn.o
22
23SRC= $(LIBSRC)
24
25EXHEADER= err.h
26HEADER= $(EXHEADER)
27
28ALL= $(GENERAL) $(SRC) $(HEADER)
29
30top:
31 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
32
33all: lib
34
35lib: $(LIBOBJ)
36 $(AR) $(LIB) $(LIBOBJ)
37 $(RANLIB) $(LIB) || echo Never mind.
38 @touch lib
39
40files:
41 $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
42
43links:
44 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
45 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
46 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
47
48install:
49 @[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
50 @headerlist="$(EXHEADER)"; for i in $$headerlist ; \
51 do \
52 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
53 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
54 done;
55
56tags:
57 ctags $(SRC)
58
59tests:
60
61lint:
62 lint -DLINT $(INCLUDES) $(SRC)>fluff
63
64depend:
65 @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile...
66 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
67
68dclean:
69 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
70 mv -f Makefile.new $(MAKEFILE)
71
72clean:
73 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
74
75# DO NOT DELETE THIS LINE -- make depend depends on it.
76
77err.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/buffer.h
78err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
79err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
80err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
81err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h
82err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
83err.o: ../cryptlib.h err.c
84err_all.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h
85err_all.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
86err_all.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h
87err_all.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h
88err_all.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h
89err_all.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h
90err_all.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h
91err_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h
92err_all.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
93err_all.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
94err_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
95err_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem2.h
96err_all.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
97err_all.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h
98err_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
99err_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
100err_all.o: ../../include/openssl/ui.h ../../include/openssl/x509.h
101err_all.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h
102err_all.o: err_all.c
103err_prn.o: ../../e_os.h ../../include/openssl/bio.h
104err_prn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
105err_prn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
106err_prn.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
107err_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
108err_prn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
109err_prn.o: ../../include/openssl/symhacks.h ../cryptlib.h err_prn.c
diff --git a/src/lib/libcrypto/err/Makefile.ssl b/src/lib/libcrypto/err/Makefile.ssl
new file mode 100644
index 0000000000..b253061d07
--- /dev/null
+++ b/src/lib/libcrypto/err/Makefile.ssl
@@ -0,0 +1,119 @@
1#
2# SSLeay/crypto/err/Makefile
3#
4
5DIR= err
6TOP= ../..
7CC= cc
8INCLUDES= -I.. -I$(TOP) -I../../include
9CFLAG=-g
10INSTALL_PREFIX=
11OPENSSLDIR= /usr/local/ssl
12INSTALLTOP=/usr/local/ssl
13MAKE= make -f Makefile.ssl
14MAKEDEPPROG= makedepend
15MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG)
16MAKEFILE= Makefile.ssl
17AR= ar r
18
19CFLAGS= $(INCLUDES) $(CFLAG)
20
21GENERAL=Makefile
22TEST=
23APPS=
24
25LIB=$(TOP)/libcrypto.a
26LIBSRC=err.c err_all.c err_prn.c
27LIBOBJ=err.o err_all.o err_prn.o
28
29SRC= $(LIBSRC)
30
31EXHEADER= err.h
32HEADER= $(EXHEADER)
33
34ALL= $(GENERAL) $(SRC) $(HEADER)
35
36top:
37 (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all)
38
39all: lib
40
41lib: $(LIBOBJ)
42 $(AR) $(LIB) $(LIBOBJ)
43 $(RANLIB) $(LIB) || echo Never mind.
44 @touch lib
45
46files:
47 $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO
48
49links:
50 @sh $(TOP)/util/point.sh Makefile.ssl Makefile
51 @$(PERL) $(TOP)/util/mklink.pl ../../include/openssl $(EXHEADER)
52 @$(PERL) $(TOP)/util/mklink.pl ../../test $(TEST)
53 @$(PERL) $(TOP)/util/mklink.pl ../../apps $(APPS)
54
55install:
56 @for i in $(EXHEADER) ; \
57 do \
58 (cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
59 chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
60 done;
61
62tags:
63 ctags $(SRC)
64
65tests:
66
67lint:
68 lint -DLINT $(INCLUDES) $(SRC)>fluff
69
70depend:
71 $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC)
72
73dclean:
74 $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new
75 mv -f Makefile.new $(MAKEFILE)
76
77clean:
78 rm -f *.o *.obj lib tags core .pure .nfs* *.old *.bak fluff
79
80# DO NOT DELETE THIS LINE -- make depend depends on it.
81
82err.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/buffer.h
83err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
84err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h
85err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
86err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h
87err.o: ../../include/openssl/symhacks.h ../cryptlib.h err.c
88err_all.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h
89err_all.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h
90err_all.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h
91err_all.o: ../../include/openssl/cast.h ../../include/openssl/conf.h
92err_all.o: ../../include/openssl/crypto.h ../../include/openssl/des.h
93err_all.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h
94err_all.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h
95err_all.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
96err_all.o: ../../include/openssl/engine.h ../../include/openssl/err.h
97err_all.o: ../../include/openssl/evp.h ../../include/openssl/idea.h
98err_all.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h
99err_all.o: ../../include/openssl/md4.h ../../include/openssl/md5.h
100err_all.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h
101err_all.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h
102err_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h
103err_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem2.h
104err_all.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h
105err_all.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h
106err_all.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h
107err_all.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h
108err_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
109err_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
110err_all.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h
111err_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
112err_all.o: ../../include/openssl/x509v3.h err_all.c
113err_prn.o: ../../e_os.h ../../include/openssl/bio.h
114err_prn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
115err_prn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h
116err_prn.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h
117err_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h
118err_prn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
119err_prn.o: ../cryptlib.h err_prn.c
diff --git a/src/lib/libcrypto/err/err.c b/src/lib/libcrypto/err/err.c
index b6ff070e8f..53687d79ab 100644
--- a/src/lib/libcrypto/err/err.c
+++ b/src/lib/libcrypto/err/err.c
@@ -112,9 +112,9 @@
112#include <stdio.h> 112#include <stdio.h>
113#include <stdarg.h> 113#include <stdarg.h>
114#include <string.h> 114#include <string.h>
115#include "cryptlib.h"
116#include <openssl/lhash.h> 115#include <openssl/lhash.h>
117#include <openssl/crypto.h> 116#include <openssl/crypto.h>
117#include "cryptlib.h"
118#include <openssl/buffer.h> 118#include <openssl/buffer.h>
119#include <openssl/bio.h> 119#include <openssl/bio.h>
120#include <openssl/err.h> 120#include <openssl/err.h>
@@ -149,7 +149,7 @@ static ERR_STRING_DATA ERR_str_libraries[]=
149{ERR_PACK(ERR_LIB_DSO,0,0) ,"DSO support routines"}, 149{ERR_PACK(ERR_LIB_DSO,0,0) ,"DSO support routines"},
150{ERR_PACK(ERR_LIB_ENGINE,0,0) ,"engine routines"}, 150{ERR_PACK(ERR_LIB_ENGINE,0,0) ,"engine routines"},
151{ERR_PACK(ERR_LIB_OCSP,0,0) ,"OCSP routines"}, 151{ERR_PACK(ERR_LIB_OCSP,0,0) ,"OCSP routines"},
152{ERR_PACK(ERR_LIB_CMS,0,0) ,"CMS routines"}, 152{ERR_PACK(ERR_LIB_FIPS,0,0) ,"FIPS routines"},
153{0,NULL}, 153{0,NULL},
154 }; 154 };
155 155
@@ -168,6 +168,7 @@ static ERR_STRING_DATA ERR_str_functs[]=
168#endif 168#endif
169 {ERR_PACK(0,SYS_F_OPENDIR,0), "opendir"}, 169 {ERR_PACK(0,SYS_F_OPENDIR,0), "opendir"},
170 {ERR_PACK(0,SYS_F_FREAD,0), "fread"}, 170 {ERR_PACK(0,SYS_F_FREAD,0), "fread"},
171 {ERR_PACK(0,SYS_F_GETADDRINFO,0), "getaddrinfo"},
171 {0,NULL}, 172 {0,NULL},
172 }; 173 };
173 174
@@ -209,7 +210,6 @@ static ERR_STRING_DATA ERR_str_reasons[]=
209{ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED ,"called a function you should not call"}, 210{ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED ,"called a function you should not call"},
210{ERR_R_PASSED_NULL_PARAMETER ,"passed a null parameter"}, 211{ERR_R_PASSED_NULL_PARAMETER ,"passed a null parameter"},
211{ERR_R_INTERNAL_ERROR ,"internal error"}, 212{ERR_R_INTERNAL_ERROR ,"internal error"},
212{ERR_R_DISABLED ,"called a function that was disabled at compile-time"},
213 213
214{0,NULL}, 214{0,NULL},
215 }; 215 };
@@ -542,27 +542,16 @@ static ERR_STRING_DATA SYS_str_reasons[NUM_SYS_STR_REASONS + 1];
542 * will be returned for SYSerr(), which always gets an errno 542 * will be returned for SYSerr(), which always gets an errno
543 * value and never one of those 'standard' reason codes. */ 543 * value and never one of those 'standard' reason codes. */
544 544
545static void build_SYS_str_reasons(void) 545static void build_SYS_str_reasons()
546 { 546 {
547 /* OPENSSL_malloc cannot be used here, use static storage instead */ 547 /* OPENSSL_malloc cannot be used here, use static storage instead */
548 static char strerror_tab[NUM_SYS_STR_REASONS][LEN_SYS_STR_REASON]; 548 static char strerror_tab[NUM_SYS_STR_REASONS][LEN_SYS_STR_REASON];
549 int i; 549 int i;
550 static int init = 1; 550 static int init = 1;
551 551
552 CRYPTO_r_lock(CRYPTO_LOCK_ERR); 552 if (!init) return;
553 if (!init) 553
554 {
555 CRYPTO_r_unlock(CRYPTO_LOCK_ERR);
556 return;
557 }
558
559 CRYPTO_r_unlock(CRYPTO_LOCK_ERR);
560 CRYPTO_w_lock(CRYPTO_LOCK_ERR); 554 CRYPTO_w_lock(CRYPTO_LOCK_ERR);
561 if (!init)
562 {
563 CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
564 return;
565 }
566 555
567 for (i = 1; i <= NUM_SYS_STR_REASONS; i++) 556 for (i = 1; i <= NUM_SYS_STR_REASONS; i++)
568 { 557 {
@@ -594,24 +583,13 @@ static void build_SYS_str_reasons(void)
594#endif 583#endif
595 584
596#define err_clear_data(p,i) \ 585#define err_clear_data(p,i) \
597 do { \
598 if (((p)->err_data[i] != NULL) && \ 586 if (((p)->err_data[i] != NULL) && \
599 (p)->err_data_flags[i] & ERR_TXT_MALLOCED) \ 587 (p)->err_data_flags[i] & ERR_TXT_MALLOCED) \
600 { \ 588 { \
601 OPENSSL_free((p)->err_data[i]); \ 589 OPENSSL_free((p)->err_data[i]); \
602 (p)->err_data[i]=NULL; \ 590 (p)->err_data[i]=NULL; \
603 } \ 591 } \
604 (p)->err_data_flags[i]=0; \ 592 (p)->err_data_flags[i]=0;
605 } while(0)
606
607#define err_clear(p,i) \
608 do { \
609 (p)->err_flags[i]=0; \
610 (p)->err_buffer[i]=0; \
611 err_clear_data(p,i); \
612 (p)->err_file[i]=NULL; \
613 (p)->err_line[i]= -1; \
614 } while(0)
615 593
616static void ERR_STATE_free(ERR_STATE *s) 594static void ERR_STATE_free(ERR_STATE *s)
617 { 595 {
@@ -704,7 +682,6 @@ void ERR_put_error(int lib, int func, int reason, const char *file,
704 es->top=(es->top+1)%ERR_NUM_ERRORS; 682 es->top=(es->top+1)%ERR_NUM_ERRORS;
705 if (es->top == es->bottom) 683 if (es->top == es->bottom)
706 es->bottom=(es->bottom+1)%ERR_NUM_ERRORS; 684 es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
707 es->err_flags[es->top]=0;
708 es->err_buffer[es->top]=ERR_PACK(lib,func,reason); 685 es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
709 es->err_file[es->top]=file; 686 es->err_file[es->top]=file;
710 es->err_line[es->top]=line; 687 es->err_line[es->top]=line;
@@ -720,7 +697,10 @@ void ERR_clear_error(void)
720 697
721 for (i=0; i<ERR_NUM_ERRORS; i++) 698 for (i=0; i<ERR_NUM_ERRORS; i++)
722 { 699 {
723 err_clear(es,i); 700 es->err_buffer[i]=0;
701 err_clear_data(es,i);
702 es->err_file[i]=NULL;
703 es->err_line[i]= -1;
724 } 704 }
725 es->top=es->bottom=0; 705 es->top=es->bottom=0;
726 } 706 }
@@ -957,7 +937,7 @@ static unsigned long err_hash(const void *a_void)
957 { 937 {
958 unsigned long ret,l; 938 unsigned long ret,l;
959 939
960 l=((const ERR_STRING_DATA *)a_void)->error; 940 l=((ERR_STRING_DATA *)a_void)->error;
961 ret=l^ERR_GET_LIB(l)^ERR_GET_FUNC(l); 941 ret=l^ERR_GET_LIB(l)^ERR_GET_FUNC(l);
962 return(ret^ret%19*13); 942 return(ret^ret%19*13);
963 } 943 }
@@ -965,21 +945,21 @@ static unsigned long err_hash(const void *a_void)
965/* static int err_cmp(ERR_STRING_DATA *a, ERR_STRING_DATA *b) */ 945/* static int err_cmp(ERR_STRING_DATA *a, ERR_STRING_DATA *b) */
966static int err_cmp(const void *a_void, const void *b_void) 946static int err_cmp(const void *a_void, const void *b_void)
967 { 947 {
968 return((int)(((const ERR_STRING_DATA *)a_void)->error - 948 return((int)(((ERR_STRING_DATA *)a_void)->error -
969 ((const ERR_STRING_DATA *)b_void)->error)); 949 ((ERR_STRING_DATA *)b_void)->error));
970 } 950 }
971 951
972/* static unsigned long pid_hash(ERR_STATE *a) */ 952/* static unsigned long pid_hash(ERR_STATE *a) */
973static unsigned long pid_hash(const void *a_void) 953static unsigned long pid_hash(const void *a_void)
974 { 954 {
975 return(((const ERR_STATE *)a_void)->pid*13); 955 return(((ERR_STATE *)a_void)->pid*13);
976 } 956 }
977 957
978/* static int pid_cmp(ERR_STATE *a, ERR_STATE *b) */ 958/* static int pid_cmp(ERR_STATE *a, ERR_STATE *b) */
979static int pid_cmp(const void *a_void, const void *b_void) 959static int pid_cmp(const void *a_void, const void *b_void)
980 { 960 {
981 return((int)((long)((const ERR_STATE *)a_void)->pid - 961 return((int)((long)((ERR_STATE *)a_void)->pid -
982 (long)((const ERR_STATE *)b_void)->pid)); 962 (long)((ERR_STATE *)b_void)->pid));
983 } 963 }
984 964
985void ERR_remove_state(unsigned long pid) 965void ERR_remove_state(unsigned long pid)
@@ -1089,7 +1069,7 @@ void ERR_add_error_data(int num, ...)
1089 else 1069 else
1090 str=p; 1070 str=p;
1091 } 1071 }
1092 BUF_strlcat(str,a,(size_t)s+1); 1072 BUF_strlcat(str,a,s+1);
1093 } 1073 }
1094 } 1074 }
1095 ERR_set_error_data(str,ERR_TXT_MALLOCED|ERR_TXT_STRING); 1075 ERR_set_error_data(str,ERR_TXT_MALLOCED|ERR_TXT_STRING);
@@ -1097,33 +1077,3 @@ void ERR_add_error_data(int num, ...)
1097err: 1077err:
1098 va_end(args); 1078 va_end(args);
1099 } 1079 }
1100
1101int ERR_set_mark(void)
1102 {
1103 ERR_STATE *es;
1104
1105 es=ERR_get_state();
1106
1107 if (es->bottom == es->top) return 0;
1108 es->err_flags[es->top]|=ERR_FLAG_MARK;
1109 return 1;
1110 }
1111
1112int ERR_pop_to_mark(void)
1113 {
1114 ERR_STATE *es;
1115
1116 es=ERR_get_state();
1117
1118 while(es->bottom != es->top
1119 && (es->err_flags[es->top] & ERR_FLAG_MARK) == 0)
1120 {
1121 err_clear(es,es->top);
1122 es->top-=1;
1123 if (es->top == -1) es->top=ERR_NUM_ERRORS-1;
1124 }
1125
1126 if (es->bottom == es->top) return 0;
1127 es->err_flags[es->top]&=~ERR_FLAG_MARK;
1128 return 1;
1129 }
diff --git a/src/lib/libcrypto/err/err.h b/src/lib/libcrypto/err/err.h
index bf28fce492..2efa18866a 100644
--- a/src/lib/libcrypto/err/err.h
+++ b/src/lib/libcrypto/err/err.h
@@ -59,14 +59,11 @@
59#ifndef HEADER_ERR_H 59#ifndef HEADER_ERR_H
60#define HEADER_ERR_H 60#define HEADER_ERR_H
61 61
62#include <openssl/e_os2.h>
63
64#ifndef OPENSSL_NO_FP_API 62#ifndef OPENSSL_NO_FP_API
65#include <stdio.h> 63#include <stdio.h>
66#include <stdlib.h> 64#include <stdlib.h>
67#endif 65#endif
68 66
69#include <openssl/ossl_typ.h>
70#ifndef OPENSSL_NO_BIO 67#ifndef OPENSSL_NO_BIO
71#include <openssl/bio.h> 68#include <openssl/bio.h>
72#endif 69#endif
@@ -89,13 +86,10 @@ extern "C" {
89#define ERR_TXT_MALLOCED 0x01 86#define ERR_TXT_MALLOCED 0x01
90#define ERR_TXT_STRING 0x02 87#define ERR_TXT_STRING 0x02
91 88
92#define ERR_FLAG_MARK 0x01
93
94#define ERR_NUM_ERRORS 16 89#define ERR_NUM_ERRORS 16
95typedef struct err_state_st 90typedef struct err_state_st
96 { 91 {
97 unsigned long pid; 92 unsigned long pid;
98 int err_flags[ERR_NUM_ERRORS];
99 unsigned long err_buffer[ERR_NUM_ERRORS]; 93 unsigned long err_buffer[ERR_NUM_ERRORS];
100 char *err_data[ERR_NUM_ERRORS]; 94 char *err_data[ERR_NUM_ERRORS];
101 int err_data_flags[ERR_NUM_ERRORS]; 95 int err_data_flags[ERR_NUM_ERRORS];
@@ -137,10 +131,7 @@ typedef struct err_state_st
137#define ERR_LIB_OCSP 39 131#define ERR_LIB_OCSP 39
138#define ERR_LIB_UI 40 132#define ERR_LIB_UI 40
139#define ERR_LIB_COMP 41 133#define ERR_LIB_COMP 41
140#define ERR_LIB_ECDSA 42 134#define ERR_LIB_FIPS 42
141#define ERR_LIB_ECDH 43
142#define ERR_LIB_STORE 44
143#define ERR_LIB_CMS 45
144 135
145#define ERR_LIB_USER 128 136#define ERR_LIB_USER 128
146 137
@@ -169,10 +160,7 @@ typedef struct err_state_st
169#define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),__FILE__,__LINE__) 160#define OCSPerr(f,r) ERR_PUT_error(ERR_LIB_OCSP,(f),(r),__FILE__,__LINE__)
170#define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),__FILE__,__LINE__) 161#define UIerr(f,r) ERR_PUT_error(ERR_LIB_UI,(f),(r),__FILE__,__LINE__)
171#define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),__FILE__,__LINE__) 162#define COMPerr(f,r) ERR_PUT_error(ERR_LIB_COMP,(f),(r),__FILE__,__LINE__)
172#define ECDSAerr(f,r) ERR_PUT_error(ERR_LIB_ECDSA,(f),(r),__FILE__,__LINE__) 163#define FIPSerr(f,r) ERR_PUT_error(ERR_LIB_FIPS,(f),(r),__FILE__,__LINE__)
173#define ECDHerr(f,r) ERR_PUT_error(ERR_LIB_ECDH,(f),(r),__FILE__,__LINE__)
174#define STOREerr(f,r) ERR_PUT_error(ERR_LIB_STORE,(f),(r),__FILE__,__LINE__)
175#define CMSerr(f,r) ERR_PUT_error(ERR_LIB_CMS,(f),(r),__FILE__,__LINE__)
176 164
177/* Borland C seems too stupid to be able to shift and do longs in 165/* Borland C seems too stupid to be able to shift and do longs in
178 * the pre-processor :-( */ 166 * the pre-processor :-( */
@@ -197,6 +185,7 @@ typedef struct err_state_st
197#define SYS_F_WSASTARTUP 9 /* Winsock stuff */ 185#define SYS_F_WSASTARTUP 9 /* Winsock stuff */
198#define SYS_F_OPENDIR 10 186#define SYS_F_OPENDIR 10
199#define SYS_F_FREAD 11 187#define SYS_F_FREAD 11
188#define SYS_F_GETADDRINFO 12
200 189
201 190
202/* reasons */ 191/* reasons */
@@ -225,9 +214,6 @@ typedef struct err_state_st
225#define ERR_R_OCSP_LIB ERR_LIB_OCSP /* 39 */ 214#define ERR_R_OCSP_LIB ERR_LIB_OCSP /* 39 */
226#define ERR_R_UI_LIB ERR_LIB_UI /* 40 */ 215#define ERR_R_UI_LIB ERR_LIB_UI /* 40 */
227#define ERR_R_COMP_LIB ERR_LIB_COMP /* 41 */ 216#define ERR_R_COMP_LIB ERR_LIB_COMP /* 41 */
228#define ERR_R_ECDSA_LIB ERR_LIB_ECDSA /* 42 */
229#define ERR_R_ECDH_LIB ERR_LIB_ECDH /* 43 */
230#define ERR_R_STORE_LIB ERR_LIB_STORE /* 44 */
231 217
232#define ERR_R_NESTED_ASN1_ERROR 58 218#define ERR_R_NESTED_ASN1_ERROR 58
233#define ERR_R_BAD_ASN1_OBJECT_HEADER 59 219#define ERR_R_BAD_ASN1_OBJECT_HEADER 59
@@ -242,7 +228,6 @@ typedef struct err_state_st
242#define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED (2|ERR_R_FATAL) 228#define ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED (2|ERR_R_FATAL)
243#define ERR_R_PASSED_NULL_PARAMETER (3|ERR_R_FATAL) 229#define ERR_R_PASSED_NULL_PARAMETER (3|ERR_R_FATAL)
244#define ERR_R_INTERNAL_ERROR (4|ERR_R_FATAL) 230#define ERR_R_INTERNAL_ERROR (4|ERR_R_FATAL)
245#define ERR_R_DISABLED (5|ERR_R_FATAL)
246 231
247/* 99 is the maximum possible ERR_R_... code, higher values 232/* 99 is the maximum possible ERR_R_... code, higher values
248 * are reserved for the individual libraries */ 233 * are reserved for the individual libraries */
@@ -301,11 +286,8 @@ void ERR_release_err_state_table(LHASH **hash);
301 286
302int ERR_get_next_error_library(void); 287int ERR_get_next_error_library(void);
303 288
304int ERR_set_mark(void); 289/* This opaque type encapsulates the low-level error-state functions */
305int ERR_pop_to_mark(void); 290typedef struct st_ERR_FNS ERR_FNS;
306
307/* Already defined in ossl_typ.h */
308/* typedef struct st_ERR_FNS ERR_FNS; */
309/* An application can use this function and provide the return value to loaded 291/* An application can use this function and provide the return value to loaded
310 * modules that should use the application's ERR state/functionality */ 292 * modules that should use the application's ERR state/functionality */
311const ERR_FNS *ERR_get_implementation(void); 293const ERR_FNS *ERR_get_implementation(void);
diff --git a/src/lib/libcrypto/err/err_all.c b/src/lib/libcrypto/err/err_all.c
index 5813060ce2..4dc9300892 100644
--- a/src/lib/libcrypto/err/err_all.c
+++ b/src/lib/libcrypto/err/err_all.c
@@ -73,12 +73,6 @@
73#ifndef OPENSSL_NO_DSA 73#ifndef OPENSSL_NO_DSA
74#include <openssl/dsa.h> 74#include <openssl/dsa.h>
75#endif 75#endif
76#ifndef OPENSSL_NO_ECDSA
77#include <openssl/ecdsa.h>
78#endif
79#ifndef OPENSSL_NO_ECDH
80#include <openssl/ecdh.h>
81#endif
82#include <openssl/evp.h> 76#include <openssl/evp.h>
83#include <openssl/objects.h> 77#include <openssl/objects.h>
84#include <openssl/pem2.h> 78#include <openssl/pem2.h>
@@ -91,15 +85,16 @@
91#ifndef OPENSSL_NO_ENGINE 85#ifndef OPENSSL_NO_ENGINE
92#include <openssl/engine.h> 86#include <openssl/engine.h>
93#endif 87#endif
94#include <openssl/ui.h>
95#include <openssl/ocsp.h> 88#include <openssl/ocsp.h>
96#include <openssl/err.h> 89#include <openssl/err.h>
97#ifndef OPENSSL_NO_CMS 90#include <openssl/fips.h>
98#include <openssl/cms.h>
99#endif
100 91
101void ERR_load_crypto_strings(void) 92void ERR_load_crypto_strings(void)
102 { 93 {
94 static int done=0;
95
96 if (done) return;
97 done=1;
103#ifndef OPENSSL_NO_ERR 98#ifndef OPENSSL_NO_ERR
104 ERR_load_ERR_strings(); /* include error strings for SYSerr */ 99 ERR_load_ERR_strings(); /* include error strings for SYSerr */
105 ERR_load_BN_strings(); 100 ERR_load_BN_strings();
@@ -123,12 +118,6 @@ void ERR_load_crypto_strings(void)
123#ifndef OPENSSL_NO_EC 118#ifndef OPENSSL_NO_EC
124 ERR_load_EC_strings(); 119 ERR_load_EC_strings();
125#endif 120#endif
126#ifndef OPENSSL_NO_ECDSA
127 ERR_load_ECDSA_strings();
128#endif
129#ifndef OPENSSL_NO_ECDH
130 ERR_load_ECDH_strings();
131#endif
132 /* skip ERR_load_SSL_strings() because it is not in this library */ 121 /* skip ERR_load_SSL_strings() because it is not in this library */
133 ERR_load_BIO_strings(); 122 ERR_load_BIO_strings();
134 ERR_load_PKCS7_strings(); 123 ERR_load_PKCS7_strings();
@@ -141,8 +130,8 @@ void ERR_load_crypto_strings(void)
141#endif 130#endif
142 ERR_load_OCSP_strings(); 131 ERR_load_OCSP_strings();
143 ERR_load_UI_strings(); 132 ERR_load_UI_strings();
144#ifndef OPENSSL_NO_CMS
145 ERR_load_CMS_strings();
146#endif 133#endif
134#ifdef OPENSSL_FIPS
135 ERR_load_FIPS_strings();
147#endif 136#endif
148 } 137 }
diff --git a/src/lib/libcrypto/err/err_prn.c b/src/lib/libcrypto/err/err_prn.c
index 2224a901e5..81e34bd6ce 100644
--- a/src/lib/libcrypto/err/err_prn.c
+++ b/src/lib/libcrypto/err/err_prn.c
@@ -57,9 +57,9 @@
57 */ 57 */
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h"
61#include <openssl/lhash.h> 60#include <openssl/lhash.h>
62#include <openssl/crypto.h> 61#include <openssl/crypto.h>
62#include "cryptlib.h"
63#include <openssl/buffer.h> 63#include <openssl/buffer.h>
64#include <openssl/err.h> 64#include <openssl/err.h>
65 65
@@ -86,12 +86,7 @@ void ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u),
86#ifndef OPENSSL_NO_FP_API 86#ifndef OPENSSL_NO_FP_API
87static int print_fp(const char *str, size_t len, void *fp) 87static int print_fp(const char *str, size_t len, void *fp)
88 { 88 {
89 BIO bio; 89 return fprintf((FILE *)fp, "%s", str);
90
91 BIO_set(&bio,BIO_s_file());
92 BIO_set_fp(&bio,fp,BIO_NOCLOSE);
93
94 return BIO_printf(&bio, "%s", str);
95 } 90 }
96void ERR_print_errors_fp(FILE *fp) 91void ERR_print_errors_fp(FILE *fp)
97 { 92 {
diff --git a/src/lib/libcrypto/err/openssl.ec b/src/lib/libcrypto/err/openssl.ec
index 1938f081ac..f8cd6937e7 100644
--- a/src/lib/libcrypto/err/openssl.ec
+++ b/src/lib/libcrypto/err/openssl.ec
@@ -27,16 +27,11 @@ L DSO crypto/dso/dso.h crypto/dso/dso_err.c
27L ENGINE crypto/engine/engine.h crypto/engine/eng_err.c 27L ENGINE crypto/engine/engine.h crypto/engine/eng_err.c
28L OCSP crypto/ocsp/ocsp.h crypto/ocsp/ocsp_err.c 28L OCSP crypto/ocsp/ocsp.h crypto/ocsp/ocsp_err.c
29L UI crypto/ui/ui.h crypto/ui/ui_err.c 29L UI crypto/ui/ui.h crypto/ui/ui_err.c
30L COMP crypto/comp/comp.h crypto/comp/comp_err.c 30L FIPS fips-1.0/fips.h fips-1.0/fips_err.h
31L ECDSA crypto/ecdsa/ecdsa.h crypto/ecdsa/ecs_err.c
32L ECDH crypto/ecdh/ecdh.h crypto/ecdh/ech_err.c
33L STORE crypto/store/store.h crypto/store/str_err.c
34L CMS crypto/cms/cms.h crypto/cms/cms_err.c
35 31
36# additional header files to be scanned for function names 32# additional header files to be scanned for function names
37L NONE crypto/x509/x509_vfy.h NONE 33L NONE crypto/x509/x509_vfy.h NONE
38L NONE crypto/ec/ec_lcl.h NONE 34L NONE crypto/ec/ec_lcl.h NONE
39L NONE crypto/cms/cms_lcl.h NONE
40 35
41 36
42F RSAREF_F_RSA_BN2BIN 37F RSAREF_F_RSA_BN2BIN