From: Richard Levitte Date: Thu, 7 May 2020 07:56:52 +0000 (+0200) Subject: test/evp_pkey_provided_test.c: Display first, compare after X-Git-Tag: openssl-3.0.0-alpha2~12 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d59b7a54a5332303c42c3d097db5764dc809ecc9;p=oweals%2Fopenssl.git test/evp_pkey_provided_test.c: Display first, compare after To make it easier to check the generated key manually, display it before comparing diverse other serializations. Reviewed-by: Shane Lontis (Merged from https://github.com/openssl/openssl/pull/11710) --- diff --git a/test/evp_pkey_provided_test.c b/test/evp_pkey_provided_test.c index 2c07ed0282..c5ef7241db 100644 --- a/test/evp_pkey_provided_test.c +++ b/test/evp_pkey_provided_test.c @@ -130,7 +130,12 @@ static int test_print_key_using_pem(const char *alg, const EVP_PKEY *pk) if (!TEST_ptr(membio)) goto err; - if (!TEST_true(EVP_PKEY_print_private(membio, pk, 0, NULL)) + if (/* Output Encrypted private key in PEM form */ + !TEST_true(PEM_write_bio_PrivateKey(bio_out, pk, EVP_aes_256_cbc(), + (unsigned char *)"pass", 4, + NULL, NULL)) + /* Private key in text form */ + || !TEST_true(EVP_PKEY_print_private(membio, pk, 0, NULL)) || !TEST_true(compare_with_file(alg, PRIV_TEXT, membio)) /* Public key in PEM form */ || !TEST_true(PEM_write_bio_PUBKEY(membio, pk)) @@ -138,11 +143,7 @@ static int test_print_key_using_pem(const char *alg, const EVP_PKEY *pk) /* Unencrypted private key in PEM form */ || !TEST_true(PEM_write_bio_PrivateKey(membio, pk, NULL, NULL, 0, NULL, NULL)) - || !TEST_true(compare_with_file(alg, PRIV_PEM, membio)) - /* Encrypted private key in PEM form */ - || !TEST_true(PEM_write_bio_PrivateKey(bio_out, pk, EVP_aes_256_cbc(), - (unsigned char *)"pass", 4, - NULL, NULL))) + || !TEST_true(compare_with_file(alg, PRIV_PEM, membio))) goto err; ret = 1;