Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@chromium.org>2015-11-21 01:47:25 +0300
committerAdam Langley <agl@google.com>2015-11-21 02:34:12 +0300
commit758d12732a3927902be505a8175c9a65503a12cd (patch)
tree6edda297cb66b41c9833ad4ebe5415096c3d89df /include/openssl/evp.h
parentfde89b43c347155798dee8b1210c2c5faabe25f8 (diff)
Add get0 getters for EVP_PKEY.
Right now your options are: - Bounce on a reference and deal with cleanup needlessly. - Manually check the type tag and peek into the union. We probably have no hope of opaquifying this struct, but for new code, let's recommend using this function rather than the more error-prone thing. Change-Id: I9b39ff95fe4264a3f7d1e0d2894db337aa968f6c Reviewed-on: https://boringssl-review.googlesource.com/6551 Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'include/openssl/evp.h')
-rw-r--r--include/openssl/evp.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/openssl/evp.h b/include/openssl/evp.h
index 6f594e59..e479e5ea 100644
--- a/include/openssl/evp.h
+++ b/include/openssl/evp.h
@@ -143,19 +143,24 @@ OPENSSL_EXPORT int EVP_PKEY_type(int nid);
* The following functions get and set the underlying public key in an
* |EVP_PKEY| object. The |set1| functions take an additional reference to the
* underlying key and return one on success or zero on error. The |assign|
- * functions adopt the caller's reference. The getters return a fresh reference
- * to the underlying object. */
+ * functions adopt the caller's reference. The |get1| functions return a fresh
+ * reference to the underlying object or NULL if |pkey| is not of the correct
+ * type. The |get0| functions behave the same but return a non-owning
+ * pointer. */
OPENSSL_EXPORT int EVP_PKEY_set1_RSA(EVP_PKEY *pkey, RSA *key);
OPENSSL_EXPORT int EVP_PKEY_assign_RSA(EVP_PKEY *pkey, RSA *key);
+OPENSSL_EXPORT RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey);
OPENSSL_EXPORT RSA *EVP_PKEY_get1_RSA(EVP_PKEY *pkey);
OPENSSL_EXPORT int EVP_PKEY_set1_DSA(EVP_PKEY *pkey, DSA *key);
OPENSSL_EXPORT int EVP_PKEY_assign_DSA(EVP_PKEY *pkey, DSA *key);
+OPENSSL_EXPORT DSA *EVP_PKEY_get0_DSA(EVP_PKEY *pkey);
OPENSSL_EXPORT DSA *EVP_PKEY_get1_DSA(EVP_PKEY *pkey);
OPENSSL_EXPORT int EVP_PKEY_set1_EC_KEY(EVP_PKEY *pkey, EC_KEY *key);
OPENSSL_EXPORT int EVP_PKEY_assign_EC_KEY(EVP_PKEY *pkey, EC_KEY *key);
+OPENSSL_EXPORT EC_KEY *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey);
OPENSSL_EXPORT EC_KEY *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey);
OPENSSL_EXPORT int EVP_PKEY_set1_DH(EVP_PKEY *pkey, DH *key);