-/* $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 <tb@openbsd.org>
*
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;
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. */
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: