mirror of
https://github.com/openssl/openssl.git
synced 2024-11-23 18:13:39 +08:00
Don't clear the whole error stack when loading engines
Loading the various built-in engines was unconditionally clearing the whole error stack. During config file processing processing a .include directive which fails results in errors being added to the stack - but we carry on anyway. These errors were then later being removed by the engine loading code, meaning that problems with the .include directive never get shown. Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/13311)
This commit is contained in:
parent
b8ae4a83de
commit
b9b2135d22
@ -208,7 +208,6 @@ DEFINE_RUN_ONCE_STATIC(do_load_builtin_modules)
|
||||
/* Need to load ENGINEs */
|
||||
ENGINE_load_builtin_engines();
|
||||
#endif
|
||||
ERR_clear_error();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -257,6 +257,8 @@ void engine_load_dynamic_int(void)
|
||||
ENGINE *toadd = engine_dynamic();
|
||||
if (!toadd)
|
||||
return;
|
||||
|
||||
ERR_set_mark();
|
||||
ENGINE_add(toadd);
|
||||
/*
|
||||
* If the "add" worked, it gets a structural reference. So either way, we
|
||||
@ -268,7 +270,7 @@ void engine_load_dynamic_int(void)
|
||||
* already added (eg. someone calling ENGINE_load_blah then calling
|
||||
* ENGINE_load_builtin_engines() perhaps).
|
||||
*/
|
||||
ERR_clear_error();
|
||||
ERR_pop_to_mark();
|
||||
}
|
||||
|
||||
static int dynamic_init(ENGINE *e)
|
||||
|
@ -152,13 +152,20 @@ void engine_load_openssl_int(void)
|
||||
ENGINE *toadd = engine_openssl();
|
||||
if (!toadd)
|
||||
return;
|
||||
|
||||
ERR_set_mark();
|
||||
ENGINE_add(toadd);
|
||||
/*
|
||||
* If the "add" worked, it gets a structural reference. So either way, we
|
||||
* release our just-created reference.
|
||||
*/
|
||||
ENGINE_free(toadd);
|
||||
ERR_clear_error();
|
||||
/*
|
||||
* If the "add" didn't work, it was probably a conflict because it was
|
||||
* already added (eg. someone calling ENGINE_load_blah then calling
|
||||
* ENGINE_load_builtin_engines() perhaps).
|
||||
*/
|
||||
ERR_pop_to_mark();
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -87,9 +87,19 @@ void engine_load_rdrand_int(void)
|
||||
ENGINE *toadd = ENGINE_rdrand();
|
||||
if (!toadd)
|
||||
return;
|
||||
ERR_set_mark();
|
||||
ENGINE_add(toadd);
|
||||
/*
|
||||
* If the "add" worked, it gets a structural reference. So either way, we
|
||||
* release our just-created reference.
|
||||
*/
|
||||
ENGINE_free(toadd);
|
||||
ERR_clear_error();
|
||||
/*
|
||||
* If the "add" didn't work, it was probably a conflict because it was
|
||||
* already added (eg. someone calling ENGINE_load_blah then calling
|
||||
* ENGINE_load_builtin_engines() perhaps).
|
||||
*/
|
||||
ERR_pop_to_mark();
|
||||
}
|
||||
}
|
||||
#else
|
||||
|
@ -851,9 +851,19 @@ void engine_load_afalg_int(void)
|
||||
toadd = engine_afalg();
|
||||
if (toadd == NULL)
|
||||
return;
|
||||
ERR_set_mark();
|
||||
ENGINE_add(toadd);
|
||||
/*
|
||||
* If the "add" worked, it gets a structural reference. So either way, we
|
||||
* release our just-created reference.
|
||||
*/
|
||||
ENGINE_free(toadd);
|
||||
ERR_clear_error();
|
||||
/*
|
||||
* If the "add" didn't work, it was probably a conflict because it was
|
||||
* already added (eg. someone calling ENGINE_load_blah then calling
|
||||
* ENGINE_load_builtin_engines() perhaps).
|
||||
*/
|
||||
ERR_pop_to_mark();
|
||||
}
|
||||
# endif
|
||||
|
||||
|
@ -600,9 +600,19 @@ void engine_load_capi_int(void)
|
||||
ENGINE *toadd = engine_capi();
|
||||
if (!toadd)
|
||||
return;
|
||||
ERR_set_mark();
|
||||
ENGINE_add(toadd);
|
||||
/*
|
||||
* If the "add" worked, it gets a structural reference. So either way, we
|
||||
* release our just-created reference.
|
||||
*/
|
||||
ENGINE_free(toadd);
|
||||
ERR_clear_error();
|
||||
/*
|
||||
* If the "add" didn't work, it was probably a conflict because it was
|
||||
* already added (eg. someone calling ENGINE_load_blah then calling
|
||||
* ENGINE_load_builtin_engines() perhaps).
|
||||
*/
|
||||
ERR_pop_to_mark();
|
||||
}
|
||||
# endif
|
||||
|
||||
|
@ -348,9 +348,19 @@ void engine_load_dasync_int(void)
|
||||
ENGINE *toadd = engine_dasync();
|
||||
if (!toadd)
|
||||
return;
|
||||
ERR_set_mark();
|
||||
ENGINE_add(toadd);
|
||||
/*
|
||||
* If the "add" worked, it gets a structural reference. So either way, we
|
||||
* release our just-created reference.
|
||||
*/
|
||||
ENGINE_free(toadd);
|
||||
ERR_clear_error();
|
||||
/*
|
||||
* If the "add" didn't work, it was probably a conflict because it was
|
||||
* already added (eg. someone calling ENGINE_load_blah then calling
|
||||
* ENGINE_load_builtin_engines() perhaps).
|
||||
*/
|
||||
ERR_pop_to_mark();
|
||||
}
|
||||
|
||||
static int dasync_init(ENGINE *e)
|
||||
|
@ -1287,9 +1287,20 @@ void engine_load_devcrypto_int(void)
|
||||
return;
|
||||
}
|
||||
|
||||
ERR_set_mark();
|
||||
ENGINE_add(e);
|
||||
/*
|
||||
* If the "add" worked, it gets a structural reference. So either way, we
|
||||
* release our just-created reference.
|
||||
*/
|
||||
ENGINE_free(e); /* Loose our local reference */
|
||||
ERR_clear_error();
|
||||
/*
|
||||
* If the "add" didn't work, it was probably a conflict because it was
|
||||
* already added (eg. someone calling ENGINE_load_blah then calling
|
||||
* ENGINE_load_builtin_engines() perhaps).
|
||||
*/
|
||||
ERR_pop_to_mark();
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
@ -49,9 +49,19 @@ void engine_load_padlock_int(void)
|
||||
ENGINE *toadd = ENGINE_padlock();
|
||||
if (!toadd)
|
||||
return;
|
||||
ERR_set_mark();
|
||||
ENGINE_add(toadd);
|
||||
/*
|
||||
* If the "add" worked, it gets a structural reference. So either way, we
|
||||
* release our just-created reference.
|
||||
*/
|
||||
ENGINE_free(toadd);
|
||||
ERR_clear_error();
|
||||
/*
|
||||
* If the "add" didn't work, it was probably a conflict because it was
|
||||
* already added (eg. someone calling ENGINE_load_blah then calling
|
||||
* ENGINE_load_builtin_engines() perhaps).
|
||||
*/
|
||||
ERR_pop_to_mark();
|
||||
# endif
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user