Implement EVP_MAC_do_all_ex()
authorRichard Levitte <levitte@openssl.org>
Tue, 4 Jun 2019 16:17:49 +0000 (18:17 +0200)
committerRichard Levitte <levitte@openssl.org>
Thu, 15 Aug 2019 20:12:25 +0000 (22:12 +0200)
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/8877)

crypto/evp/mac_meth.c
doc/man3/EVP_MAC.pod
include/openssl/evp.h
util/libcrypto.num

index e2bb016c0f63dd846802a91464c00be15c2667ad..e5eed33774ec480b4d4fdb2188f67d3c70c5706a 100644 (file)
@@ -198,3 +198,12 @@ const OSSL_PARAM *EVP_MAC_CTX_settable_params(const EVP_MAC *mac)
         return NULL;
     return mac->settable_ctx_params();
 }
+
+void EVP_MAC_do_all_ex(OPENSSL_CTX *libctx,
+                       void (*fn)(EVP_MAC *mac, void *arg),
+                       void *arg)
+{
+    evp_generic_do_all(libctx, OSSL_OP_MAC,
+                       (void (*)(void *, void *))fn, arg,
+                       evp_mac_from_dispatch, evp_mac_free);
+}
index ed38f912df447383edf7cfc8fb9a64745e54eb78..6cc28a73558c5aa2e7476925a8baf30a3f931a94 100644 (file)
@@ -7,8 +7,8 @@ EVP_MAC_provider, EVP_MAC_get_params, EVP_MAC_gettable_params,
 EVP_MAC_CTX, EVP_MAC_CTX_new, EVP_MAC_CTX_free, EVP_MAC_CTX_dup,
 EVP_MAC_CTX_mac, EVP_MAC_CTX_get_params, EVP_MAC_CTX_set_params,
 EVP_MAC_size, EVP_MAC_init, EVP_MAC_update, EVP_MAC_final,
-EVP_MAC_CTX_gettable_params, EVP_MAC_CTX_settable_params
-- EVP MAC routines
+EVP_MAC_CTX_gettable_params, EVP_MAC_CTX_settable_params,
+EVP_MAC_do_all_ex - EVP MAC routines
 
 =head1 SYNOPSIS
 
@@ -42,6 +42,10 @@ EVP_MAC_CTX_gettable_params, EVP_MAC_CTX_settable_params
  const OSSL_PARAM *EVP_MAC_CTX_gettable_params(const EVP_MAC *mac);
  const OSSL_PARAM *EVP_MAC_CTX_settable_params(const EVP_MAC *mac);
 
+ void EVP_MAC_do_all_ex(OPENSSL_CTX *libctx,
+                        void (*fn)(EVP_MAC *mac, void *arg),
+                        void *arg);
+
 =head1 DESCRIPTION
 
 These types and functions help the application to calculate MACs of
@@ -156,6 +160,11 @@ EVP_MAC_name() returns the name of the given MAC implementation.
 EVP_MAC_provider() returns the provider that holds the implementation
 of the given I<mac>.
 
+EVP_MAC_do_all_ex() traverses all MAC implemented by all activated
+providers in the given library context I<libctx>, and for each of the
+implementations, calls the given function I<fn> with the implementation method
+and the given I<arg> as argument.
+
 =head1 PARAMETER NAMES
 
 The standard parameter names are:
@@ -261,6 +270,7 @@ EVP_MAC_size() returns the expected output size, or 0 if it isn't
 set.
 If it isn't set, a call to EVP_MAC_init() should get it set.
 
+EVP_MAC_do_all_ex() returns nothing at all.
 
 =head1 EXAMPLE
 
index 2956b0408cb87bb9b55640565e59d8d272b10b86..c778ef43dad8e92a167ff9c8f6d1ded565aea254 100644 (file)
@@ -1050,6 +1050,10 @@ const OSSL_PARAM *EVP_MAC_gettable_params(const EVP_MAC *mac);
 const OSSL_PARAM *EVP_MAC_CTX_gettable_params(const EVP_MAC *mac);
 const OSSL_PARAM *EVP_MAC_CTX_settable_params(const EVP_MAC *mac);
 
+void EVP_MAC_do_all_ex(OPENSSL_CTX *libctx,
+                       void (*fn)(EVP_MAC *mac, void *arg),
+                       void *arg);
+
 /* PKEY stuff */
 int EVP_PKEY_decrypt_old(unsigned char *dec_key,
                          const unsigned char *enc_key, int enc_key_len,
index 58ac4fd55f99307d7d9fde6a3c82f63a745faa37..ac1c1101333890b7d1091b61e16bba3c31d8d0c5 100644 (file)
@@ -4730,3 +4730,5 @@ EVP_MAC_up_ref                          4839      3_0_0   EXIST::FUNCTION:
 EVP_MAC_name                            4840   3_0_0   EXIST::FUNCTION:
 EVP_MAC_get_params                      4841   3_0_0   EXIST::FUNCTION:
 EVP_MAC_gettable_params                 4842   3_0_0   EXIST::FUNCTION:
+EVP_MAC_provider                        4843   3_0_0   EXIST::FUNCTION:
+EVP_MAC_do_all_ex                       4844   3_0_0   EXIST::FUNCTION: