if (expected->iv != NULL) {
/* Some (e.g., GCM) tests use IVs longer than EVP_MAX_IV_LENGTH. */
unsigned char iv[128];
+
+ ERR_set_mark();
if (!TEST_true(EVP_CIPHER_CTX_get_updated_iv(ctx_base, iv, sizeof(iv)))
|| ((EVP_CIPHER_get_flags(expected->cipher) & EVP_CIPH_CUSTOM_IV) == 0
&& !TEST_mem_eq(expected->iv, expected->iv_len, iv,
expected->iv_len))) {
t->err = "INVALID_IV";
+ ERR_clear_last_mark();
goto err;
} else {
- if (fips_no_silent_error && !TEST_false(ERR_peek_error())) {
+ if (fips_no_silent_error && !TEST_int_eq(ERR_count_to_mark(), 0)) {
t->err = "GET_UPDATED_IV_SILENT_ERROR";
+ ERR_clear_last_mark();
goto err;
}
}
+ ERR_clear_last_mark();
}
/* Test that the cipher dup functions correctly if it is supported */
if (expected->next_iv != NULL) {
/* Some (e.g., GCM) tests use IVs longer than EVP_MAX_IV_LENGTH. */
unsigned char iv[128];
+ ERR_set_mark();
if (!TEST_true(EVP_CIPHER_CTX_get_updated_iv(ctx, iv, sizeof(iv)))
|| !TEST_mem_eq(expected->next_iv, expected->iv_len, iv,
expected->iv_len)) {
t->err = "INVALID_NEXT_IV";
+ ERR_clear_last_mark();
goto err;
} else {
- if (fips_no_silent_error && !TEST_false(ERR_peek_error())) {
+ if (fips_no_silent_error && !TEST_int_eq(ERR_count_to_mark(), 0)) {
t->err = "GET_UPDATED_IV_SILENT_ERROR";
+ ERR_clear_last_mark();
goto err;
}
}
+ ERR_clear_last_mark();
}
t->err = NULL;