60 行
2.0 KiB
Plaintext
60 行
2.0 KiB
Plaintext
Fix build with opaque structs in LibreSSL 3.5
|
|
|
|
Index: src/lib/crypt_ops/crypto_dh_openssl.c
|
|
--- src/lib/crypt_ops/crypto_dh_openssl.c.orig
|
|
+++ src/lib/crypt_ops/crypto_dh_openssl.c
|
|
@@ -60,7 +60,7 @@ crypto_validate_dh_params(const BIGNUM *p, const BIGNU
|
|
/* Copy into a temporary DH object, just so that DH_check() can be called. */
|
|
if (!(dh = DH_new()))
|
|
goto out;
|
|
-#ifdef OPENSSL_1_1_API
|
|
+#if defined(OPENSSL_1_1_API) || defined(LIBRESSL_VERSION_NUMBER)
|
|
BIGNUM *dh_p, *dh_g;
|
|
if (!(dh_p = BN_dup(p)))
|
|
goto out;
|
|
@@ -223,7 +223,7 @@ new_openssl_dh_from_params(BIGNUM *p, BIGNUM *g)
|
|
goto err;
|
|
}
|
|
|
|
-#ifdef OPENSSL_1_1_API
|
|
+#if defined(OPENSSL_1_1_API) || defined(LIBRESSL_VERSION_NUMBER)
|
|
|
|
if (!DH_set0_pqg(res_dh, dh_p, NULL, dh_g)) {
|
|
goto err;
|
|
@@ -276,7 +276,7 @@ crypto_dh_get_bytes(crypto_dh_t *dh)
|
|
int
|
|
crypto_dh_generate_public(crypto_dh_t *dh)
|
|
{
|
|
-#ifndef OPENSSL_1_1_API
|
|
+#if !defined(OPENSSL_1_1_API) && !defined(LIBRESSL_VERSION_NUMBER)
|
|
again:
|
|
#endif
|
|
if (!DH_generate_key(dh->dh)) {
|
|
@@ -286,7 +286,7 @@ crypto_dh_generate_public(crypto_dh_t *dh)
|
|
return -1;
|
|
/* LCOV_EXCL_STOP */
|
|
}
|
|
-#ifdef OPENSSL_1_1_API
|
|
+#if defined(OPENSSL_1_1_API) || defined(LIBRESSL_VERSION_NUMBER)
|
|
/* OpenSSL 1.1.x doesn't appear to let you regenerate a DH key, without
|
|
* recreating the DH object. I have no idea what sort of aliasing madness
|
|
* can occur here, so do the check, and just bail on failure.
|
|
@@ -327,7 +327,7 @@ crypto_dh_get_public(crypto_dh_t *dh, char *pubkey, si
|
|
|
|
const BIGNUM *dh_pub;
|
|
|
|
-#ifdef OPENSSL_1_1_API
|
|
+#if defined(OPENSSL_1_1_API) || defined(LIBRESSL_VERSION_NUMBER)
|
|
const BIGNUM *dh_priv;
|
|
DH_get0_key(dh->dh, &dh_pub, &dh_priv);
|
|
#else
|
|
@@ -338,7 +338,7 @@ crypto_dh_get_public(crypto_dh_t *dh, char *pubkey, si
|
|
if (crypto_dh_generate_public(dh)<0)
|
|
return -1;
|
|
else {
|
|
-#ifdef OPENSSL_1_1_API
|
|
+#if defined(OPENSSL_1_1_API) || defined(LIBRESSL_VERSION_NUMBER)
|
|
DH_get0_key(dh->dh, &dh_pub, &dh_priv);
|
|
#else
|
|
dh_pub = dh->dh->pub_key;
|