From f651c727f85813085355bb207cf913288108ed79 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Mon, 23 Sep 2019 10:56:13 +0200 Subject: EVP: add name traversal functions to all fetchable types The following new functions all do the same thing; they traverse the set of names assigned to implementations of each algorithm type: EVP_MD_names_do_all(), EVP_CIPHER_names_do_all(), EVP_MAC_names_do_all(), EVP_KEYMGMT_names_do_all(), EVP_KEYEXCH_names_do_all(), EVP_KDF_names_do_all(), EVP_SIGNATURE_names_do_all() We add a warning to the documentation of EVP_CIPHER_name() and EVP_MD_name(), as they aren't suitable to use with multiple-name implementation. We also remove EVP_MAC_name() and evp_KDF_name(), as they serve no useful purpose. Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/9979) --- test/evp_test.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/evp_test.c b/test/evp_test.c index d6f852913c..b68ad3b9c4 100644 --- a/test/evp_test.c +++ b/test/evp_test.c @@ -938,6 +938,7 @@ static const EVP_TEST_METHOD cipher_test_method = { typedef struct mac_data_st { /* MAC type in one form or another */ + char *mac_name; EVP_MAC *mac; /* for mac_test_run_mac */ int type; /* for mac_test_run_pkey */ /* Algorithm string for this MAC */ @@ -1021,6 +1022,7 @@ static int mac_test_init(EVP_TEST *t, const char *alg) mdat = OPENSSL_zalloc(sizeof(*mdat)); mdat->type = type; + mdat->mac_name = OPENSSL_strdup(alg); mdat->mac = mac; mdat->controls = sk_OPENSSL_STRING_new_null(); t->data = mdat; @@ -1038,6 +1040,7 @@ static void mac_test_cleanup(EVP_TEST *t) MAC_DATA *mdat = t->data; EVP_MAC_free(mdat->mac); + OPENSSL_free(mdat->mac_name); sk_OPENSSL_STRING_pop_free(mdat->controls, openssl_free); OPENSSL_free(mdat->alg); OPENSSL_free(mdat->key); @@ -1198,10 +1201,10 @@ static int mac_test_run_mac(EVP_TEST *t) EVP_MAC_settable_ctx_params(expected->mac); if (expected->alg == NULL) - TEST_info("Trying the EVP_MAC %s test", EVP_MAC_name(expected->mac)); + TEST_info("Trying the EVP_MAC %s test", expected->mac_name); else TEST_info("Trying the EVP_MAC %s test with %s", - EVP_MAC_name(expected->mac), expected->alg); + expected->mac_name, expected->alg); #ifdef OPENSSL_NO_DES if (expected->alg != NULL && strstr(expected->alg, "DES") != NULL) { -- cgit v1.2.3