提交 711ae5d3 编写于 作者: M Matt Caswell

Remove a TODO from evp_test

Now that the EVP_PKEY KDF bridge is based on provider code a TODO item
can be removed from evp_test.
Reviewed-by: NPaul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12573)
上级 cd0a4998
...@@ -2494,9 +2494,7 @@ typedef struct pkey_kdf_data_st { ...@@ -2494,9 +2494,7 @@ typedef struct pkey_kdf_data_st {
*/ */
static int pkey_kdf_test_init(EVP_TEST *t, const char *name) static int pkey_kdf_test_init(EVP_TEST *t, const char *name)
{ {
OPENSSL_CTX *save_libctx = NULL;
PKEY_KDF_DATA *kdata = NULL; PKEY_KDF_DATA *kdata = NULL;
int kdf_nid = OBJ_sn2nid(name);
if (is_kdf_disabled(name)) { if (is_kdf_disabled(name)) {
TEST_info("skipping, '%s' is disabled", name); TEST_info("skipping, '%s' is disabled", name);
...@@ -2504,28 +2502,17 @@ static int pkey_kdf_test_init(EVP_TEST *t, const char *name) ...@@ -2504,28 +2502,17 @@ static int pkey_kdf_test_init(EVP_TEST *t, const char *name)
return 1; return 1;
} }
if (kdf_nid == NID_undef)
kdf_nid = OBJ_ln2nid(name);
if (!TEST_ptr(kdata = OPENSSL_zalloc(sizeof(*kdata)))) if (!TEST_ptr(kdata = OPENSSL_zalloc(sizeof(*kdata))))
return 0; return 0;
/*
* TODO(3.0): This should be using EVP_PKEY_CTX_new_from_name(), kdata->ctx = EVP_PKEY_CTX_new_from_name(libctx, name, NULL);
* but it does not currently since the PKEY_KDF is using legacy paths.
* Internally it still uses fetches with the legacy path,
* So for now we hack in the library context.
*/
save_libctx = OPENSSL_CTX_set0_default(libctx);
kdata->ctx = EVP_PKEY_CTX_new_id(kdf_nid, NULL);
if (kdata->ctx == NULL if (kdata->ctx == NULL
|| EVP_PKEY_derive_init(kdata->ctx) <= 0) || EVP_PKEY_derive_init(kdata->ctx) <= 0)
goto err; goto err;
OPENSSL_CTX_set0_default(save_libctx);
t->data = kdata; t->data = kdata;
return 1; return 1;
err: err:
OPENSSL_CTX_set0_default(save_libctx);
EVP_PKEY_CTX_free(kdata->ctx); EVP_PKEY_CTX_free(kdata->ctx);
OPENSSL_free(kdata); OPENSSL_free(kdata);
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册