diff options
author | Matt Caswell <matt@openssl.org> | 2020-06-22 16:02:12 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2020-07-06 09:26:09 +0100 |
commit | 09ce6e0854b9dee49a25662e1aaaa869b2afc2a1 (patch) | |
tree | 5e357c93be9bf23c87be5b6f2f524db16a3df3d3 /test | |
parent | ee0c849e5a1c26ed16c08311efdfd78c8e4c8221 (diff) |
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)
Diffstat (limited to 'test')
-rw-r--r-- | test/sslcorrupttest.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/test/sslcorrupttest.c b/test/sslcorrupttest.c index 476a1758ad..641ecf331d 100644 --- a/test/sslcorrupttest.c +++ b/test/sslcorrupttest.c @@ -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: |