mirror of
https://github.com/QuasarApp/openssl.git
synced 2025-04-29 19:24:37 +00:00
Avoid using ERR_put_error() directly in OpenSSL code
If compiled with 'no-deprecated', ERR_put_error() is undefined. We had one spot where we were using it directly, because the file and line information was passed from elsewhere. Fortunately, it's possible to use ERR_raise() for that situation, and call ERR_set_debug() immediately after and thereby override the information that ERR_raise() stored in the error record. util/mkerr.pl needed a small adjustment to not generate code that won't compile in a 'no-deprecated' configuration. Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/9452)
This commit is contained in:
parent
036913b107
commit
c361297046
@ -66,5 +66,6 @@ static void ERR_AFALG_error(int function, int reason, char *file, int line)
|
|||||||
{
|
{
|
||||||
if (lib_code == 0)
|
if (lib_code == 0)
|
||||||
lib_code = ERR_get_next_error_library();
|
lib_code = ERR_get_next_error_library();
|
||||||
ERR_PUT_error(lib_code, function, reason, file, line);
|
ERR_raise(lib_code, reason);
|
||||||
|
ERR_set_debug(file, line, NULL);
|
||||||
}
|
}
|
||||||
|
@ -89,5 +89,6 @@ static void ERR_CAPI_error(int function, int reason, char *file, int line)
|
|||||||
{
|
{
|
||||||
if (lib_code == 0)
|
if (lib_code == 0)
|
||||||
lib_code = ERR_get_next_error_library();
|
lib_code = ERR_get_next_error_library();
|
||||||
ERR_PUT_error(lib_code, function, reason, file, line);
|
ERR_raise(lib_code, reason);
|
||||||
|
ERR_set_debug(file, line, NULL);
|
||||||
}
|
}
|
||||||
|
@ -51,5 +51,6 @@ static void ERR_DASYNC_error(int function, int reason, char *file, int line)
|
|||||||
{
|
{
|
||||||
if (lib_code == 0)
|
if (lib_code == 0)
|
||||||
lib_code = ERR_get_next_error_library();
|
lib_code = ERR_get_next_error_library();
|
||||||
ERR_PUT_error(lib_code, function, reason, file, line);
|
ERR_raise(lib_code, reason);
|
||||||
|
ERR_set_debug(file, line, NULL);
|
||||||
}
|
}
|
||||||
|
@ -51,5 +51,6 @@ static void ERR_OSSLTEST_error(int function, int reason, char *file, int line)
|
|||||||
{
|
{
|
||||||
if (lib_code == 0)
|
if (lib_code == 0)
|
||||||
lib_code = ERR_get_next_error_library();
|
lib_code = ERR_get_next_error_library();
|
||||||
ERR_PUT_error(lib_code, function, reason, file, line);
|
ERR_raise(lib_code, reason);
|
||||||
|
ERR_set_debug(file, line, NULL);
|
||||||
}
|
}
|
||||||
|
@ -118,7 +118,8 @@ void ossl_statem_set_renegotiate(SSL *s)
|
|||||||
void ossl_statem_fatal(SSL *s, int al, int func, int reason, const char *file,
|
void ossl_statem_fatal(SSL *s, int al, int func, int reason, const char *file,
|
||||||
int line)
|
int line)
|
||||||
{
|
{
|
||||||
ERR_put_error(ERR_LIB_SSL, func, reason, file, line);
|
ERR_raise(ERR_LIB_SSL, reason);
|
||||||
|
ERR_set_debug(file, line, NULL); /* Override what ERR_raise set */
|
||||||
/* We shouldn't call SSLfatal() twice. Once is enough */
|
/* We shouldn't call SSLfatal() twice. Once is enough */
|
||||||
if (s->statem.in_init && s->statem.state == MSG_FLOW_ERROR)
|
if (s->statem.in_init && s->statem.state == MSG_FLOW_ERROR)
|
||||||
return;
|
return;
|
||||||
|
@ -650,7 +650,8 @@ ${st}void ERR_${lib}_error(int function, int reason, char *file, int line)
|
|||||||
{
|
{
|
||||||
if (lib_code == 0)
|
if (lib_code == 0)
|
||||||
lib_code = ERR_get_next_error_library();
|
lib_code = ERR_get_next_error_library();
|
||||||
ERR_PUT_error(lib_code, function, reason, file, line);
|
ERR_raise(lib_code, reason);
|
||||||
|
ERR_set_debug(file, line, NULL);
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user