TEST: Adapt the EVP test

The EVP test didn't recognise ERR_R_UNSUPPORTED, now does

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14834)
This commit is contained in:
Richard Levitte 2021-04-16 10:08:38 +02:00
parent 9cc97ddf3c
commit 7aef200089
2 changed files with 8 additions and 6 deletions

View File

@ -3264,9 +3264,11 @@ static void free_key_list(KEY_LIST *lst)
static int key_unsupported(void)
{
long err = ERR_peek_last_error();
int lib = ERR_GET_LIB(err);
long reason = ERR_GET_REASON(err);
if (ERR_GET_LIB(err) == ERR_LIB_EVP
&& (ERR_GET_REASON(err) == EVP_R_UNSUPPORTED_ALGORITHM)) {
if ((lib == ERR_LIB_EVP && reason == EVP_R_UNSUPPORTED_ALGORITHM)
|| reason == ERR_R_UNSUPPORTED) {
ERR_clear_error();
return 1;
}
@ -3276,9 +3278,9 @@ static int key_unsupported(void)
* hint to an unsupported algorithm/curve (e.g. if binary EC support is
* disabled).
*/
if (ERR_GET_LIB(err) == ERR_LIB_EC
&& (ERR_GET_REASON(err) == EC_R_UNKNOWN_GROUP
|| ERR_GET_REASON(err) == EC_R_INVALID_CURVE)) {
if (lib == ERR_LIB_EC
&& (reason == EC_R_UNKNOWN_GROUP
|| reason == EC_R_INVALID_CURVE)) {
ERR_clear_error();
return 1;
}

View File

@ -171,7 +171,7 @@ SKIP: {
ok(test_errors(key => 'server-dsa-pubkey.pem',
out => 'server-dsa-pubkey.err',
args => [ '-pubin' ],
expected => 'unsupported algorithm'),
expected => 'unsupported'),
"expected error loading unsupported dsa public key");
}