diff options
-rw-r--r-- | src/lib/libcrypto/err/err.c | 204 | ||||
-rw-r--r-- | src/lib/libssl/src/crypto/err/err.c | 204 |
2 files changed, 212 insertions, 196 deletions
diff --git a/src/lib/libcrypto/err/err.c b/src/lib/libcrypto/err/err.c index 4ea756003a..0b26430dbd 100644 --- a/src/lib/libcrypto/err/err.c +++ b/src/lib/libcrypto/err/err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: err.c,v 1.34 2014/06/26 15:24:08 deraadt Exp $ */ | 1 | /* $OpenBSD: err.c,v 1.35 2014/06/27 06:07:01 deraadt Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -127,34 +127,34 @@ static void err_load_strings(int lib, ERR_STRING_DATA *str); | |||
127 | static void ERR_STATE_free(ERR_STATE *s); | 127 | static void ERR_STATE_free(ERR_STATE *s); |
128 | #ifndef OPENSSL_NO_ERR | 128 | #ifndef OPENSSL_NO_ERR |
129 | static ERR_STRING_DATA ERR_str_libraries[] = { | 129 | static ERR_STRING_DATA ERR_str_libraries[] = { |
130 | {ERR_PACK(ERR_LIB_NONE,0,0) , "unknown library"}, | 130 | {ERR_PACK(ERR_LIB_NONE,0,0), "unknown library"}, |
131 | {ERR_PACK(ERR_LIB_SYS,0,0) , "system library"}, | 131 | {ERR_PACK(ERR_LIB_SYS,0,0), "system library"}, |
132 | {ERR_PACK(ERR_LIB_BN,0,0) , "bignum routines"}, | 132 | {ERR_PACK(ERR_LIB_BN,0,0), "bignum routines"}, |
133 | {ERR_PACK(ERR_LIB_RSA,0,0) , "rsa routines"}, | 133 | {ERR_PACK(ERR_LIB_RSA,0,0), "rsa routines"}, |
134 | {ERR_PACK(ERR_LIB_DH,0,0) , "Diffie-Hellman routines"}, | 134 | {ERR_PACK(ERR_LIB_DH,0,0), "Diffie-Hellman routines"}, |
135 | {ERR_PACK(ERR_LIB_EVP,0,0) , "digital envelope routines"}, | 135 | {ERR_PACK(ERR_LIB_EVP,0,0), "digital envelope routines"}, |
136 | {ERR_PACK(ERR_LIB_BUF,0,0) , "memory buffer routines"}, | 136 | {ERR_PACK(ERR_LIB_BUF,0,0), "memory buffer routines"}, |
137 | {ERR_PACK(ERR_LIB_OBJ,0,0) , "object identifier routines"}, | 137 | {ERR_PACK(ERR_LIB_OBJ,0,0), "object identifier routines"}, |
138 | {ERR_PACK(ERR_LIB_PEM,0,0) , "PEM routines"}, | 138 | {ERR_PACK(ERR_LIB_PEM,0,0), "PEM routines"}, |
139 | {ERR_PACK(ERR_LIB_DSA,0,0) , "dsa routines"}, | 139 | {ERR_PACK(ERR_LIB_DSA,0,0), "dsa routines"}, |
140 | {ERR_PACK(ERR_LIB_X509,0,0) , "x509 certificate routines"}, | 140 | {ERR_PACK(ERR_LIB_X509,0,0), "x509 certificate routines"}, |
141 | {ERR_PACK(ERR_LIB_ASN1,0,0) , "asn1 encoding routines"}, | 141 | {ERR_PACK(ERR_LIB_ASN1,0,0), "asn1 encoding routines"}, |
142 | {ERR_PACK(ERR_LIB_CONF,0,0) , "configuration file routines"}, | 142 | {ERR_PACK(ERR_LIB_CONF,0,0), "configuration file routines"}, |
143 | {ERR_PACK(ERR_LIB_CRYPTO,0,0) , "common libcrypto routines"}, | 143 | {ERR_PACK(ERR_LIB_CRYPTO,0,0), "common libcrypto routines"}, |
144 | {ERR_PACK(ERR_LIB_EC,0,0) , "elliptic curve routines"}, | 144 | {ERR_PACK(ERR_LIB_EC,0,0), "elliptic curve routines"}, |
145 | {ERR_PACK(ERR_LIB_SSL,0,0) , "SSL routines"}, | 145 | {ERR_PACK(ERR_LIB_SSL,0,0), "SSL routines"}, |
146 | {ERR_PACK(ERR_LIB_BIO,0,0) , "BIO routines"}, | 146 | {ERR_PACK(ERR_LIB_BIO,0,0), "BIO routines"}, |
147 | {ERR_PACK(ERR_LIB_PKCS7,0,0) , "PKCS7 routines"}, | 147 | {ERR_PACK(ERR_LIB_PKCS7,0,0), "PKCS7 routines"}, |
148 | {ERR_PACK(ERR_LIB_X509V3,0,0) , "X509 V3 routines"}, | 148 | {ERR_PACK(ERR_LIB_X509V3,0,0), "X509 V3 routines"}, |
149 | {ERR_PACK(ERR_LIB_PKCS12,0,0) , "PKCS12 routines"}, | 149 | {ERR_PACK(ERR_LIB_PKCS12,0,0), "PKCS12 routines"}, |
150 | {ERR_PACK(ERR_LIB_RAND,0,0) , "random number generator"}, | 150 | {ERR_PACK(ERR_LIB_RAND,0,0), "random number generator"}, |
151 | {ERR_PACK(ERR_LIB_DSO,0,0) , "DSO support routines"}, | 151 | {ERR_PACK(ERR_LIB_DSO,0,0), "DSO support routines"}, |
152 | {ERR_PACK(ERR_LIB_TS,0,0) , "time stamp routines"}, | 152 | {ERR_PACK(ERR_LIB_TS,0,0), "time stamp routines"}, |
153 | {ERR_PACK(ERR_LIB_ENGINE,0,0) , "engine routines"}, | 153 | {ERR_PACK(ERR_LIB_ENGINE,0,0), "engine routines"}, |
154 | {ERR_PACK(ERR_LIB_OCSP,0,0) , "OCSP routines"}, | 154 | {ERR_PACK(ERR_LIB_OCSP,0,0), "OCSP routines"}, |
155 | {ERR_PACK(ERR_LIB_FIPS,0,0) , "FIPS routines"}, | 155 | {ERR_PACK(ERR_LIB_FIPS,0,0), "FIPS routines"}, |
156 | {ERR_PACK(ERR_LIB_CMS,0,0) , "CMS routines"}, | 156 | {ERR_PACK(ERR_LIB_CMS,0,0), "CMS routines"}, |
157 | {ERR_PACK(ERR_LIB_HMAC,0,0) , "HMAC routines"}, | 157 | {ERR_PACK(ERR_LIB_HMAC,0,0), "HMAC routines"}, |
158 | {0, NULL}, | 158 | {0, NULL}, |
159 | }; | 159 | }; |
160 | 160 | ||
@@ -173,44 +173,44 @@ static ERR_STRING_DATA ERR_str_functs[] = { | |||
173 | }; | 173 | }; |
174 | 174 | ||
175 | static ERR_STRING_DATA ERR_str_reasons[] = { | 175 | static ERR_STRING_DATA ERR_str_reasons[] = { |
176 | {ERR_R_SYS_LIB , "system lib"}, | 176 | {ERR_R_SYS_LIB, "system lib"}, |
177 | {ERR_R_BN_LIB , "BN lib"}, | 177 | {ERR_R_BN_LIB, "BN lib"}, |
178 | {ERR_R_RSA_LIB , "RSA lib"}, | 178 | {ERR_R_RSA_LIB, "RSA lib"}, |
179 | {ERR_R_DH_LIB , "DH lib"}, | 179 | {ERR_R_DH_LIB, "DH lib"}, |
180 | {ERR_R_EVP_LIB , "EVP lib"}, | 180 | {ERR_R_EVP_LIB, "EVP lib"}, |
181 | {ERR_R_BUF_LIB , "BUF lib"}, | 181 | {ERR_R_BUF_LIB, "BUF lib"}, |
182 | {ERR_R_OBJ_LIB , "OBJ lib"}, | 182 | {ERR_R_OBJ_LIB, "OBJ lib"}, |
183 | {ERR_R_PEM_LIB , "PEM lib"}, | 183 | {ERR_R_PEM_LIB, "PEM lib"}, |
184 | {ERR_R_DSA_LIB , "DSA lib"}, | 184 | {ERR_R_DSA_LIB, "DSA lib"}, |
185 | {ERR_R_X509_LIB , "X509 lib"}, | 185 | {ERR_R_X509_LIB, "X509 lib"}, |
186 | {ERR_R_ASN1_LIB , "ASN1 lib"}, | 186 | {ERR_R_ASN1_LIB, "ASN1 lib"}, |
187 | {ERR_R_CONF_LIB , "CONF lib"}, | 187 | {ERR_R_CONF_LIB, "CONF lib"}, |
188 | {ERR_R_CRYPTO_LIB , "CRYPTO lib"}, | 188 | {ERR_R_CRYPTO_LIB, "CRYPTO lib"}, |
189 | {ERR_R_EC_LIB , "EC lib"}, | 189 | {ERR_R_EC_LIB, "EC lib"}, |
190 | {ERR_R_SSL_LIB , "SSL lib"}, | 190 | {ERR_R_SSL_LIB, "SSL lib"}, |
191 | {ERR_R_BIO_LIB , "BIO lib"}, | 191 | {ERR_R_BIO_LIB, "BIO lib"}, |
192 | {ERR_R_PKCS7_LIB , "PKCS7 lib"}, | 192 | {ERR_R_PKCS7_LIB, "PKCS7 lib"}, |
193 | {ERR_R_X509V3_LIB , "X509V3 lib"}, | 193 | {ERR_R_X509V3_LIB, "X509V3 lib"}, |
194 | {ERR_R_PKCS12_LIB , "PKCS12 lib"}, | 194 | {ERR_R_PKCS12_LIB, "PKCS12 lib"}, |
195 | {ERR_R_RAND_LIB , "RAND lib"}, | 195 | {ERR_R_RAND_LIB, "RAND lib"}, |
196 | {ERR_R_DSO_LIB , "DSO lib"}, | 196 | {ERR_R_DSO_LIB, "DSO lib"}, |
197 | {ERR_R_ENGINE_LIB , "ENGINE lib"}, | 197 | {ERR_R_ENGINE_LIB, "ENGINE lib"}, |
198 | {ERR_R_OCSP_LIB , "OCSP lib"}, | 198 | {ERR_R_OCSP_LIB, "OCSP lib"}, |
199 | {ERR_R_TS_LIB , "TS lib"}, | 199 | {ERR_R_TS_LIB, "TS lib"}, |
200 | 200 | ||
201 | {ERR_R_NESTED_ASN1_ERROR , "nested asn1 error"}, | 201 | {ERR_R_NESTED_ASN1_ERROR, "nested asn1 error"}, |
202 | {ERR_R_BAD_ASN1_OBJECT_HEADER , "bad asn1 object header"}, | 202 | {ERR_R_BAD_ASN1_OBJECT_HEADER, "bad asn1 object header"}, |
203 | {ERR_R_BAD_GET_ASN1_OBJECT_CALL , "bad get asn1 object call"}, | 203 | {ERR_R_BAD_GET_ASN1_OBJECT_CALL, "bad get asn1 object call"}, |
204 | {ERR_R_EXPECTING_AN_ASN1_SEQUENCE , "expecting an asn1 sequence"}, | 204 | {ERR_R_EXPECTING_AN_ASN1_SEQUENCE, "expecting an asn1 sequence"}, |
205 | {ERR_R_ASN1_LENGTH_MISMATCH , "asn1 length mismatch"}, | 205 | {ERR_R_ASN1_LENGTH_MISMATCH, "asn1 length mismatch"}, |
206 | {ERR_R_MISSING_ASN1_EOS , "missing asn1 eos"}, | 206 | {ERR_R_MISSING_ASN1_EOS, "missing asn1 eos"}, |
207 | 207 | ||
208 | {ERR_R_FATAL , "fatal"}, | 208 | {ERR_R_FATAL, "fatal"}, |
209 | {ERR_R_MALLOC_FAILURE , "malloc failure"}, | 209 | {ERR_R_MALLOC_FAILURE, "malloc failure"}, |
210 | {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"}, |
211 | {ERR_R_PASSED_NULL_PARAMETER , "passed a null parameter"}, | 211 | {ERR_R_PASSED_NULL_PARAMETER, "passed a null parameter"}, |
212 | {ERR_R_INTERNAL_ERROR , "internal error"}, | 212 | {ERR_R_INTERNAL_ERROR, "internal error"}, |
213 | {ERR_R_DISABLED , "called a function that was disabled at compile-time"}, | 213 | {ERR_R_DISABLED , "called a function that was disabled at compile-time"}, |
214 | 214 | ||
215 | {0, NULL}, | 215 | {0, NULL}, |
216 | }; | 216 | }; |
@@ -615,22 +615,21 @@ build_SYS_str_reasons(void) | |||
615 | 615 | ||
616 | #define err_clear_data(p,i) \ | 616 | #define err_clear_data(p,i) \ |
617 | do { \ | 617 | do { \ |
618 | if (((p)->err_data[i] != NULL) && \ | 618 | if (((p)->err_data[i] != NULL) && \ |
619 | (p)->err_data_flags[i] & ERR_TXT_MALLOCED) \ | 619 | (p)->err_data_flags[i] & ERR_TXT_MALLOCED) { \ |
620 | { \ | 620 | free((p)->err_data[i]); \ |
621 | free((p)->err_data[i]); \ | 621 | (p)->err_data[i] = NULL; \ |
622 | (p)->err_data[i]=NULL; \ | ||
623 | } \ | 622 | } \ |
624 | (p)->err_data_flags[i]=0; \ | 623 | (p)->err_data_flags[i] = 0; \ |
625 | } while(0) | 624 | } while(0) |
626 | 625 | ||
627 | #define err_clear(p,i) \ | 626 | #define err_clear(p,i) \ |
628 | do { \ | 627 | do { \ |
629 | (p)->err_flags[i]=0; \ | 628 | (p)->err_flags[i] = 0; \ |
630 | (p)->err_buffer[i]=0; \ | 629 | (p)->err_buffer[i] = 0; \ |
631 | err_clear_data(p,i); \ | 630 | err_clear_data(p, i); \ |
632 | (p)->err_file[i]=NULL; \ | 631 | (p)->err_file[i] = NULL; \ |
633 | (p)->err_line[i]= -1; \ | 632 | (p)->err_line[i] = -1; \ |
634 | } while(0) | 633 | } while(0) |
635 | 634 | ||
636 | static void | 635 | static void |
@@ -732,57 +731,66 @@ ERR_clear_error(void) | |||
732 | } | 731 | } |
733 | 732 | ||
734 | 733 | ||
735 | unsigned long ERR_get_error(void) | 734 | unsigned long |
735 | ERR_get_error(void) | ||
736 | { | 736 | { |
737 | return (get_error_values(1, 0,NULL, NULL, NULL, NULL)); | 737 | return (get_error_values(1, 0, NULL, NULL, NULL, NULL)); |
738 | } | 738 | } |
739 | 739 | ||
740 | unsigned long ERR_get_error_line(const char **file, int *line) | 740 | unsigned long |
741 | ERR_get_error_line(const char **file, int *line) | ||
741 | { | 742 | { |
742 | return (get_error_values(1, 0,file, line, NULL, NULL)); | 743 | return (get_error_values(1, 0, file, line, NULL, NULL)); |
743 | } | 744 | } |
744 | 745 | ||
745 | unsigned long ERR_get_error_line_data(const char **file, int *line, | 746 | unsigned long |
747 | ERR_get_error_line_data(const char **file, int *line, | ||
746 | const char **data, int *flags) | 748 | const char **data, int *flags) |
747 | { | 749 | { |
748 | return (get_error_values(1, 0,file, line, data, flags)); | 750 | return (get_error_values(1, 0, file, line, data, flags)); |
749 | } | 751 | } |
750 | 752 | ||
751 | 753 | ||
752 | unsigned long ERR_peek_error(void) | 754 | unsigned long |
755 | ERR_peek_error(void) | ||
753 | { | 756 | { |
754 | return (get_error_values(0, 0,NULL, NULL, NULL, NULL)); | 757 | return (get_error_values(0, 0, NULL, NULL, NULL, NULL)); |
755 | } | 758 | } |
756 | 759 | ||
757 | unsigned long ERR_peek_error_line(const char **file, int *line) | 760 | unsigned long |
761 | ERR_peek_error_line(const char **file, int *line) | ||
758 | { | 762 | { |
759 | return (get_error_values(0, 0,file, line, NULL, NULL)); | 763 | return (get_error_values(0, 0, file, line, NULL, NULL)); |
760 | } | 764 | } |
761 | 765 | ||
762 | unsigned long ERR_peek_error_line_data(const char **file, int *line, | 766 | unsigned long |
767 | ERR_peek_error_line_data(const char **file, int *line, | ||
763 | const char **data, int *flags) | 768 | const char **data, int *flags) |
764 | { | 769 | { |
765 | return (get_error_values(0, 0,file, line, data, flags)); | 770 | return (get_error_values(0, 0, file, line, data, flags)); |
766 | } | 771 | } |
767 | 772 | ||
768 | unsigned long ERR_peek_last_error(void) | 773 | unsigned long |
774 | ERR_peek_last_error(void) | ||
769 | { | 775 | { |
770 | return (get_error_values(0, 1,NULL, NULL, NULL, NULL)); | 776 | return (get_error_values(0, 1, NULL, NULL, NULL, NULL)); |
771 | } | 777 | } |
772 | 778 | ||
773 | unsigned long ERR_peek_last_error_line(const char **file, int *line) | 779 | unsigned long |
780 | ERR_peek_last_error_line(const char **file, int *line) | ||
774 | { | 781 | { |
775 | return (get_error_values(0, 1,file, line, NULL, NULL)); | 782 | return (get_error_values(0, 1, file, line, NULL, NULL)); |
776 | } | 783 | } |
777 | 784 | ||
778 | unsigned long ERR_peek_last_error_line_data(const char **file, int *line, | 785 | unsigned long |
786 | ERR_peek_last_error_line_data(const char **file, int *line, | ||
779 | const char **data, int *flags) | 787 | const char **data, int *flags) |
780 | { | 788 | { |
781 | return (get_error_values(0, 1,file, line, data, flags)); | 789 | return (get_error_values(0, 1, file, line, data, flags)); |
782 | } | 790 | } |
783 | 791 | ||
784 | static unsigned | 792 | static unsigned long |
785 | long get_error_values(int inc, int top, const char **file, int *line, | 793 | get_error_values(int inc, int top, const char **file, int *line, |
786 | const char **data, int *flags) | 794 | const char **data, int *flags) |
787 | { | 795 | { |
788 | int i = 0; | 796 | int i = 0; |
diff --git a/src/lib/libssl/src/crypto/err/err.c b/src/lib/libssl/src/crypto/err/err.c index 4ea756003a..0b26430dbd 100644 --- a/src/lib/libssl/src/crypto/err/err.c +++ b/src/lib/libssl/src/crypto/err/err.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: err.c,v 1.34 2014/06/26 15:24:08 deraadt Exp $ */ | 1 | /* $OpenBSD: err.c,v 1.35 2014/06/27 06:07:01 deraadt Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -127,34 +127,34 @@ static void err_load_strings(int lib, ERR_STRING_DATA *str); | |||
127 | static void ERR_STATE_free(ERR_STATE *s); | 127 | static void ERR_STATE_free(ERR_STATE *s); |
128 | #ifndef OPENSSL_NO_ERR | 128 | #ifndef OPENSSL_NO_ERR |
129 | static ERR_STRING_DATA ERR_str_libraries[] = { | 129 | static ERR_STRING_DATA ERR_str_libraries[] = { |
130 | {ERR_PACK(ERR_LIB_NONE,0,0) , "unknown library"}, | 130 | {ERR_PACK(ERR_LIB_NONE,0,0), "unknown library"}, |
131 | {ERR_PACK(ERR_LIB_SYS,0,0) , "system library"}, | 131 | {ERR_PACK(ERR_LIB_SYS,0,0), "system library"}, |
132 | {ERR_PACK(ERR_LIB_BN,0,0) , "bignum routines"}, | 132 | {ERR_PACK(ERR_LIB_BN,0,0), "bignum routines"}, |
133 | {ERR_PACK(ERR_LIB_RSA,0,0) , "rsa routines"}, | 133 | {ERR_PACK(ERR_LIB_RSA,0,0), "rsa routines"}, |
134 | {ERR_PACK(ERR_LIB_DH,0,0) , "Diffie-Hellman routines"}, | 134 | {ERR_PACK(ERR_LIB_DH,0,0), "Diffie-Hellman routines"}, |
135 | {ERR_PACK(ERR_LIB_EVP,0,0) , "digital envelope routines"}, | 135 | {ERR_PACK(ERR_LIB_EVP,0,0), "digital envelope routines"}, |
136 | {ERR_PACK(ERR_LIB_BUF,0,0) , "memory buffer routines"}, | 136 | {ERR_PACK(ERR_LIB_BUF,0,0), "memory buffer routines"}, |
137 | {ERR_PACK(ERR_LIB_OBJ,0,0) , "object identifier routines"}, | 137 | {ERR_PACK(ERR_LIB_OBJ,0,0), "object identifier routines"}, |
138 | {ERR_PACK(ERR_LIB_PEM,0,0) , "PEM routines"}, | 138 | {ERR_PACK(ERR_LIB_PEM,0,0), "PEM routines"}, |
139 | {ERR_PACK(ERR_LIB_DSA,0,0) , "dsa routines"}, | 139 | {ERR_PACK(ERR_LIB_DSA,0,0), "dsa routines"}, |
140 | {ERR_PACK(ERR_LIB_X509,0,0) , "x509 certificate routines"}, | 140 | {ERR_PACK(ERR_LIB_X509,0,0), "x509 certificate routines"}, |
141 | {ERR_PACK(ERR_LIB_ASN1,0,0) , "asn1 encoding routines"}, | 141 | {ERR_PACK(ERR_LIB_ASN1,0,0), "asn1 encoding routines"}, |
142 | {ERR_PACK(ERR_LIB_CONF,0,0) , "configuration file routines"}, | 142 | {ERR_PACK(ERR_LIB_CONF,0,0), "configuration file routines"}, |
143 | {ERR_PACK(ERR_LIB_CRYPTO,0,0) , "common libcrypto routines"}, | 143 | {ERR_PACK(ERR_LIB_CRYPTO,0,0), "common libcrypto routines"}, |
144 | {ERR_PACK(ERR_LIB_EC,0,0) , "elliptic curve routines"}, | 144 | {ERR_PACK(ERR_LIB_EC,0,0), "elliptic curve routines"}, |
145 | {ERR_PACK(ERR_LIB_SSL,0,0) , "SSL routines"}, | 145 | {ERR_PACK(ERR_LIB_SSL,0,0), "SSL routines"}, |
146 | {ERR_PACK(ERR_LIB_BIO,0,0) , "BIO routines"}, | 146 | {ERR_PACK(ERR_LIB_BIO,0,0), "BIO routines"}, |
147 | {ERR_PACK(ERR_LIB_PKCS7,0,0) , "PKCS7 routines"}, | 147 | {ERR_PACK(ERR_LIB_PKCS7,0,0), "PKCS7 routines"}, |
148 | {ERR_PACK(ERR_LIB_X509V3,0,0) , "X509 V3 routines"}, | 148 | {ERR_PACK(ERR_LIB_X509V3,0,0), "X509 V3 routines"}, |
149 | {ERR_PACK(ERR_LIB_PKCS12,0,0) , "PKCS12 routines"}, | 149 | {ERR_PACK(ERR_LIB_PKCS12,0,0), "PKCS12 routines"}, |
150 | {ERR_PACK(ERR_LIB_RAND,0,0) , "random number generator"}, | 150 | {ERR_PACK(ERR_LIB_RAND,0,0), "random number generator"}, |
151 | {ERR_PACK(ERR_LIB_DSO,0,0) , "DSO support routines"}, | 151 | {ERR_PACK(ERR_LIB_DSO,0,0), "DSO support routines"}, |
152 | {ERR_PACK(ERR_LIB_TS,0,0) , "time stamp routines"}, | 152 | {ERR_PACK(ERR_LIB_TS,0,0), "time stamp routines"}, |
153 | {ERR_PACK(ERR_LIB_ENGINE,0,0) , "engine routines"}, | 153 | {ERR_PACK(ERR_LIB_ENGINE,0,0), "engine routines"}, |
154 | {ERR_PACK(ERR_LIB_OCSP,0,0) , "OCSP routines"}, | 154 | {ERR_PACK(ERR_LIB_OCSP,0,0), "OCSP routines"}, |
155 | {ERR_PACK(ERR_LIB_FIPS,0,0) , "FIPS routines"}, | 155 | {ERR_PACK(ERR_LIB_FIPS,0,0), "FIPS routines"}, |
156 | {ERR_PACK(ERR_LIB_CMS,0,0) , "CMS routines"}, | 156 | {ERR_PACK(ERR_LIB_CMS,0,0), "CMS routines"}, |
157 | {ERR_PACK(ERR_LIB_HMAC,0,0) , "HMAC routines"}, | 157 | {ERR_PACK(ERR_LIB_HMAC,0,0), "HMAC routines"}, |
158 | {0, NULL}, | 158 | {0, NULL}, |
159 | }; | 159 | }; |
160 | 160 | ||
@@ -173,44 +173,44 @@ static ERR_STRING_DATA ERR_str_functs[] = { | |||
173 | }; | 173 | }; |
174 | 174 | ||
175 | static ERR_STRING_DATA ERR_str_reasons[] = { | 175 | static ERR_STRING_DATA ERR_str_reasons[] = { |
176 | {ERR_R_SYS_LIB , "system lib"}, | 176 | {ERR_R_SYS_LIB, "system lib"}, |
177 | {ERR_R_BN_LIB , "BN lib"}, | 177 | {ERR_R_BN_LIB, "BN lib"}, |
178 | {ERR_R_RSA_LIB , "RSA lib"}, | 178 | {ERR_R_RSA_LIB, "RSA lib"}, |
179 | {ERR_R_DH_LIB , "DH lib"}, | 179 | {ERR_R_DH_LIB, "DH lib"}, |
180 | {ERR_R_EVP_LIB , "EVP lib"}, | 180 | {ERR_R_EVP_LIB, "EVP lib"}, |
181 | {ERR_R_BUF_LIB , "BUF lib"}, | 181 | {ERR_R_BUF_LIB, "BUF lib"}, |
182 | {ERR_R_OBJ_LIB , "OBJ lib"}, | 182 | {ERR_R_OBJ_LIB, "OBJ lib"}, |
183 | {ERR_R_PEM_LIB , "PEM lib"}, | 183 | {ERR_R_PEM_LIB, "PEM lib"}, |
184 | {ERR_R_DSA_LIB , "DSA lib"}, | 184 | {ERR_R_DSA_LIB, "DSA lib"}, |
185 | {ERR_R_X509_LIB , "X509 lib"}, | 185 | {ERR_R_X509_LIB, "X509 lib"}, |
186 | {ERR_R_ASN1_LIB , "ASN1 lib"}, | 186 | {ERR_R_ASN1_LIB, "ASN1 lib"}, |
187 | {ERR_R_CONF_LIB , "CONF lib"}, | 187 | {ERR_R_CONF_LIB, "CONF lib"}, |
188 | {ERR_R_CRYPTO_LIB , "CRYPTO lib"}, | 188 | {ERR_R_CRYPTO_LIB, "CRYPTO lib"}, |
189 | {ERR_R_EC_LIB , "EC lib"}, | 189 | {ERR_R_EC_LIB, "EC lib"}, |
190 | {ERR_R_SSL_LIB , "SSL lib"}, | 190 | {ERR_R_SSL_LIB, "SSL lib"}, |
191 | {ERR_R_BIO_LIB , "BIO lib"}, | 191 | {ERR_R_BIO_LIB, "BIO lib"}, |
192 | {ERR_R_PKCS7_LIB , "PKCS7 lib"}, | 192 | {ERR_R_PKCS7_LIB, "PKCS7 lib"}, |
193 | {ERR_R_X509V3_LIB , "X509V3 lib"}, | 193 | {ERR_R_X509V3_LIB, "X509V3 lib"}, |
194 | {ERR_R_PKCS12_LIB , "PKCS12 lib"}, | 194 | {ERR_R_PKCS12_LIB, "PKCS12 lib"}, |
195 | {ERR_R_RAND_LIB , "RAND lib"}, | 195 | {ERR_R_RAND_LIB, "RAND lib"}, |
196 | {ERR_R_DSO_LIB , "DSO lib"}, | 196 | {ERR_R_DSO_LIB, "DSO lib"}, |
197 | {ERR_R_ENGINE_LIB , "ENGINE lib"}, | 197 | {ERR_R_ENGINE_LIB, "ENGINE lib"}, |
198 | {ERR_R_OCSP_LIB , "OCSP lib"}, | 198 | {ERR_R_OCSP_LIB, "OCSP lib"}, |
199 | {ERR_R_TS_LIB , "TS lib"}, | 199 | {ERR_R_TS_LIB, "TS lib"}, |
200 | 200 | ||
201 | {ERR_R_NESTED_ASN1_ERROR , "nested asn1 error"}, | 201 | {ERR_R_NESTED_ASN1_ERROR, "nested asn1 error"}, |
202 | {ERR_R_BAD_ASN1_OBJECT_HEADER , "bad asn1 object header"}, | 202 | {ERR_R_BAD_ASN1_OBJECT_HEADER, "bad asn1 object header"}, |
203 | {ERR_R_BAD_GET_ASN1_OBJECT_CALL , "bad get asn1 object call"}, | 203 | {ERR_R_BAD_GET_ASN1_OBJECT_CALL, "bad get asn1 object call"}, |
204 | {ERR_R_EXPECTING_AN_ASN1_SEQUENCE , "expecting an asn1 sequence"}, | 204 | {ERR_R_EXPECTING_AN_ASN1_SEQUENCE, "expecting an asn1 sequence"}, |
205 | {ERR_R_ASN1_LENGTH_MISMATCH , "asn1 length mismatch"}, | 205 | {ERR_R_ASN1_LENGTH_MISMATCH, "asn1 length mismatch"}, |
206 | {ERR_R_MISSING_ASN1_EOS , "missing asn1 eos"}, | 206 | {ERR_R_MISSING_ASN1_EOS, "missing asn1 eos"}, |
207 | 207 | ||
208 | {ERR_R_FATAL , "fatal"}, | 208 | {ERR_R_FATAL, "fatal"}, |
209 | {ERR_R_MALLOC_FAILURE , "malloc failure"}, | 209 | {ERR_R_MALLOC_FAILURE, "malloc failure"}, |
210 | {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"}, |
211 | {ERR_R_PASSED_NULL_PARAMETER , "passed a null parameter"}, | 211 | {ERR_R_PASSED_NULL_PARAMETER, "passed a null parameter"}, |
212 | {ERR_R_INTERNAL_ERROR , "internal error"}, | 212 | {ERR_R_INTERNAL_ERROR, "internal error"}, |
213 | {ERR_R_DISABLED , "called a function that was disabled at compile-time"}, | 213 | {ERR_R_DISABLED , "called a function that was disabled at compile-time"}, |
214 | 214 | ||
215 | {0, NULL}, | 215 | {0, NULL}, |
216 | }; | 216 | }; |
@@ -615,22 +615,21 @@ build_SYS_str_reasons(void) | |||
615 | 615 | ||
616 | #define err_clear_data(p,i) \ | 616 | #define err_clear_data(p,i) \ |
617 | do { \ | 617 | do { \ |
618 | if (((p)->err_data[i] != NULL) && \ | 618 | if (((p)->err_data[i] != NULL) && \ |
619 | (p)->err_data_flags[i] & ERR_TXT_MALLOCED) \ | 619 | (p)->err_data_flags[i] & ERR_TXT_MALLOCED) { \ |
620 | { \ | 620 | free((p)->err_data[i]); \ |
621 | free((p)->err_data[i]); \ | 621 | (p)->err_data[i] = NULL; \ |
622 | (p)->err_data[i]=NULL; \ | ||
623 | } \ | 622 | } \ |
624 | (p)->err_data_flags[i]=0; \ | 623 | (p)->err_data_flags[i] = 0; \ |
625 | } while(0) | 624 | } while(0) |
626 | 625 | ||
627 | #define err_clear(p,i) \ | 626 | #define err_clear(p,i) \ |
628 | do { \ | 627 | do { \ |
629 | (p)->err_flags[i]=0; \ | 628 | (p)->err_flags[i] = 0; \ |
630 | (p)->err_buffer[i]=0; \ | 629 | (p)->err_buffer[i] = 0; \ |
631 | err_clear_data(p,i); \ | 630 | err_clear_data(p, i); \ |
632 | (p)->err_file[i]=NULL; \ | 631 | (p)->err_file[i] = NULL; \ |
633 | (p)->err_line[i]= -1; \ | 632 | (p)->err_line[i] = -1; \ |
634 | } while(0) | 633 | } while(0) |
635 | 634 | ||
636 | static void | 635 | static void |
@@ -732,57 +731,66 @@ ERR_clear_error(void) | |||
732 | } | 731 | } |
733 | 732 | ||
734 | 733 | ||
735 | unsigned long ERR_get_error(void) | 734 | unsigned long |
735 | ERR_get_error(void) | ||
736 | { | 736 | { |
737 | return (get_error_values(1, 0,NULL, NULL, NULL, NULL)); | 737 | return (get_error_values(1, 0, NULL, NULL, NULL, NULL)); |
738 | } | 738 | } |
739 | 739 | ||
740 | unsigned long ERR_get_error_line(const char **file, int *line) | 740 | unsigned long |
741 | ERR_get_error_line(const char **file, int *line) | ||
741 | { | 742 | { |
742 | return (get_error_values(1, 0,file, line, NULL, NULL)); | 743 | return (get_error_values(1, 0, file, line, NULL, NULL)); |
743 | } | 744 | } |
744 | 745 | ||
745 | unsigned long ERR_get_error_line_data(const char **file, int *line, | 746 | unsigned long |
747 | ERR_get_error_line_data(const char **file, int *line, | ||
746 | const char **data, int *flags) | 748 | const char **data, int *flags) |
747 | { | 749 | { |
748 | return (get_error_values(1, 0,file, line, data, flags)); | 750 | return (get_error_values(1, 0, file, line, data, flags)); |
749 | } | 751 | } |
750 | 752 | ||
751 | 753 | ||
752 | unsigned long ERR_peek_error(void) | 754 | unsigned long |
755 | ERR_peek_error(void) | ||
753 | { | 756 | { |
754 | return (get_error_values(0, 0,NULL, NULL, NULL, NULL)); | 757 | return (get_error_values(0, 0, NULL, NULL, NULL, NULL)); |
755 | } | 758 | } |
756 | 759 | ||
757 | unsigned long ERR_peek_error_line(const char **file, int *line) | 760 | unsigned long |
761 | ERR_peek_error_line(const char **file, int *line) | ||
758 | { | 762 | { |
759 | return (get_error_values(0, 0,file, line, NULL, NULL)); | 763 | return (get_error_values(0, 0, file, line, NULL, NULL)); |
760 | } | 764 | } |
761 | 765 | ||
762 | unsigned long ERR_peek_error_line_data(const char **file, int *line, | 766 | unsigned long |
767 | ERR_peek_error_line_data(const char **file, int *line, | ||
763 | const char **data, int *flags) | 768 | const char **data, int *flags) |
764 | { | 769 | { |
765 | return (get_error_values(0, 0,file, line, data, flags)); | 770 | return (get_error_values(0, 0, file, line, data, flags)); |
766 | } | 771 | } |
767 | 772 | ||
768 | unsigned long ERR_peek_last_error(void) | 773 | unsigned long |
774 | ERR_peek_last_error(void) | ||
769 | { | 775 | { |
770 | return (get_error_values(0, 1,NULL, NULL, NULL, NULL)); | 776 | return (get_error_values(0, 1, NULL, NULL, NULL, NULL)); |
771 | } | 777 | } |
772 | 778 | ||
773 | unsigned long ERR_peek_last_error_line(const char **file, int *line) | 779 | unsigned long |
780 | ERR_peek_last_error_line(const char **file, int *line) | ||
774 | { | 781 | { |
775 | return (get_error_values(0, 1,file, line, NULL, NULL)); | 782 | return (get_error_values(0, 1, file, line, NULL, NULL)); |
776 | } | 783 | } |
777 | 784 | ||
778 | unsigned long ERR_peek_last_error_line_data(const char **file, int *line, | 785 | unsigned long |
786 | ERR_peek_last_error_line_data(const char **file, int *line, | ||
779 | const char **data, int *flags) | 787 | const char **data, int *flags) |
780 | { | 788 | { |
781 | return (get_error_values(0, 1,file, line, data, flags)); | 789 | return (get_error_values(0, 1, file, line, data, flags)); |
782 | } | 790 | } |
783 | 791 | ||
784 | static unsigned | 792 | static unsigned long |
785 | long get_error_values(int inc, int top, const char **file, int *line, | 793 | get_error_values(int inc, int top, const char **file, int *line, |
786 | const char **data, int *flags) | 794 | const char **data, int *flags) |
787 | { | 795 | { |
788 | int i = 0; | 796 | int i = 0; |