Merge branch 'boringssl'
Adds some fixes to the openssl plugin to build against BoringSSL. Fixes #1374.
This commit is contained in:
@@ -66,9 +66,6 @@ strongswan_CFLAGS := \
|
||||
-DHAVE_STRUCT_SADB_X_POLICY_SADB_X_POLICY_PRIORITY \
|
||||
-DHAVE_IPSEC_MODE_BEET \
|
||||
-DHAVE_IPSEC_DIR_FWD \
|
||||
-DOPENSSL_NO_EC \
|
||||
-DOPENSSL_NO_ECDSA \
|
||||
-DOPENSSL_NO_ECDH \
|
||||
-DOPENSSL_NO_ENGINE \
|
||||
-DCONFIG_H_INCLUDED \
|
||||
-DCAPABILITIES \
|
||||
|
||||
@@ -46,7 +46,6 @@ strongswan_CFLAGS := \
|
||||
-DHAVE_IPSEC_DIR_FWD \
|
||||
-DHAVE_IN6ADDR_ANY \
|
||||
-DHAVE_NETINET_IP6_H \
|
||||
-DOPENSSL_NO_ENGINE \
|
||||
-DCONFIG_H_INCLUDED \
|
||||
-DCAPABILITIES \
|
||||
-DCAPABILITIES_NATIVE \
|
||||
|
||||
@@ -70,7 +70,8 @@ static void add_feature_with_ssl(private_curl_plugin_t *this, const char *ssl,
|
||||
add_feature(this, f);
|
||||
add_feature(this, PLUGIN_DEPENDS(CUSTOM, "gcrypt-threading"));
|
||||
}
|
||||
else if (strpfx(ssl, "NSS"))
|
||||
else if (strpfx(ssl, "NSS") ||
|
||||
strpfx(ssl, "BoringSSL"))
|
||||
{
|
||||
add_feature(this, f);
|
||||
}
|
||||
|
||||
@@ -145,7 +145,11 @@ static status_t set_modulus(private_openssl_diffie_hellman_t *this)
|
||||
this->dh->g = BN_bin2bn(params->generator.ptr, params->generator.len, NULL);
|
||||
if (params->exp_len != params->prime.len)
|
||||
{
|
||||
#ifdef OPENSSL_IS_BORINGSSL
|
||||
this->dh->priv_length = params->exp_len * 8;
|
||||
#else
|
||||
this->dh->length = params->exp_len * 8;
|
||||
#endif
|
||||
}
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ struct private_openssl_hasher_t {
|
||||
METHOD(hasher_t, get_hash_size, size_t,
|
||||
private_openssl_hasher_t *this)
|
||||
{
|
||||
return this->hasher->md_size;
|
||||
return EVP_MD_size(this->hasher);
|
||||
}
|
||||
|
||||
METHOD(hasher_t, reset, bool,
|
||||
|
||||
@@ -502,8 +502,10 @@ METHOD(plugin_t, get_features, int,
|
||||
METHOD(plugin_t, destroy, void,
|
||||
private_openssl_plugin_t *this)
|
||||
{
|
||||
#ifndef OPENSSL_IS_BORINGSSL
|
||||
CONF_modules_free();
|
||||
OBJ_cleanup();
|
||||
#endif
|
||||
EVP_cleanup();
|
||||
#ifndef OPENSSL_NO_ENGINE
|
||||
ENGINE_cleanup();
|
||||
@@ -555,7 +557,9 @@ plugin_t *openssl_plugin_create()
|
||||
|
||||
threading_init();
|
||||
|
||||
#ifndef OPENSSL_IS_BORINGSSL
|
||||
OPENSSL_config(NULL);
|
||||
#endif
|
||||
OpenSSL_add_all_algorithms();
|
||||
|
||||
#ifdef OPENSSL_FIPS
|
||||
|
||||
@@ -51,7 +51,7 @@ bool openssl_hash_chunk(int hash_type, chunk_t data, chunk_t *hash)
|
||||
goto error;
|
||||
}
|
||||
|
||||
*hash = chunk_alloc(hasher->md_size);
|
||||
*hash = chunk_alloc(EVP_MD_size(hasher));
|
||||
if (!EVP_DigestFinal_ex(ctx, hash->ptr, NULL))
|
||||
{
|
||||
chunk_free(hash);
|
||||
|
||||
Reference in New Issue
Block a user