Simplify the logic in a test

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
Gilles Peskine 2023-07-20 22:18:23 +02:00
parent 9d5952dba8
commit 5fd88b7f75

View file

@ -1403,19 +1403,16 @@ void ssl_crypt_record_small(int cipher_type, int hash_id,
ret = mbedtls_ssl_encrypt_buf(&ssl, t_enc, &rec, ret = mbedtls_ssl_encrypt_buf(&ssl, t_enc, &rec,
mbedtls_test_rnd_std_rand, NULL); mbedtls_test_rnd_std_rand, NULL);
if ((mode == 1 || mode == 2) && seen_success) { if (ret == MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL) {
TEST_ASSERT(ret == 0); /* It's ok if the output buffer is too small. We do insist
} else { * on at least one mode succeeding; this is tracked by
TEST_ASSERT(ret == 0 || ret == MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL); * seen_success. */
if (ret == 0) {
seen_success = 1;
}
}
if (ret != 0) {
continue; continue;
} }
TEST_EQUAL(ret, 0);
seen_success = 1;
#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID) #if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
if (rec.cid_len != 0) { if (rec.cid_len != 0) {
/* DTLS 1.2 + CID hides the real content type and /* DTLS 1.2 + CID hides the real content type and