Merge branch 'boringssl'

Adds some fixes to the openssl plugin to build against BoringSSL.

Fixes #1374.
This commit is contained in:
Tobias Brunner
2016-04-15 10:34:27 +02:00
7 changed files with 12 additions and 7 deletions
-3
View File
@@ -66,9 +66,6 @@ strongswan_CFLAGS := \
-DHAVE_STRUCT_SADB_X_POLICY_SADB_X_POLICY_PRIORITY \ -DHAVE_STRUCT_SADB_X_POLICY_SADB_X_POLICY_PRIORITY \
-DHAVE_IPSEC_MODE_BEET \ -DHAVE_IPSEC_MODE_BEET \
-DHAVE_IPSEC_DIR_FWD \ -DHAVE_IPSEC_DIR_FWD \
-DOPENSSL_NO_EC \
-DOPENSSL_NO_ECDSA \
-DOPENSSL_NO_ECDH \
-DOPENSSL_NO_ENGINE \ -DOPENSSL_NO_ENGINE \
-DCONFIG_H_INCLUDED \ -DCONFIG_H_INCLUDED \
-DCAPABILITIES \ -DCAPABILITIES \
@@ -46,7 +46,6 @@ strongswan_CFLAGS := \
-DHAVE_IPSEC_DIR_FWD \ -DHAVE_IPSEC_DIR_FWD \
-DHAVE_IN6ADDR_ANY \ -DHAVE_IN6ADDR_ANY \
-DHAVE_NETINET_IP6_H \ -DHAVE_NETINET_IP6_H \
-DOPENSSL_NO_ENGINE \
-DCONFIG_H_INCLUDED \ -DCONFIG_H_INCLUDED \
-DCAPABILITIES \ -DCAPABILITIES \
-DCAPABILITIES_NATIVE \ -DCAPABILITIES_NATIVE \
+2 -1
View File
@@ -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, f);
add_feature(this, PLUGIN_DEPENDS(CUSTOM, "gcrypt-threading")); 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); 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); this->dh->g = BN_bin2bn(params->generator.ptr, params->generator.len, NULL);
if (params->exp_len != params->prime.len) 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; this->dh->length = params->exp_len * 8;
#endif
} }
return SUCCESS; return SUCCESS;
} }
@@ -43,7 +43,7 @@ struct private_openssl_hasher_t {
METHOD(hasher_t, get_hash_size, size_t, METHOD(hasher_t, get_hash_size, size_t,
private_openssl_hasher_t *this) private_openssl_hasher_t *this)
{ {
return this->hasher->md_size; return EVP_MD_size(this->hasher);
} }
METHOD(hasher_t, reset, bool, METHOD(hasher_t, reset, bool,
@@ -502,8 +502,10 @@ METHOD(plugin_t, get_features, int,
METHOD(plugin_t, destroy, void, METHOD(plugin_t, destroy, void,
private_openssl_plugin_t *this) private_openssl_plugin_t *this)
{ {
#ifndef OPENSSL_IS_BORINGSSL
CONF_modules_free(); CONF_modules_free();
OBJ_cleanup(); OBJ_cleanup();
#endif
EVP_cleanup(); EVP_cleanup();
#ifndef OPENSSL_NO_ENGINE #ifndef OPENSSL_NO_ENGINE
ENGINE_cleanup(); ENGINE_cleanup();
@@ -555,7 +557,9 @@ plugin_t *openssl_plugin_create()
threading_init(); threading_init();
#ifndef OPENSSL_IS_BORINGSSL
OPENSSL_config(NULL); OPENSSL_config(NULL);
#endif
OpenSSL_add_all_algorithms(); OpenSSL_add_all_algorithms();
#ifdef OPENSSL_FIPS #ifdef OPENSSL_FIPS
@@ -51,7 +51,7 @@ bool openssl_hash_chunk(int hash_type, chunk_t data, chunk_t *hash)
goto error; goto error;
} }
*hash = chunk_alloc(hasher->md_size); *hash = chunk_alloc(EVP_MD_size(hasher));
if (!EVP_DigestFinal_ex(ctx, hash->ptr, NULL)) if (!EVP_DigestFinal_ex(ctx, hash->ptr, NULL))
{ {
chunk_free(hash); chunk_free(hash);