openssl: Fixes for DH with OpenSSL 3.0
While we could assign the DH object to a EVP_PKEY object, this won't work with BoringSSL as it doesn't seem to support EVP_PKEY_derive() for DH.
This commit is contained in:
@@ -22,6 +22,11 @@
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/x509.h>
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
/* for EVP_PKEY_CTX_set_dh_pad */
|
||||
#include <openssl/dh.h>
|
||||
#endif
|
||||
|
||||
/* these were added with 1.1.0 when ASN1_OBJECT was made opaque */
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
#define OBJ_get0_data(o) ((o)->data)
|
||||
@@ -48,6 +53,14 @@ bool openssl_compute_shared_key(EVP_PKEY *priv, EVP_PKEY *pub, chunk_t *shared)
|
||||
goto error;
|
||||
}
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
if (EVP_PKEY_base_id(priv) == EVP_PKEY_DH &&
|
||||
EVP_PKEY_CTX_set_dh_pad(ctx, 1) <= 0)
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (EVP_PKEY_derive_set_peer(ctx, pub) <= 0)
|
||||
{
|
||||
goto error;
|
||||
|
||||
Reference in New Issue
Block a user