From 023eccfc044c2f6a377f22fe50227175aca6fb4c Mon Sep 17 00:00:00 2001 From: Paul Kehrer Date: Mon, 5 Jun 2017 14:45:44 -1000 Subject: bind EVP_PKEY_get1_tls_encodedpoint because X25519 (#3682) --- src/_cffi_src/openssl/evp.py | 11 +++++++++++ src/cryptography/hazmat/bindings/openssl/_conditional.py | 3 +++ 2 files changed, 14 insertions(+) diff --git a/src/_cffi_src/openssl/evp.py b/src/_cffi_src/openssl/evp.py index 57f08893..1b108631 100644 --- a/src/_cffi_src/openssl/evp.py +++ b/src/_cffi_src/openssl/evp.py @@ -31,6 +31,7 @@ static const int Cryptography_HAS_PBKDF2_HMAC; static const int Cryptography_HAS_PKEY_CTX; static const int Cryptography_HAS_SCRYPT; static const int Cryptography_HAS_EVP_PKEY_DHX; +static const int Cryptography_HAS_EVP_PKEY_get1_tls_encodedpoint; """ FUNCTIONS = """ @@ -147,6 +148,9 @@ void Cryptography_EVP_MD_CTX_free(EVP_MD_CTX *); """ MACROS = """ +/* Added in 1.1.0 */ +size_t EVP_PKEY_get1_tls_encodedpoint(EVP_PKEY *, unsigned char **); + /* PKCS8_PRIV_KEY_INFO * became const in 1.1.0 */ EVP_PKEY *EVP_PKCS82PKEY(PKCS8_PRIV_KEY_INFO *); @@ -218,6 +222,13 @@ int (*EVP_PBE_scrypt)(const char *, size_t, const unsigned char *, size_t, static const long Cryptography_HAS_SCRYPT = 1; #endif +#if CRYPTOGRAPHY_OPENSSL_110_OR_GREATER +static const long Cryptography_HAS_EVP_PKEY_get1_tls_encodedpoint = 1; +#else +static const long Cryptography_HAS_EVP_PKEY_get1_tls_encodedpoint = 0; +size_t (*EVP_PKEY_get1_tls_encodedpoint)(EVP_PKEY *, unsigned char **) = NULL; +#endif + /* OpenSSL 1.1.0+ does this define for us, but if not present we'll do it */ #if !defined(EVP_CTRL_AEAD_SET_IVLEN) # define EVP_CTRL_AEAD_SET_IVLEN EVP_CTRL_GCM_SET_IVLEN diff --git a/src/cryptography/hazmat/bindings/openssl/_conditional.py b/src/cryptography/hazmat/bindings/openssl/_conditional.py index 942ac60b..8672a599 100644 --- a/src/cryptography/hazmat/bindings/openssl/_conditional.py +++ b/src/cryptography/hazmat/bindings/openssl/_conditional.py @@ -176,4 +176,7 @@ CONDITIONAL_NAMES = { "Cryptography_HAS_X25519": [ "NID_X25519", ], + "Cryptography_HAS_EVP_PKEY_get1_tls_encodedpoint": [ + "EVP_PKEY_get1_tls_encodedpoint", + ], } -- cgit v1.2.3