From fb228d6d02acb400fdea33253bd2409613be55e8 Mon Sep 17 00:00:00 2001 From: jsing Date: Wed, 27 Apr 2022 17:43:41 +0000 Subject: [PATCH] Ensure we clear the error stack before running tests that print errors. --- regress/lib/libcrypto/asn1/asn1complex.c | 4 +++- regress/lib/libcrypto/asn1/asn1x509.c | 8 +++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/regress/lib/libcrypto/asn1/asn1complex.c b/regress/lib/libcrypto/asn1/asn1complex.c index eaabd9e8c34..dfad345c6d2 100644 --- a/regress/lib/libcrypto/asn1/asn1complex.c +++ b/regress/lib/libcrypto/asn1/asn1complex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asn1complex.c,v 1.1 2021/12/09 16:30:57 jsing Exp $ */ +/* $OpenBSD: asn1complex.c,v 1.2 2022/04/27 17:43:41 jsing Exp $ */ /* * Copyright (c) 2017, 2021 Joel Sing * @@ -163,6 +163,8 @@ do_asn1_constructed_test(const struct asn1_constructed_test *act) long err; int failed = 1; + ERR_clear_error(); + p = act->asn1; aos = d2i_ASN1_OCTET_STRING(NULL, &p, act->asn1_len); if (!act->valid) { diff --git a/regress/lib/libcrypto/asn1/asn1x509.c b/regress/lib/libcrypto/asn1/asn1x509.c index fb0ae011f23..bb9e2ecdff3 100644 --- a/regress/lib/libcrypto/asn1/asn1x509.c +++ b/regress/lib/libcrypto/asn1/asn1x509.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asn1x509.c,v 1.2 2022/01/12 08:45:09 tb Exp $ */ +/* $OpenBSD: asn1x509.c,v 1.3 2022/04/27 17:43:41 jsing Exp $ */ /* * Copyright (c) 2017 Joel Sing * @@ -163,6 +163,8 @@ dsa_pubkey_test(void) int failure = 1; int len; + ERR_clear_error(); + if ((bio_mem = BIO_new_mem_buf((void *)dsa_test_key, -1)) == NULL) errx(1, "failed to create BIO"); @@ -288,6 +290,8 @@ ec_pubkey_test(void) int failure = 1; int len; + ERR_clear_error(); + if ((bio_mem = BIO_new_mem_buf((void *)ec_test_key, -1)) == NULL) errx(1, "failed to create BIO"); @@ -437,6 +441,8 @@ rsa_pubkey_test(void) int failure = 1; int len; + ERR_clear_error(); + if ((bio_mem = BIO_new_mem_buf((void *)rsa_test_key, -1)) == NULL) errx(1, "failed to create BIO"); -- 2.20.1