From 6832800c04cefb40aa4773b082c99056247ff3a1 Mon Sep 17 00:00:00 2001 From: tb Date: Thu, 2 Mar 2023 20:18:40 +0000 Subject: [PATCH] evp_pkey_check: make this test silent on success --- regress/lib/libcrypto/evp/evp_pkey_check.c | 31 +++++++++------------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/regress/lib/libcrypto/evp/evp_pkey_check.c b/regress/lib/libcrypto/evp/evp_pkey_check.c index a1863477369..7b73316b9b1 100644 --- a/regress/lib/libcrypto/evp/evp_pkey_check.c +++ b/regress/lib/libcrypto/evp/evp_pkey_check.c @@ -1,4 +1,4 @@ -/* $OpenBSD: evp_pkey_check.c,v 1.3 2022/12/01 13:49:12 tb Exp $ */ +/* $OpenBSD: evp_pkey_check.c,v 1.4 2023/03/02 20:18:40 tb Exp $ */ /* * Copyright (c) 2021-2022 Theo Buehler * @@ -130,14 +130,11 @@ evp_pkey_check_rsa(void) fail_soft = 1; } - /* - * Spew some garbage to stderr. - */ - - fprintf(stderr, "We should see some errors about RSA d:\n"); - ERR_print_errors_fp(stderr); + if (ERR_peek_error() == 0) { + fprintf(stderr, "%s: expected some RSA errors\n", __func__); + fail_soft = 1; + } ERR_clear_error(); - fprintf(stderr, "EVP_PKEY_check test for RSA done.\n"); failed = 0; @@ -272,12 +269,10 @@ evp_pkey_check_ec(void) fail_soft = 1; } - /* - * Spew some garbage to stderr. - */ - - fprintf(stderr, "We should see an error about the EC private key:\n"); - ERR_print_errors_fp(stderr); + if (ERR_peek_error() == 0) { + fprintf(stderr, "%s: expected a private key error\n", __func__); + fail_soft = 1; + } ERR_clear_error(); /* EVP_PKEY_public_check checks the private key (sigh), so we fail. */ @@ -373,12 +368,12 @@ evp_pkey_check_ec(void) fail_soft = 1; } - fprintf(stderr, "We should see an error on invalid group order\n"); - ERR_print_errors_fp(stderr); + if (ERR_peek_error() == 0) { + fprintf(stderr, "%s: expected a group order error\n", __func__); + fail_soft = 1; + } ERR_clear_error(); - fprintf(stderr, "EVP_PKEY_check test for EC done.\n"); - failed = 0; err: -- 2.20.1