Fix build errors with configs for no ASN and no PKI with PSK.

This commit is contained in:
David Garske
2017-10-26 07:34:41 -07:00
parent 182028819d
commit 94e0b06b9f
3 changed files with 22 additions and 12 deletions

View File

@@ -2838,7 +2838,7 @@ void FreeX509(WOLFSSL_X509* x509)
#endif /* !NO_DH || HAVE_ECC */ #endif /* !NO_DH || HAVE_ECC */
#if !defined(NO_RSA) || defined(HAVE_ECC) || defined(HAVE_ED25519) #ifndef NO_CERTS
/* Encode the signature algorithm into buffer. /* Encode the signature algorithm into buffer.
* *
* hashalgo The hash algorithm. * hashalgo The hash algorithm.
@@ -2876,7 +2876,10 @@ static INLINE void EncodeSigAlg(byte hashAlgo, byte hsType, byte* output)
#endif #endif
/* ED448: 0x0808 */ /* ED448: 0x0808 */
} }
(void)hashAlgo;
(void)output;
} }
static void SetDigest(WOLFSSL* ssl, int hashAlgo) static void SetDigest(WOLFSSL* ssl, int hashAlgo)
{ {
switch (hashAlgo) { switch (hashAlgo) {
@@ -2906,7 +2909,7 @@ static void SetDigest(WOLFSSL* ssl, int hashAlgo)
#endif /* WOLFSSL_SHA512 */ #endif /* WOLFSSL_SHA512 */
} /* switch */ } /* switch */
} }
#endif #endif /* !NO_CERTS */
#ifndef NO_RSA #ifndef NO_RSA
static int TypeHash(int hashAlgo) static int TypeHash(int hashAlgo)
@@ -4597,7 +4600,8 @@ int AllocKey(WOLFSSL* ssl, int type, void** pKey)
return ret; return ret;
} }
#if !defined(NO_RSA) || defined(HAVE_ECC) || defined(HAVE_CURVE25519) #if !defined(NO_RSA) || defined(HAVE_ECC) || defined(HAVE_ED25519) || \
defined(HAVE_CURVE25519)
static int ReuseKey(WOLFSSL* ssl, int type, void* pKey) static int ReuseKey(WOLFSSL* ssl, int type, void* pKey)
{ {
int ret = 0; int ret = 0;
@@ -19521,9 +19525,13 @@ exit_scke:
*/ */
int DecodePrivateKey(WOLFSSL *ssl, word16* length) int DecodePrivateKey(WOLFSSL *ssl, word16* length)
{ {
int ret; int ret = BAD_FUNC_ARG;
#if !defined(NO_RSA) || defined(HAVE_ECC) || defined(HAVE_ED25519)
int keySz; int keySz;
word32 idx; word32 idx;
#else
(void)length;
#endif
/* make sure private key exists */ /* make sure private key exists */
if (ssl->buffers.key == NULL || ssl->buffers.key->buffer == NULL) { if (ssl->buffers.key == NULL || ssl->buffers.key->buffer == NULL) {

View File

@@ -1007,11 +1007,10 @@ static int CheckBitString(const byte* input, word32* inOutIdx, int* len,
return 0; return 0;
} }
#if (!defined(NO_RSA) && (defined(WOLFSSL_CERT_GEN) || \ #if defined(WOLFSSL_CERT_GEN) || defined(WOLFSSL_KEY_GEN)
(defined(WOLFSSL_KEY_GEN) && \
!defined(HAVE_USER_RSA)))) || \ #if (!defined(NO_RSA) && !defined(HAVE_USER_RSA)) || \
(defined(HAVE_ECC) && (defined(WOLFSSL_CERT_GEN) || \ defined(HAVE_ECC) || defined(HAVE_ED25519)
defined(WOLFSSL_KEY_GEN)))
/* Set the DER/BER encoding of the ASN.1 BIT_STRING header. /* Set the DER/BER encoding of the ASN.1 BIT_STRING header.
* *
* len Length of data to encode. * len Length of data to encode.
@@ -1066,8 +1065,8 @@ static word32 SetBitString16Bit(word16 val, byte* output)
return idx; return idx;
} }
#endif /* WOLFSSL_CERT_EXT */ #endif /* WOLFSSL_CERT_EXT */
#endif /* !NO_RSA && (WOLFSSL_CERT_GEN || (WOLFSSL_KEY_GEN && #endif /* !NO_RSA || HAVE_ECC || HAVE_ED25519 */
!HAVE_USER_RSA)) */ #endif /* WOLFSSL_CERT_GEN || WOLFSSL_KEY_GEN */
@@ -2177,6 +2176,8 @@ int wc_CheckPrivateKey(byte* key, word32 keySz, DecodedCert* der)
ret = 0; ret = 0;
} }
(void)keySz;
return ret; return ret;
} }

View File

@@ -920,7 +920,8 @@ int wolfcrypt_test(void* args)
#endif /* NO_MAIN_DRIVER */ #endif /* NO_MAIN_DRIVER */
/* helper to save DER, convert to PEM and save PEM */ /* helper to save DER, convert to PEM and save PEM */
#if defined(WOLFSSL_KEY_GEN) || defined(WOLFSSL_CERT_GEN) #if !defined(NO_ASN) && (!defined(NO_RSA) || defined(HAVE_ECC)) && \
(defined(WOLFSSL_KEY_GEN) || defined(WOLFSSL_CERT_GEN))
#if !defined(NO_FILESYSTEM) && !defined(NO_WRITE_TEMP_FILES) #if !defined(NO_FILESYSTEM) && !defined(NO_WRITE_TEMP_FILES)
#define SaveDerAndPem(d, dSz, p, pSz, fD, fP, pT, eB) _SaveDerAndPem(d, dSz, p, pSz, fD, fP, pT, eB) #define SaveDerAndPem(d, dSz, p, pSz, fD, fP, pT, eB) _SaveDerAndPem(d, dSz, p, pSz, fD, fP, pT, eB)