Fixes for building with --disable-ecc and --disable-dh.

This commit is contained in:
David Garske
2020-11-10 09:46:18 -08:00
parent 4e37036cba
commit 4a790cd024
3 changed files with 18 additions and 3 deletions

View File

@ -48359,12 +48359,15 @@ int wolfSSL_PEM_write_bio_PKCS8PrivateKey(WOLFSSL_BIO* bio,
}
if (ret == 0 && enc == NULL) {
type = PKCS8_PRIVATEKEY_TYPE;
#ifdef HAVE_ECC
if (pkey->type == EVP_PKEY_EC) {
algId = ECDSAk;
ret = wc_ecc_get_oid(pkey->ecc->group->curve_oid, &curveOid,
&oidSz);
}
else {
else
#endif
{
algId = RSAk;
curveOid = NULL;
oidSz = 0;

View File

@ -22146,7 +22146,9 @@ static int test_wc_SetSubjectKeyIdFromPublicKey_ex (void)
RsaKey rsaKey;
int bits = 2048;
#endif
#if defined(HAVE_ECC)
ecc_key eccKey;
#endif
#if defined(HAVE_ED448)
ed448_key ed448Key;
#endif
@ -22185,6 +22187,7 @@ static int test_wc_SetSubjectKeyIdFromPublicKey_ex (void)
wc_FreeRsaKey(&rsaKey);
}
#endif
#if defined(HAVE_ECC)
if (ret == 0) { /*ECC*/
ret = wc_ecc_init(&eccKey);
if (ret == 0) {
@ -22195,6 +22198,7 @@ static int test_wc_SetSubjectKeyIdFromPublicKey_ex (void)
}
wc_ecc_free(&eccKey);
}
#endif
#if defined(HAVE_ED448) && (defined(WOLFSSL_CERT_GEN) || \
defined(WOLFSSL_KEY_GEN))
@ -22233,7 +22237,9 @@ static int test_wc_SetAuthKeyIdFromPublicKey_ex (void)
RsaKey rsaKey;
int bits = 2048;
#endif
#if defined(HAVE_ECC)
ecc_key eccKey;
#endif
#if defined(HAVE_ED448)
ed448_key ed448Key;
#endif
@ -22272,6 +22278,7 @@ static int test_wc_SetAuthKeyIdFromPublicKey_ex (void)
wc_FreeRsaKey(&rsaKey);
}
#endif
#if defined(HAVE_ECC)
if (ret == 0) { /*ECC*/
ret = wc_ecc_init(&eccKey);
if (ret == 0) {
@ -22282,6 +22289,7 @@ static int test_wc_SetAuthKeyIdFromPublicKey_ex (void)
}
wc_ecc_free(&eccKey);
}
#endif
#if defined(HAVE_ED448) && (defined(WOLFSSL_CERT_GEN) || \
defined(WOLFSSL_KEY_GEN))
@ -29249,7 +29257,9 @@ static void test_wolfSSL_PKCS8_d2i(void)
XFILE file;
#ifndef NO_BIO
BIO* bio;
#if defined(HAVE_ECC)
WOLFSSL_EVP_PKEY* evpPkey = NULL;
#endif
#endif
#endif
#ifndef NO_RSA
@ -34759,6 +34769,7 @@ static void test_wolfSSL_EVP_PKEY_derive(void)
EVP_PKEY *pkey, *peerkey;
const unsigned char* key;
#ifndef NO_DH
/* DH */
key = dh_key_der_2048;
AssertNotNull((pkey = d2i_PrivateKey(EVP_PKEY_DH, NULL, &key,
@ -34779,6 +34790,7 @@ static void test_wolfSSL_EVP_PKEY_derive(void)
EVP_PKEY_free(peerkey);
EVP_PKEY_free(pkey);
XFREE(skey, NULL, DYNAMIC_TYPE_OPENSSL);
#endif
#ifdef HAVE_ECC
/* ECDH */

View File

@ -1432,7 +1432,7 @@ int wolfSSL_EVP_PKEY_derive_set_peer(WOLFSSL_EVP_PKEY_CTX *ctx, WOLFSSL_EVP_PKEY
return WOLFSSL_SUCCESS;
}
#if !defined(NO_DH) && defined(HAVE_ECC)
#if !defined(NO_DH) || defined(HAVE_ECC)
#if !defined(HAVE_FIPS) || (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION!=2))
int wolfSSL_EVP_PKEY_derive(WOLFSSL_EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen)
{
@ -1542,7 +1542,7 @@ int wolfSSL_EVP_PKEY_derive(WOLFSSL_EVP_PKEY_CTX *ctx, unsigned char *key, size_
return WOLFSSL_SUCCESS;
}
#endif /* !HAVE_FIPS || HAVE_FIPS_VERSION > 2 */
#endif
#endif /* !NO_DH || HAVE_ECC */
/* Uses the WOLFSSL_EVP_PKEY_CTX to decrypt a buffer.
*