diff options
author | David Benjamin <davidben@google.com> | 2019-04-15 22:36:40 -0500 |
---|---|---|
committer | David Benjamin <davidben@google.com> | 2019-04-26 09:57:07 -0500 |
commit | d7fcf1feac3b3b1bf1a162f632b1e7db4f075aed (patch) | |
tree | 154e82900bea6b599103987eb1524373e5987613 /test | |
parent | 5ee08f45bcabc3cef0d7d7b2aa6ecad12ca4197b (diff) | |
download | openssl-new-d7fcf1feac3b3b1bf1a162f632b1e7db4f075aed.tar.gz |
Copy RSA-PSS saltlen in EVP_PKEY_CTX_dup.
pkey_rsa_copy was missing a field. Test this by repeating the operation
through an EVP_PKEY_CTX_dup copy in evp_test.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8759)
Diffstat (limited to 'test')
-rw-r--r-- | test/evp_test.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/evp_test.c b/test/evp_test.c index cad580e10c..0563986a82 100644 --- a/test/evp_test.c +++ b/test/evp_test.c @@ -1378,6 +1378,7 @@ static int pkey_test_run(EVP_TEST *t) PKEY_DATA *expected = t->data; unsigned char *got = NULL; size_t got_len; + EVP_PKEY_CTX *copy = NULL; if (expected->keyop(expected->ctx, NULL, &got_len, expected->input, expected->input_len) <= 0 @@ -1396,8 +1397,33 @@ static int pkey_test_run(EVP_TEST *t) goto err; t->err = NULL; + OPENSSL_free(got); + got = NULL; + + /* Repeat the test on a copy. */ + if (!TEST_ptr(copy = EVP_PKEY_CTX_dup(expected->ctx))) { + t->err = "INTERNAL_ERROR"; + goto err; + } + if (expected->keyop(copy, NULL, &got_len, expected->input, + expected->input_len) <= 0 + || !TEST_ptr(got = OPENSSL_malloc(got_len))) { + t->err = "KEYOP_LENGTH_ERROR"; + goto err; + } + if (expected->keyop(copy, got, &got_len, expected->input, + expected->input_len) <= 0) { + t->err = "KEYOP_ERROR"; + goto err; + } + if (!memory_err_compare(t, "KEYOP_MISMATCH", + expected->output, expected->output_len, + got, got_len)) + goto err; + err: OPENSSL_free(got); + EVP_PKEY_CTX_free(copy); return 1; } |