Consolidate to one-line where possible

This commit is contained in:
kaleb-himes
2020-06-03 16:19:34 -06:00
parent 6ab5f2d9d7
commit 5a4d84ecad
4 changed files with 25 additions and 44 deletions

View File

@ -18553,8 +18553,7 @@ int wolfSSL_DH_check(const WOLFSSL_DH *dh, int *codes)
return WOLFSSL_SUCCESS;
}
#if !defined(HAVE_FIPS) || \
( defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2) )
#if !defined(HAVE_FIPS) || (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION>2))
/* Converts DER encoded DH parameters to a WOLFSSL_DH structure.
*
* dh : structure to copy DH parameters into.
@ -28579,8 +28578,7 @@ void wolfSSL_DH_free(WOLFSSL_DH* dh)
}
}
#if !defined(HAVE_FIPS) || \
( defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2) )
#if !defined(HAVE_FIPS) || (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION>2))
int SetDhInternal(WOLFSSL_DH* dh)
{
int ret = WOLFSSL_FATAL_ERROR;
@ -29123,8 +29121,7 @@ WOLFSSL_BIGNUM* wolfSSL_DH_8192_prime(WOLFSSL_BIGNUM* bn)
return bn;
}
#if !defined(HAVE_FIPS) || \
( defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2) )
#if !defined(HAVE_FIPS) || (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION>2))
/* return code compliant with OpenSSL :
* 1 if success, 0 if error
*/
@ -32629,8 +32626,7 @@ int wolfSSL_ECPoint_i2d(const WOLFSSL_EC_GROUP *group,
return WOLFSSL_SUCCESS;
}
#if !defined(HAVE_FIPS) || \
( defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2) )
#if !defined(HAVE_FIPS) || (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION>2))
/* return code compliant with OpenSSL :
* 1 if success, 0 if error
*/
@ -32976,8 +32972,7 @@ int wolfSSL_EC_POINT_set_affine_coordinates_GFp(const WOLFSSL_EC_GROUP *group,
#if !defined(WOLFSSL_ATECC508A) && !defined(WOLFSSL_ATECC608A) && \
!defined(HAVE_SELFTEST)
#if !defined(HAVE_FIPS) || \
( defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2) )
#if !defined(HAVE_FIPS) || (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION>2))
/* Calculate the value: generator * n + q * m
* return code compliant with OpenSSL :
* 1 if success, 0 if error
@ -33241,8 +33236,7 @@ int wolfSSL_EC_POINT_is_at_infinity(const WOLFSSL_EC_GROUP *group,
/* End EC_POINT */
#if !defined(HAVE_FIPS) || \
( defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2) )
#if !defined(HAVE_FIPS) || (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION>2))
size_t wolfSSL_EC_get_builtin_curves(WOLFSSL_EC_BUILTIN_CURVE *r, size_t nitems)
{
size_t i, min_nitems;
@ -35021,8 +35015,7 @@ int wolfSSL_RSA_LoadDer_ex(WOLFSSL_RSA* rsa, const unsigned char* derBuf,
#if defined(WC_RSA_PSS) && (defined(OPENSSL_ALL) || defined(WOLFSSL_ASIO) || \
defined(WOLFSSL_HAPROXY) || defined(WOLFSSL_NGINX))
#if !defined(HAVE_FIPS) || \
( defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2) )
#if !defined(HAVE_FIPS) || (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION>2))
static int hash2mgf(enum wc_HashType hType)
{
switch (hType) {
@ -35576,8 +35569,7 @@ int wolfSSL_EC_KEY_LoadDer_ex(WOLFSSL_EC_KEY* key, const unsigned char* derBuf,
#if !defined(NO_DH) && (defined(WOLFSSL_QT) || defined(OPENSSL_ALL) || defined(WOLFSSL_OPENSSH))
/* return WOLFSSL_SUCCESS if success, WOLFSSL_FATAL_ERROR if error */
#if !defined(HAVE_FIPS) || \
( defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2) )
#if !defined(HAVE_FIPS) || (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION>2))
int wolfSSL_DH_LoadDer(WOLFSSL_DH* dh, const unsigned char* derBuf, int derSz)
{
word32 idx = 0;
@ -39679,8 +39671,7 @@ WOLFSSL_BIO* wolfSSL_BIO_new_fp(XFILE fp, int close_flag)
#ifndef NO_DH
#if !defined(HAVE_FIPS) || \
( defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2) )
#if !defined(HAVE_FIPS) || (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION>2))
WOLFSSL_DH *wolfSSL_PEM_read_bio_DHparams(WOLFSSL_BIO *bio, WOLFSSL_DH **x,
pem_password_cb *cb, void *u)
{
@ -39896,8 +39887,7 @@ int wc_DhParamsToDer(DhKey* key, byte* out, word32* outSz)
return idx;
}
#if !defined(HAVE_FIPS) || \
( defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2) )
#if !defined(HAVE_FIPS) || (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION>2))
int wc_DhPubKeyToDer(DhKey* key, byte* out, word32* outSz)
{
word32 sz = 0;

View File

@ -1786,9 +1786,8 @@ static int test_wolfSSL_SetMinVersion(void)
EC_GROUP_new_by_curve_name, EC_GROUP_order_bits
*/
# if defined(OPENSSL_EXTRA) && ( !defined(HAVE_FIPS) || \
( defined(HAVE_FIPS_VERSION) && \
(HAVE_FIPS_VERSION > 2) ) )
# if defined(OPENSSL_EXTRA) && \
(!defined(HAVE_FIPS) || (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION>2)))
static void test_wolfSSL_EC(void)
{
#if defined(HAVE_ECC)
@ -28048,8 +28047,7 @@ static void test_wolfSSL_OBJ_ln(void)
AssertIntEQ(OBJ_ln2nid(NULL), NID_undef);
#ifdef HAVE_ECC
#if !defined(HAVE_FIPS) || \
( defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2) )
#if !defined(HAVE_FIPS) || (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION>2))
{
int nCurves = 27;
EC_builtin_curve r[nCurves];
@ -28718,8 +28716,7 @@ static void test_wolfSSL_RSA_padding_add_PKCS1_PSS(void)
static void test_wolfSSL_EC_get_builtin_curves(void)
{
#if defined(HAVE_ECC) && (defined(OPENSSL_EXTRA) || defined(OPENSSL_ALL))
#if !defined(HAVE_FIPS) || \
( defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2) )
#if !defined(HAVE_FIPS) || (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION>2))
EC_builtin_curve* curves = NULL;
size_t crv_len = 0;
size_t i = 0;
@ -29298,8 +29295,7 @@ static void test_wolfSSL_EVP_PKEY_sign(void)
{
#if defined(OPENSSL_EXTRA) && !defined(NO_RSA) && defined(WOLFSSL_KEY_GEN) && \
!defined(HAVE_FAST_RSA) && !defined(HAVE_SELFTEST)
#if !defined(HAVE_FIPS) || \
(defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2) )
#if !defined(HAVE_FIPS) || (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION>2))
WOLFSSL_RSA* rsa = NULL;
WOLFSSL_EVP_PKEY* pkey = NULL;
WOLFSSL_EVP_PKEY_CTX* ctx = NULL;
@ -29383,8 +29379,7 @@ static void test_EVP_PKEY_rsa(void)
static void test_EVP_PKEY_ec(void)
{
#if defined(OPENSSL_EXTRA) && defined(HAVE_ECC)
#if !defined(HAVE_FIPS) || \
( defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2) )
#if !defined(HAVE_FIPS) || (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION>2))
WOLFSSL_EC_KEY* ecKey;
WOLFSSL_EVP_PKEY* pkey;
@ -32429,8 +32424,7 @@ void ApiTest(void)
/*wolfSSL_EVP_get_cipherbynid test*/
test_wolfSSL_EVP_get_cipherbynid();
test_wolfSSL_EVP_CIPHER_CTX();
#if !defined(HAVE_FIPS) || \
( defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2) )
#if !defined(HAVE_FIPS) || (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION>2))
test_wolfSSL_EC();
#endif
test_wolfSSL_ECDSA_SIG();

View File

@ -141,7 +141,6 @@ extern int wc_InitRsaHw(RsaKey* key);
};
#endif
#endif
#ifdef WOLFSSL_RENESAS_TSIP_TLS
void tsip_inform_key_position(const word32 key_n_start,
const word32 key_n_len, const word32 key_e_start,
@ -4399,8 +4398,8 @@ int wc_DhKeyDecode(const byte* input, word32* inOutIdx, DhKey* key, word32 inSz)
int ret = 0;
int length;
#if defined(WOLFSSL_QT) || defined(OPENSSL_ALL)
#if !defined(HAVE_FIPS) || \
( defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2) )
#if !defined(HAVE_FIPS) || (defined(HAVE_FIPS_VERSION) && \
(HAVE_FIPS_VERSION>2))
word32 oid = 0, temp = 0;
#endif
#endif
@ -4413,8 +4412,8 @@ int wc_DhKeyDecode(const byte* input, word32* inOutIdx, DhKey* key, word32 inSz)
if (GetSequence(input, inOutIdx, &length, inSz) < 0)
return ASN_PARSE_E;
#if defined(WOLFSSL_QT) || defined(OPENSSL_ALL)
#if !defined(HAVE_FIPS) || \
( defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2) )
#if !defined(HAVE_FIPS) || (defined(HAVE_FIPS_VERSION) && \
(HAVE_FIPS_VERSION>2))
temp = *inOutIdx;
#endif /* !HAVE_FIPS || HAVE_FIPS_VERSION > 2 */
#endif
@ -4426,8 +4425,8 @@ int wc_DhKeyDecode(const byte* input, word32* inOutIdx, DhKey* key, word32 inSz)
}
#if defined(WOLFSSL_QT) || defined(OPENSSL_ALL)
#if !defined(HAVE_FIPS) || \
( defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2) )
#if !defined(HAVE_FIPS) || (defined(HAVE_FIPS_VERSION) && \
(HAVE_FIPS_VERSION>2))
/* If ASN_DH_KEY_E: Check if input started at beginning of key */
if (ret == ASN_DH_KEY_E) {
/* rewind back to after the first sequence */

View File

@ -1343,8 +1343,7 @@ int wolfSSL_EVP_PKEY_derive_set_peer(WOLFSSL_EVP_PKEY_CTX *ctx, WOLFSSL_EVP_PKEY
}
#if !defined(NO_DH) && defined(HAVE_ECC)
#if !defined(HAVE_FIPS) || \
( defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2) )
#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)
{
int len;
@ -5896,8 +5895,7 @@ WOLFSSL_EC_KEY* wolfSSL_EVP_PKEY_get1_EC_KEY(WOLFSSL_EVP_PKEY* key)
#if defined(OPENSSL_ALL) || defined(WOLFSSL_QT)
#if !defined(NO_DH) && !defined(NO_FILESYSTEM)
#if !defined(HAVE_FIPS) || \
( defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION > 2) )
#if !defined(HAVE_FIPS) || (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION>2))
/* with set1 functions the pkey struct does not own the DH structure
* Build the following DH Key format from the passed in WOLFSSL_DH
* then store in WOLFSSL_EVP_PKEY in DER format.