[openssl] master update

Matt Caswell matt at openssl.org
Wed Sep 25 11:14:11 UTC 2019


The branch master has been updated
       via  e6879a31ef597f1b9608c7897087203d829d47c2 (commit)
      from  5a2a2f66c5e79895400c6e895ce7f8d48db96bb8 (commit)


- Log -----------------------------------------------------------------
commit e6879a31ef597f1b9608c7897087203d829d47c2
Author: Matt Caswell <matt at openssl.org>
Date:   Tue Sep 24 15:17:15 2019 +0100

    Make EVP_MD_CTX_[gettable|settable]_params() take an EVP_MD_CTX
    
    EVP_MD_CTX_gettable_params() and EVP_MD_CTX_settable_params() were
    confusingly named because they did not take an EVP_MD_CTX parameter.
    
    In addition we add the functions EVP_MD_gettable_ctx_params() and
    EVP_MD_settable_ctx_params() which do the same thing but are passed
    an EVP_MD object instead.
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/9998)

-----------------------------------------------------------------------

Summary of changes:
 apps/list.c                 |  4 ++--
 apps/provider.c             |  4 ++--
 crypto/evp/digest.c         | 32 ++++++++++++++++++++++++++------
 doc/man3/EVP_DigestInit.pod | 18 +++++++++++++-----
 include/openssl/evp.h       |  6 ++++--
 util/libcrypto.num          |  2 ++
 6 files changed, 49 insertions(+), 17 deletions(-)

diff --git a/apps/list.c b/apps/list.c
index 2b44cac71b..5348cc68dd 100644
--- a/apps/list.c
+++ b/apps/list.c
@@ -139,9 +139,9 @@ static void list_digests(void)
             print_param_types("retrievable algorithm parameters",
                               EVP_MD_gettable_params(m), 4);
             print_param_types("retrievable operation parameters",
-                              EVP_MD_CTX_gettable_params(m), 4);
+                              EVP_MD_gettable_ctx_params(m), 4);
             print_param_types("settable operation parameters",
-                              EVP_MD_CTX_settable_params(m), 4);
+                              EVP_MD_settable_ctx_params(m), 4);
         }
     }
     sk_EVP_MD_pop_free(digests, EVP_MD_free);
diff --git a/apps/provider.c b/apps/provider.c
index fe5ca1d1f7..29afdcef48 100644
--- a/apps/provider.c
+++ b/apps/provider.c
@@ -117,8 +117,8 @@ static void do_digest(EVP_MD *digest, void *meta)
 {
     do_method(digest, EVP_MD_name(digest),
               EVP_MD_gettable_params(digest),
-              EVP_MD_CTX_gettable_params(digest),
-              EVP_MD_CTX_settable_params(digest),
+              EVP_MD_gettable_ctx_params(digest),
+              EVP_MD_settable_ctx_params(digest),
               meta);
 }
 
diff --git a/crypto/evp/digest.c b/crypto/evp/digest.c
index 92012f917e..9c6aa42887 100644
--- a/crypto/evp/digest.c
+++ b/crypto/evp/digest.c
@@ -550,10 +550,20 @@ int EVP_MD_CTX_set_params(EVP_MD_CTX *ctx, const OSSL_PARAM params[])
     return 0;
 }
 
-const OSSL_PARAM *EVP_MD_CTX_settable_params(const EVP_MD *digest)
+const OSSL_PARAM *EVP_MD_settable_ctx_params(const EVP_MD *md)
 {
-    if (digest != NULL && digest->settable_ctx_params != NULL)
-        return digest->settable_ctx_params();
+    if (md != NULL && md->settable_ctx_params != NULL)
+        return md->settable_ctx_params();
+    return NULL;
+}
+
+const OSSL_PARAM *EVP_MD_CTX_settable_params(EVP_MD_CTX *ctx)
+{
+    if (ctx != NULL
+            && ctx->digest != NULL
+            && ctx->digest->settable_ctx_params != NULL)
+        return ctx->digest->settable_ctx_params();
+
     return NULL;
 }
 
@@ -564,10 +574,20 @@ int EVP_MD_CTX_get_params(EVP_MD_CTX *ctx, OSSL_PARAM params[])
     return 0;
 }
 
-const OSSL_PARAM *EVP_MD_CTX_gettable_params(const EVP_MD *digest)
+const OSSL_PARAM *EVP_MD_gettable_ctx_params(const EVP_MD *md)
 {
-    if (digest != NULL && digest->gettable_ctx_params != NULL)
-        return digest->gettable_ctx_params();
+    if (md != NULL && md->gettable_ctx_params != NULL)
+        return md->gettable_ctx_params();
+    return NULL;
+}
+
+const OSSL_PARAM *EVP_MD_CTX_gettable_params(EVP_MD_CTX *ctx)
+{
+    if (ctx != NULL
+            && ctx->digest != NULL
+            && ctx->digest->gettable_ctx_params != NULL)
+        return ctx->digest->gettable_ctx_params();
+
     return NULL;
 }
 
diff --git a/doc/man3/EVP_DigestInit.pod b/doc/man3/EVP_DigestInit.pod
index 8270d7040b..f4d3e58268 100644
--- a/doc/man3/EVP_DigestInit.pod
+++ b/doc/man3/EVP_DigestInit.pod
@@ -7,6 +7,7 @@ EVP_MD_get_params, EVP_MD_gettable_params,
 EVP_MD_CTX_new, EVP_MD_CTX_reset, EVP_MD_CTX_free, EVP_MD_CTX_copy,
 EVP_MD_CTX_copy_ex, EVP_MD_CTX_ctrl,
 EVP_MD_CTX_set_params, EVP_MD_CTX_get_params,
+EVP_MD_settable_ctx_params, EVP_MD_gettable_ctx_params,
 EVP_MD_CTX_settable_params, EVP_MD_CTX_gettable_params,
 EVP_MD_CTX_set_flags, EVP_MD_CTX_clear_flags, EVP_MD_CTX_test_flags,
 EVP_Digest, EVP_DigestInit_ex, EVP_DigestInit, EVP_DigestUpdate,
@@ -38,8 +39,10 @@ EVP_MD_do_all_ex
  void EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void* p2);
  int EVP_MD_CTX_get_params(EVP_MD_CTX *ctx, OSSL_PARAM params[]);
  int EVP_MD_CTX_set_params(EVP_MD_CTX *ctx, const OSSL_PARAM params[]);
- const OSSL_PARAM *EVP_MD_CTX_settable_params(const EVP_MD *digest);
- const OSSL_PARAM *EVP_MD_CTX_gettable_params(const EVP_MD *digest);
+ const OSSL_PARAM *EVP_MD_settable_ctx_params(const EVP_MD *md);
+ const OSSL_PARAM *EVP_MD_gettable_ctx_params(const EVP_MD *md);
+ const OSSL_PARAM *EVP_MD_CTX_settable_params(EVP_MD_CTX *ctx);
+ const OSSL_PARAM *EVP_MD_CTX_gettable_params(EVP_MD_CTX *ctx);
  void EVP_MD_CTX_set_flags(EVP_MD_CTX *ctx, int flags);
  void EVP_MD_CTX_clear_flags(EVP_MD_CTX *ctx, int flags);
  int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags);
@@ -158,12 +161,17 @@ See L</PARAMETERS> below for more information.
 Sets the list of B<params> into a MD context B<ctx>.
 See L</PARAMETERS> below for more information.
 
-=item EVP_MD_gettable_params(), EVP_MD_CTX_gettable_params(),
+=item EVP_MD_gettable_params(), EVP_MD_gettable_ctx_params(),
+EVP_MD_settable_ctx_params(), EVP_MD_CTX_gettable_params(),
 EVP_MD_CTX_settable_params()
 
 Get a B<OSSL_PARAM> array that describes the retrievable and settable
-parameters, i.e. parameters that can be used with EVP_MD_get_params(),
-EVP_MD_CTX_get_params() and EVP_MD_CTX_set_params(), respectively.
+parameters. EVP_MD_gettable_params() returns parameters that can be used with
+EVP_MD_get_params(). EVP_MD_gettable_ctx_params() and
+EVP_MD_CTX_gettable_params() return parameters that can be used with
+EVP_MD_CTX_get_params(). EVP_MD_settable_ctx_params() and
+EVP_MD_CTX_settable_params() return parameters that can be used with
+EVP_MD_CTX_set_params().
 See L<OSSL_PARAM(3)> for the use of B<OSSL_PARAM> as parameter descriptor.
 
 =item EVP_MD_CTX_set_flags(), EVP_MD_CTX_clear_flags(), EVP_MD_CTX_test_flags()
diff --git a/include/openssl/evp.h b/include/openssl/evp.h
index bbdc2b75c1..b65328df6d 100644
--- a/include/openssl/evp.h
+++ b/include/openssl/evp.h
@@ -555,8 +555,10 @@ int EVP_MD_get_params(const EVP_MD *digest, OSSL_PARAM params[]);
 int EVP_MD_CTX_set_params(EVP_MD_CTX *ctx, const OSSL_PARAM params[]);
 int EVP_MD_CTX_get_params(EVP_MD_CTX *ctx, OSSL_PARAM params[]);
 const OSSL_PARAM *EVP_MD_gettable_params(const EVP_MD *digest);
-const OSSL_PARAM *EVP_MD_CTX_settable_params(const EVP_MD *digest);
-const OSSL_PARAM *EVP_MD_CTX_gettable_params(const EVP_MD *digest);
+const OSSL_PARAM *EVP_MD_settable_ctx_params(const EVP_MD *md);
+const OSSL_PARAM *EVP_MD_gettable_ctx_params(const EVP_MD *md);
+const OSSL_PARAM *EVP_MD_CTX_settable_params(EVP_MD_CTX *ctx);
+const OSSL_PARAM *EVP_MD_CTX_gettable_params(EVP_MD_CTX *ctx);
 int EVP_MD_CTX_ctrl(EVP_MD_CTX *ctx, int cmd, int p1, void *p2);
 EVP_MD_CTX *EVP_MD_CTX_new(void);
 int EVP_MD_CTX_reset(EVP_MD_CTX *ctx);
diff --git a/util/libcrypto.num b/util/libcrypto.num
index 1b14b440dc..567b00631f 100644
--- a/util/libcrypto.num
+++ b/util/libcrypto.num
@@ -4764,3 +4764,5 @@ ERR_peek_last_error_data                4880	3_0_0	EXIST::FUNCTION:
 ERR_peek_last_error_all                 4881	3_0_0	EXIST::FUNCTION:
 EVP_CIPHER_is_a                         4882	3_0_0	EXIST::FUNCTION:
 EVP_MAC_is_a                            4883	3_0_0	EXIST::FUNCTION:
+EVP_MD_settable_ctx_params              4884	3_0_0	EXIST::FUNCTION:
+EVP_MD_gettable_ctx_params              4885	3_0_0	EXIST::FUNCTION:


More information about the openssl-commits mailing list