Simplify the logic in a test
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
9d5952dba8
commit
5fd88b7f75
1 changed files with 7 additions and 10 deletions
|
@ -1403,19 +1403,16 @@ void ssl_crypt_record_small(int cipher_type, int hash_id,
|
|||
ret = mbedtls_ssl_encrypt_buf(&ssl, t_enc, &rec,
|
||||
mbedtls_test_rnd_std_rand, NULL);
|
||||
|
||||
if ((mode == 1 || mode == 2) && seen_success) {
|
||||
TEST_ASSERT(ret == 0);
|
||||
} else {
|
||||
TEST_ASSERT(ret == 0 || ret == MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL);
|
||||
if (ret == 0) {
|
||||
seen_success = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (ret != 0) {
|
||||
if (ret == MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL) {
|
||||
/* It's ok if the output buffer is too small. We do insist
|
||||
* on at least one mode succeeding; this is tracked by
|
||||
* seen_success. */
|
||||
continue;
|
||||
}
|
||||
|
||||
TEST_EQUAL(ret, 0);
|
||||
seen_success = 1;
|
||||
|
||||
#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
|
||||
if (rec.cid_len != 0) {
|
||||
/* DTLS 1.2 + CID hides the real content type and
|
||||
|
|
Loading…
Reference in a new issue