diff options
Diffstat (limited to 'src/lib/libcrypto/err')
| -rw-r--r-- | src/lib/libcrypto/err/Makefile | 109 | ||||
| -rw-r--r-- | src/lib/libcrypto/err/Makefile.ssl | 119 | ||||
| -rw-r--r-- | src/lib/libcrypto/err/err.c | 86 | ||||
| -rw-r--r-- | src/lib/libcrypto/err/err.h | 28 | ||||
| -rw-r--r-- | src/lib/libcrypto/err/err_all.c | 25 | ||||
| -rw-r--r-- | src/lib/libcrypto/err/err_prn.c | 9 | ||||
| -rw-r--r-- | src/lib/libcrypto/err/openssl.ec | 7 |
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 | |||
| 5 | DIR= err | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | MAKEFILE= Makefile | ||
| 11 | AR= ar r | ||
| 12 | |||
| 13 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 14 | |||
| 15 | GENERAL=Makefile | ||
| 16 | TEST= | ||
| 17 | APPS= | ||
| 18 | |||
| 19 | LIB=$(TOP)/libcrypto.a | ||
| 20 | LIBSRC=err.c err_all.c err_prn.c | ||
| 21 | LIBOBJ=err.o err_all.o err_prn.o | ||
| 22 | |||
| 23 | SRC= $(LIBSRC) | ||
| 24 | |||
| 25 | EXHEADER= err.h | ||
| 26 | HEADER= $(EXHEADER) | ||
| 27 | |||
| 28 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 29 | |||
| 30 | top: | ||
| 31 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 32 | |||
| 33 | all: lib | ||
| 34 | |||
| 35 | lib: $(LIBOBJ) | ||
| 36 | $(AR) $(LIB) $(LIBOBJ) | ||
| 37 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 38 | @touch lib | ||
| 39 | |||
| 40 | files: | ||
| 41 | $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO | ||
| 42 | |||
| 43 | links: | ||
| 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 | |||
| 48 | install: | ||
| 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 | |||
| 56 | tags: | ||
| 57 | ctags $(SRC) | ||
| 58 | |||
| 59 | tests: | ||
| 60 | |||
| 61 | lint: | ||
| 62 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 63 | |||
| 64 | depend: | ||
| 65 | @[ -n "$(MAKEDEPEND)" ] # should be set by upper Makefile... | ||
| 66 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 67 | |||
| 68 | dclean: | ||
| 69 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 70 | mv -f Makefile.new $(MAKEFILE) | ||
| 71 | |||
| 72 | clean: | ||
| 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 | |||
| 77 | err.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 78 | err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 79 | err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 80 | err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 81 | err.o: ../../include/openssl/ossl_typ.h ../../include/openssl/safestack.h | ||
| 82 | err.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 83 | err.o: ../cryptlib.h err.c | ||
| 84 | err_all.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h | ||
| 85 | err_all.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 86 | err_all.o: ../../include/openssl/conf.h ../../include/openssl/crypto.h | ||
| 87 | err_all.o: ../../include/openssl/dh.h ../../include/openssl/dsa.h | ||
| 88 | err_all.o: ../../include/openssl/dso.h ../../include/openssl/e_os2.h | ||
| 89 | err_all.o: ../../include/openssl/ec.h ../../include/openssl/ecdh.h | ||
| 90 | err_all.o: ../../include/openssl/ecdsa.h ../../include/openssl/engine.h | ||
| 91 | err_all.o: ../../include/openssl/err.h ../../include/openssl/evp.h | ||
| 92 | err_all.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h | ||
| 93 | err_all.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h | ||
| 94 | err_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 95 | err_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem2.h | ||
| 96 | err_all.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 97 | err_all.o: ../../include/openssl/rand.h ../../include/openssl/rsa.h | ||
| 98 | err_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 99 | err_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 100 | err_all.o: ../../include/openssl/ui.h ../../include/openssl/x509.h | ||
| 101 | err_all.o: ../../include/openssl/x509_vfy.h ../../include/openssl/x509v3.h | ||
| 102 | err_all.o: err_all.c | ||
| 103 | err_prn.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 104 | err_prn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 105 | err_prn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 106 | err_prn.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 107 | err_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h | ||
| 108 | err_prn.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 109 | err_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 | |||
| 5 | DIR= err | ||
| 6 | TOP= ../.. | ||
| 7 | CC= cc | ||
| 8 | INCLUDES= -I.. -I$(TOP) -I../../include | ||
| 9 | CFLAG=-g | ||
| 10 | INSTALL_PREFIX= | ||
| 11 | OPENSSLDIR= /usr/local/ssl | ||
| 12 | INSTALLTOP=/usr/local/ssl | ||
| 13 | MAKE= make -f Makefile.ssl | ||
| 14 | MAKEDEPPROG= makedepend | ||
| 15 | MAKEDEPEND= $(TOP)/util/domd $(TOP) -MD $(MAKEDEPPROG) | ||
| 16 | MAKEFILE= Makefile.ssl | ||
| 17 | AR= ar r | ||
| 18 | |||
| 19 | CFLAGS= $(INCLUDES) $(CFLAG) | ||
| 20 | |||
| 21 | GENERAL=Makefile | ||
| 22 | TEST= | ||
| 23 | APPS= | ||
| 24 | |||
| 25 | LIB=$(TOP)/libcrypto.a | ||
| 26 | LIBSRC=err.c err_all.c err_prn.c | ||
| 27 | LIBOBJ=err.o err_all.o err_prn.o | ||
| 28 | |||
| 29 | SRC= $(LIBSRC) | ||
| 30 | |||
| 31 | EXHEADER= err.h | ||
| 32 | HEADER= $(EXHEADER) | ||
| 33 | |||
| 34 | ALL= $(GENERAL) $(SRC) $(HEADER) | ||
| 35 | |||
| 36 | top: | ||
| 37 | (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) | ||
| 38 | |||
| 39 | all: lib | ||
| 40 | |||
| 41 | lib: $(LIBOBJ) | ||
| 42 | $(AR) $(LIB) $(LIBOBJ) | ||
| 43 | $(RANLIB) $(LIB) || echo Never mind. | ||
| 44 | @touch lib | ||
| 45 | |||
| 46 | files: | ||
| 47 | $(PERL) $(TOP)/util/files.pl Makefile.ssl >> $(TOP)/MINFO | ||
| 48 | |||
| 49 | links: | ||
| 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 | |||
| 55 | install: | ||
| 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 | |||
| 62 | tags: | ||
| 63 | ctags $(SRC) | ||
| 64 | |||
| 65 | tests: | ||
| 66 | |||
| 67 | lint: | ||
| 68 | lint -DLINT $(INCLUDES) $(SRC)>fluff | ||
| 69 | |||
| 70 | depend: | ||
| 71 | $(MAKEDEPEND) -- $(CFLAG) $(INCLUDES) $(DEPFLAG) -- $(PROGS) $(LIBSRC) | ||
| 72 | |||
| 73 | dclean: | ||
| 74 | $(PERL) -pe 'if (/^# DO NOT DELETE THIS LINE/) {print; exit(0);}' $(MAKEFILE) >Makefile.new | ||
| 75 | mv -f Makefile.new $(MAKEFILE) | ||
| 76 | |||
| 77 | clean: | ||
| 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 | |||
| 82 | err.o: ../../e_os.h ../../include/openssl/bio.h ../../include/openssl/buffer.h | ||
| 83 | err.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h | ||
| 84 | err.o: ../../include/openssl/err.h ../../include/openssl/lhash.h | ||
| 85 | err.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 86 | err.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h | ||
| 87 | err.o: ../../include/openssl/symhacks.h ../cryptlib.h err.c | ||
| 88 | err_all.o: ../../include/openssl/aes.h ../../include/openssl/asn1.h | ||
| 89 | err_all.o: ../../include/openssl/bio.h ../../include/openssl/blowfish.h | ||
| 90 | err_all.o: ../../include/openssl/bn.h ../../include/openssl/buffer.h | ||
| 91 | err_all.o: ../../include/openssl/cast.h ../../include/openssl/conf.h | ||
| 92 | err_all.o: ../../include/openssl/crypto.h ../../include/openssl/des.h | ||
| 93 | err_all.o: ../../include/openssl/des_old.h ../../include/openssl/dh.h | ||
| 94 | err_all.o: ../../include/openssl/dsa.h ../../include/openssl/dso.h | ||
| 95 | err_all.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h | ||
| 96 | err_all.o: ../../include/openssl/engine.h ../../include/openssl/err.h | ||
| 97 | err_all.o: ../../include/openssl/evp.h ../../include/openssl/idea.h | ||
| 98 | err_all.o: ../../include/openssl/lhash.h ../../include/openssl/md2.h | ||
| 99 | err_all.o: ../../include/openssl/md4.h ../../include/openssl/md5.h | ||
| 100 | err_all.o: ../../include/openssl/mdc2.h ../../include/openssl/obj_mac.h | ||
| 101 | err_all.o: ../../include/openssl/objects.h ../../include/openssl/ocsp.h | ||
| 102 | err_all.o: ../../include/openssl/opensslconf.h ../../include/openssl/opensslv.h | ||
| 103 | err_all.o: ../../include/openssl/ossl_typ.h ../../include/openssl/pem2.h | ||
| 104 | err_all.o: ../../include/openssl/pkcs12.h ../../include/openssl/pkcs7.h | ||
| 105 | err_all.o: ../../include/openssl/rand.h ../../include/openssl/rc2.h | ||
| 106 | err_all.o: ../../include/openssl/rc4.h ../../include/openssl/rc5.h | ||
| 107 | err_all.o: ../../include/openssl/ripemd.h ../../include/openssl/rsa.h | ||
| 108 | err_all.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h | ||
| 109 | err_all.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 110 | err_all.o: ../../include/openssl/ui.h ../../include/openssl/ui_compat.h | ||
| 111 | err_all.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h | ||
| 112 | err_all.o: ../../include/openssl/x509v3.h err_all.c | ||
| 113 | err_prn.o: ../../e_os.h ../../include/openssl/bio.h | ||
| 114 | err_prn.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h | ||
| 115 | err_prn.o: ../../include/openssl/e_os2.h ../../include/openssl/err.h | ||
| 116 | err_prn.o: ../../include/openssl/lhash.h ../../include/openssl/opensslconf.h | ||
| 117 | err_prn.o: ../../include/openssl/opensslv.h ../../include/openssl/safestack.h | ||
| 118 | err_prn.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h | ||
| 119 | err_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 | ||
| 545 | static void build_SYS_str_reasons(void) | 545 | static 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 | ||
| 616 | static void ERR_STATE_free(ERR_STATE *s) | 594 | static 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) */ |
| 966 | static int err_cmp(const void *a_void, const void *b_void) | 946 | static 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) */ |
| 973 | static unsigned long pid_hash(const void *a_void) | 953 | static 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) */ |
| 979 | static int pid_cmp(const void *a_void, const void *b_void) | 959 | static 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 | ||
| 985 | void ERR_remove_state(unsigned long pid) | 965 | void 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, ...) | |||
| 1097 | err: | 1077 | err: |
| 1098 | va_end(args); | 1078 | va_end(args); |
| 1099 | } | 1079 | } |
| 1100 | |||
| 1101 | int 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 | |||
| 1112 | int 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 |
| 95 | typedef struct err_state_st | 90 | typedef 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 | ||
| 302 | int ERR_get_next_error_library(void); | 287 | int ERR_get_next_error_library(void); |
| 303 | 288 | ||
| 304 | int ERR_set_mark(void); | 289 | /* This opaque type encapsulates the low-level error-state functions */ |
| 305 | int ERR_pop_to_mark(void); | 290 | typedef 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 */ |
| 311 | const ERR_FNS *ERR_get_implementation(void); | 293 | const 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 | ||
| 101 | void ERR_load_crypto_strings(void) | 92 | void 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 |
| 87 | static int print_fp(const char *str, size_t len, void *fp) | 87 | static 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 | } |
| 96 | void ERR_print_errors_fp(FILE *fp) | 91 | void 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 | |||
| 27 | L ENGINE crypto/engine/engine.h crypto/engine/eng_err.c | 27 | L ENGINE crypto/engine/engine.h crypto/engine/eng_err.c |
| 28 | L OCSP crypto/ocsp/ocsp.h crypto/ocsp/ocsp_err.c | 28 | L OCSP crypto/ocsp/ocsp.h crypto/ocsp/ocsp_err.c |
| 29 | L UI crypto/ui/ui.h crypto/ui/ui_err.c | 29 | L UI crypto/ui/ui.h crypto/ui/ui_err.c |
| 30 | L COMP crypto/comp/comp.h crypto/comp/comp_err.c | 30 | L FIPS fips-1.0/fips.h fips-1.0/fips_err.h |
| 31 | L ECDSA crypto/ecdsa/ecdsa.h crypto/ecdsa/ecs_err.c | ||
| 32 | L ECDH crypto/ecdh/ecdh.h crypto/ecdh/ech_err.c | ||
| 33 | L STORE crypto/store/store.h crypto/store/str_err.c | ||
| 34 | L 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 |
| 37 | L NONE crypto/x509/x509_vfy.h NONE | 33 | L NONE crypto/x509/x509_vfy.h NONE |
| 38 | L NONE crypto/ec/ec_lcl.h NONE | 34 | L NONE crypto/ec/ec_lcl.h NONE |
| 39 | L NONE crypto/cms/cms_lcl.h NONE | ||
| 40 | 35 | ||
| 41 | 36 | ||
| 42 | F RSAREF_F_RSA_BN2BIN | 37 | F RSAREF_F_RSA_BN2BIN |
