Ensure the sslcorrupttest checks all errors on the queue

sslcorrupttest was looking for a "decryption failed or bad record mac"
error in the queue. However if there were multiple errors on the queue
then it would fail to find it. We modify the test to check all errors.

Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12288)
This commit is contained in:
Matt Caswell 2020-06-22 16:02:12 +01:00
parent ee0c849e5a
commit 09ce6e0854

View File

@ -190,9 +190,12 @@ static int test_ssl_corrupt(int testidx)
int testresult = 0;
STACK_OF(SSL_CIPHER) *ciphers;
const SSL_CIPHER *currcipher;
int err;
docorrupt = 0;
ERR_clear_error();
TEST_info("Starting #%d, %s", testidx, cipher_list[testidx]);
if (!TEST_true(create_ssl_ctx_pair(NULL, TLS_server_method(),
@ -234,9 +237,14 @@ static int test_ssl_corrupt(int testidx)
if (!TEST_int_lt(SSL_read(server, junk, sizeof(junk)), 0))
goto end;
if (!TEST_int_eq(ERR_GET_REASON(ERR_peek_error()),
SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC))
goto end;
do {
err = ERR_get_error();
if (err == 0) {
TEST_error("Decryption failed or bad record MAC not seen");
goto end;
}
} while (ERR_GET_REASON(err) != SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC);
testresult = 1;
end: