[openssl-commits] [openssl] master update

Rich Salz rsalz at openssl.org
Thu Sep 14 12:29:50 UTC 2017


The branch master has been updated
       via  a8f730d5d240abe56b1d14c18223db3fd20f09e2 (commit)
       via  0822e89addcb8c6b8a135a54a503a429efbe0dbe (commit)
      from  76b2ae832679d25e6952934481ac38e0e76e2271 (commit)


- Log -----------------------------------------------------------------
commit a8f730d5d240abe56b1d14c18223db3fd20f09e2
Author: Paul Yang <yang.yang at baishancloud.com>
Date:   Thu Sep 14 14:19:30 2017 +0800

    Fix doc nits
    
    [to be squashed]
    [skip ci]
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4356)

commit 0822e89addcb8c6b8a135a54a503a429efbe0dbe
Author: Paul Yang <yang.yang at baishancloud.com>
Date:   Mon Sep 11 23:15:55 2017 +0800

    Support EVP_PKEY_meth_remove and pmeth internal cleanup
    
    1. make app pkey methods cleanup internal
    2. add EVP_PKEY_meth_remove
    
    Fixes travis-ci failure in #4337
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    Reviewed-by: Rich Salz <rsalz at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/4356)

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

Summary of changes:
 crypto/evp/names.c                |  2 ++
 crypto/evp/pmeth_lib.c            | 15 +++++++++++++++
 crypto/include/internal/evp_int.h |  1 +
 doc/man3/EVP_PKEY_meth_new.pod    | 10 +++++++++-
 include/openssl/evp.h             |  1 +
 test/evp_extra_test.c             |  5 -----
 util/libcrypto.num                |  1 +
 7 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/crypto/evp/names.c b/crypto/evp/names.c
index 41c3cee..1190569 100644
--- a/crypto/evp/names.c
+++ b/crypto/evp/names.c
@@ -90,6 +90,8 @@ void evp_cleanup_int(void)
 
     EVP_PBE_cleanup();
     OBJ_sigid_free();
+
+    evp_app_cleanup_int();
 }
 
 struct doall_cipher {
diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c
index c62bd81..2b9b8a9 100644
--- a/crypto/evp/pmeth_lib.c
+++ b/crypto/evp/pmeth_lib.c
@@ -296,6 +296,21 @@ int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth)
     return 1;
 }
 
+void evp_app_cleanup_int(void)
+{
+    if (app_pkey_methods != NULL)
+        sk_EVP_PKEY_METHOD_pop_free(app_pkey_methods, EVP_PKEY_meth_free);
+}
+
+int EVP_PKEY_meth_remove(const EVP_PKEY_METHOD *pmeth)
+{
+    const EVP_PKEY_METHOD *ret;
+
+    ret = sk_EVP_PKEY_METHOD_delete_ptr(app_pkey_methods, pmeth);
+
+    return ret == NULL ? 0 : 1;
+}
+
 size_t EVP_PKEY_meth_get_count(void)
 {
     size_t rv = OSSL_NELEM(standard_methods);
diff --git a/crypto/include/internal/evp_int.h b/crypto/include/internal/evp_int.h
index b9558a6..ccfa97c 100644
--- a/crypto/include/internal/evp_int.h
+++ b/crypto/include/internal/evp_int.h
@@ -393,6 +393,7 @@ struct evp_pkey_st {
 void openssl_add_all_ciphers_int(void);
 void openssl_add_all_digests_int(void);
 void evp_cleanup_int(void);
+void evp_app_cleanup_int(void);
 
 /* Pulling defines out of C soure files */
 
diff --git a/doc/man3/EVP_PKEY_meth_new.pod b/doc/man3/EVP_PKEY_meth_new.pod
index acff78a..672ac29 100644
--- a/doc/man3/EVP_PKEY_meth_new.pod
+++ b/doc/man3/EVP_PKEY_meth_new.pod
@@ -13,7 +13,8 @@ EVP_PKEY_meth_get_init, EVP_PKEY_meth_get_copy, EVP_PKEY_meth_get_cleanup,
 EVP_PKEY_meth_get_paramgen, EVP_PKEY_meth_get_keygen, EVP_PKEY_meth_get_sign,
 EVP_PKEY_meth_get_verify, EVP_PKEY_meth_get_verify_recover, EVP_PKEY_meth_get_signctx,
 EVP_PKEY_meth_get_verifyctx, EVP_PKEY_meth_get_encrypt, EVP_PKEY_meth_get_decrypt,
-EVP_PKEY_meth_get_derive, EVP_PKEY_meth_get_ctrl, EVP_PKEY_meth_get_check
+EVP_PKEY_meth_get_derive, EVP_PKEY_meth_get_ctrl, EVP_PKEY_meth_get_check,
+EVP_PKEY_meth_remove
 - manipulating EVP_PKEY_METHOD structure
 
 =head1 SYNOPSIS
@@ -27,6 +28,7 @@ EVP_PKEY_meth_get_derive, EVP_PKEY_meth_get_ctrl, EVP_PKEY_meth_get_check
  void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src);
  const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type);
  int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth);
+ int EVP_PKEY_meth_remove(const EVP_PKEY_METHOD *pmeth);
 
  void EVP_PKEY_meth_set_init(EVP_PKEY_METHOD *pmeth,
                              int (*init) (EVP_PKEY_CTX *ctx));
@@ -350,6 +352,9 @@ then the built-in objects.
 
 EVP_PKEY_meth_add0() adds B<pmeth> to the user defined stack of methods.
 
+EVP_PKEY_meth_remove() removes an B<EVP_PKEY_METHOD> object added by
+EVP_PKEY_meth_add0().
+
 The EVP_PKEY_meth_set functions set the corresponding fields of
 B<EVP_PKEY_METHOD> structure with the arguments passed.
 
@@ -369,6 +374,9 @@ object or returns NULL if not found.
 EVP_PKEY_meth_add0() returns 1 if method is added successfully or 0
 if an error occurred.
 
+EVP_PKEY_meth_remove() returns 1 if method is removed successfully or
+0 if an error occurred.
+
 All EVP_PKEY_meth_set and EVP_PKEY_meth_get functions have no return
 values. For the 'get' functions, function pointers are returned by
 arguments.
diff --git a/include/openssl/evp.h b/include/openssl/evp.h
index 2c01bdf..34c009a 100644
--- a/include/openssl/evp.h
+++ b/include/openssl/evp.h
@@ -1276,6 +1276,7 @@ void EVP_PKEY_meth_get0_info(int *ppkey_id, int *pflags,
 void EVP_PKEY_meth_copy(EVP_PKEY_METHOD *dst, const EVP_PKEY_METHOD *src);
 void EVP_PKEY_meth_free(EVP_PKEY_METHOD *pmeth);
 int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth);
+int EVP_PKEY_meth_remove(const EVP_PKEY_METHOD *pmeth);
 size_t EVP_PKEY_meth_get_count(void);
 const EVP_PKEY_METHOD *EVP_PKEY_meth_get0(size_t idx);
 
diff --git a/test/evp_extra_test.c b/test/evp_extra_test.c
index 221f9a6..f49ca80 100644
--- a/test/evp_extra_test.c
+++ b/test/evp_extra_test.c
@@ -524,8 +524,3 @@ int setup_tests(void)
     ADD_ALL_TESTS(test_EVP_PKEY_check, OSSL_NELEM(keycheckdata));
     return 1;
 }
-
-void cleanup_tests(void)
-{
-    EVP_PKEY_meth_free(custom_pmeth);
-}
diff --git a/util/libcrypto.num b/util/libcrypto.num
index 35c05da..363059b 100644
--- a/util/libcrypto.num
+++ b/util/libcrypto.num
@@ -4396,3 +4396,4 @@ UI_get_result_string_length             4339	1_1_1	EXIST::FUNCTION:
 EVP_PKEY_check                          4340	1_1_1	EXIST::FUNCTION:
 EVP_PKEY_meth_set_check                 4341	1_1_1	EXIST::FUNCTION:
 EVP_PKEY_meth_get_check                 4342	1_1_1	EXIST::FUNCTION:
+EVP_PKEY_meth_remove                    4343	1_1_1	EXIST::FUNCTION:


More information about the openssl-commits mailing list