forked from wolfSSL/wolfssl
macros for conditionally compiling code
This commit is contained in:
@ -1706,17 +1706,13 @@ void FreeCiphers(WOLFSSL* ssl)
|
|||||||
|
|
||||||
void InitCipherSpecs(CipherSpecs* cs)
|
void InitCipherSpecs(CipherSpecs* cs)
|
||||||
{
|
{
|
||||||
|
XMEMSET(cs, 0, sizeof(CipherSpecs));
|
||||||
|
|
||||||
cs->bulk_cipher_algorithm = INVALID_BYTE;
|
cs->bulk_cipher_algorithm = INVALID_BYTE;
|
||||||
cs->cipher_type = INVALID_BYTE;
|
cs->cipher_type = INVALID_BYTE;
|
||||||
cs->mac_algorithm = INVALID_BYTE;
|
cs->mac_algorithm = INVALID_BYTE;
|
||||||
cs->kea = INVALID_BYTE;
|
cs->kea = INVALID_BYTE;
|
||||||
cs->sig_algo = INVALID_BYTE;
|
cs->sig_algo = INVALID_BYTE;
|
||||||
|
|
||||||
cs->hash_size = 0;
|
|
||||||
cs->static_ecdh = 0;
|
|
||||||
cs->key_size = 0;
|
|
||||||
cs->iv_size = 0;
|
|
||||||
cs->block_size = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void InitSuitesHashSigAlgo(Suites* suites, int haveECDSAsig, int haveRSAsig,
|
void InitSuitesHashSigAlgo(Suites* suites, int haveECDSAsig, int haveRSAsig,
|
||||||
@ -1727,6 +1723,7 @@ void InitSuitesHashSigAlgo(Suites* suites, int haveECDSAsig, int haveRSAsig,
|
|||||||
(void)tls1_2;
|
(void)tls1_2;
|
||||||
(void)keySz;
|
(void)keySz;
|
||||||
|
|
||||||
|
#if defined(HAVE_ECC) || defined(HAVE_ED25519)
|
||||||
if (haveECDSAsig) {
|
if (haveECDSAsig) {
|
||||||
#ifdef WOLFSSL_SHA512
|
#ifdef WOLFSSL_SHA512
|
||||||
suites->hashSigAlgo[idx++] = sha512_mac;
|
suites->hashSigAlgo[idx++] = sha512_mac;
|
||||||
@ -1750,6 +1747,7 @@ void InitSuitesHashSigAlgo(Suites* suites, int haveECDSAsig, int haveRSAsig,
|
|||||||
suites->hashSigAlgo[idx++] = ED25519_SA_MINOR;
|
suites->hashSigAlgo[idx++] = ED25519_SA_MINOR;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif /* HAVE_ECC || HAVE_ED25519 */
|
||||||
|
|
||||||
if (haveRSAsig) {
|
if (haveRSAsig) {
|
||||||
#ifdef WC_RSA_PSS
|
#ifdef WC_RSA_PSS
|
||||||
@ -1791,13 +1789,15 @@ void InitSuitesHashSigAlgo(Suites* suites, int haveECDSAsig, int haveRSAsig,
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_ANON
|
||||||
if (haveAnon) {
|
if (haveAnon) {
|
||||||
#ifdef HAVE_ANON
|
|
||||||
suites->hashSigAlgo[idx++] = sha_mac;
|
suites->hashSigAlgo[idx++] = sha_mac;
|
||||||
suites->hashSigAlgo[idx++] = anonymous_sa_algo;
|
suites->hashSigAlgo[idx++] = anonymous_sa_algo;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
(void)haveAnon;
|
||||||
|
(void)haveECDSAsig;
|
||||||
suites->hashSigAlgoSz = (word16)idx;
|
suites->hashSigAlgoSz = (word16)idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1823,6 +1823,7 @@ void InitSuites(Suites* suites, ProtocolVersion pv, int keySz, word16 haveRSA,
|
|||||||
(void)haveNTRU;
|
(void)haveNTRU;
|
||||||
(void)haveStaticECC;
|
(void)haveStaticECC;
|
||||||
(void)haveECC;
|
(void)haveECC;
|
||||||
|
(void)side;
|
||||||
|
|
||||||
if (suites == NULL) {
|
if (suites == NULL) {
|
||||||
WOLFSSL_MSG("InitSuites pointer error");
|
WOLFSSL_MSG("InitSuites pointer error");
|
||||||
@ -1832,6 +1833,7 @@ void InitSuites(Suites* suites, ProtocolVersion pv, int keySz, word16 haveRSA,
|
|||||||
if (suites->setSuites)
|
if (suites->setSuites)
|
||||||
return; /* trust user settings, don't override */
|
return; /* trust user settings, don't override */
|
||||||
|
|
||||||
|
#ifndef NO_WOLFSSL_SERVER
|
||||||
if (side == WOLFSSL_SERVER_END && haveStaticECC) {
|
if (side == WOLFSSL_SERVER_END && haveStaticECC) {
|
||||||
haveRSA = 0; /* can't do RSA with ECDSA key */
|
haveRSA = 0; /* can't do RSA with ECDSA key */
|
||||||
(void)haveRSA; /* some builds won't read */
|
(void)haveRSA; /* some builds won't read */
|
||||||
@ -1841,6 +1843,7 @@ void InitSuites(Suites* suites, ProtocolVersion pv, int keySz, word16 haveRSA,
|
|||||||
haveRSAsig = 0; /* can't have RSA sig if signed by ECDSA */
|
haveRSAsig = 0; /* can't have RSA sig if signed by ECDSA */
|
||||||
(void)haveRSAsig; /* non ecc builds won't read */
|
(void)haveRSAsig; /* non ecc builds won't read */
|
||||||
}
|
}
|
||||||
|
#endif /* !NO_WOLFSSL_SERVER */
|
||||||
|
|
||||||
#ifdef WOLFSSL_DTLS
|
#ifdef WOLFSSL_DTLS
|
||||||
if (pv.major == DTLS_MAJOR) {
|
if (pv.major == DTLS_MAJOR) {
|
||||||
@ -4441,10 +4444,12 @@ int InitSSL(WOLFSSL* ssl, WOLFSSL_CTX* ctx, int writeDup)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_WRITE_DUP
|
||||||
if (writeDup) {
|
if (writeDup) {
|
||||||
/* all done */
|
/* all done */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* hsHashes */
|
/* hsHashes */
|
||||||
ret = InitHandshakeHashes(ssl);
|
ret = InitHandshakeHashes(ssl);
|
||||||
|
@ -1534,19 +1534,23 @@ const byte* OidFromId(word32 id, word32 type, word32* oidSz)
|
|||||||
oid = extExtKeyUsageOid;
|
oid = extExtKeyUsageOid;
|
||||||
*oidSz = sizeof(extExtKeyUsageOid);
|
*oidSz = sizeof(extExtKeyUsageOid);
|
||||||
break;
|
break;
|
||||||
|
#ifndef IGNORE_NAME_CONSTRAINTS
|
||||||
case NAME_CONS_OID:
|
case NAME_CONS_OID:
|
||||||
oid = extNameConsOid;
|
oid = extNameConsOid;
|
||||||
*oidSz = sizeof(extNameConsOid);
|
*oidSz = sizeof(extNameConsOid);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case oidCertAuthInfoType:
|
case oidCertAuthInfoType:
|
||||||
switch (id) {
|
switch (id) {
|
||||||
|
#ifdef HAVE_OCSP
|
||||||
case AIA_OCSP_OID:
|
case AIA_OCSP_OID:
|
||||||
oid = extAuthInfoOcspOid;
|
oid = extAuthInfoOcspOid;
|
||||||
*oidSz = sizeof(extAuthInfoOcspOid);
|
*oidSz = sizeof(extAuthInfoOcspOid);
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
case AIA_CA_ISSUER_OID:
|
case AIA_CA_ISSUER_OID:
|
||||||
oid = extAuthInfoCaIssuerOid;
|
oid = extAuthInfoCaIssuerOid;
|
||||||
*oidSz = sizeof(extAuthInfoCaIssuerOid);
|
*oidSz = sizeof(extAuthInfoCaIssuerOid);
|
||||||
|
Reference in New Issue
Block a user