mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-31 19:24:42 +02:00
Build fixes for various TLS 1.3 disable options (RSA, ECC and ED/Curve 25519).
This commit is contained in:
@@ -2896,7 +2896,7 @@ void FreeX509(WOLFSSL_X509* x509)
|
||||
|
||||
#endif /* !NO_DH || HAVE_ECC */
|
||||
|
||||
#if !defined(NO_RSA) || defined(HAVE_ECC)
|
||||
#if !defined(NO_RSA) || defined(HAVE_ECC) || defined(HAVE_ED25519)
|
||||
/* Encode the signature algorithm into buffer.
|
||||
*
|
||||
* hashalgo The hash algorithm.
|
||||
@@ -2911,12 +2911,13 @@ static INLINE void EncodeSigAlg(byte hashAlgo, byte hsType, byte* output)
|
||||
output[0] = hashAlgo;
|
||||
output[1] = ecc_dsa_sa_algo;
|
||||
break;
|
||||
#ifdef HAVE_ED25519
|
||||
#endif
|
||||
#ifdef HAVE_ED25519
|
||||
case ed25519_sa_algo:
|
||||
output[0] = ED25519_SA_MAJOR;
|
||||
output[1] = ED25519_SA_MINOR;
|
||||
(void)hashAlgo;
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
#ifndef NO_RSA
|
||||
case rsa_sa_algo:
|
||||
@@ -4654,7 +4655,7 @@ int AllocKey(WOLFSSL* ssl, int type, void** pKey)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if !defined(NO_RSA) || defined(HAVE_ECC)
|
||||
#if !defined(NO_RSA) || defined(HAVE_ECC) || defined(HAVE_CURVE25519)
|
||||
static int ReuseKey(WOLFSSL* ssl, int type, void* pKey)
|
||||
{
|
||||
int ret = 0;
|
||||
@@ -4675,13 +4676,13 @@ static int ReuseKey(WOLFSSL* ssl, int type, void* pKey)
|
||||
#ifdef HAVE_ED25519
|
||||
case DYNAMIC_TYPE_ED25519:
|
||||
wc_ed25519_free((ed25519_key*)pKey);
|
||||
wc_ed25519_init((ed25519_key*)pKey);
|
||||
ret = wc_ed25519_init((ed25519_key*)pKey);
|
||||
break;
|
||||
#endif /* HAVE_CURVE25519 */
|
||||
#ifdef HAVE_CURVE25519
|
||||
case DYNAMIC_TYPE_CURVE25519:
|
||||
wc_curve25519_free((curve25519_key*)pKey);
|
||||
wc_curve25519_init((curve25519_key*)pKey);
|
||||
ret = wc_curve25519_init((curve25519_key*)pKey);
|
||||
break;
|
||||
#endif /* HAVE_CURVE25519 */
|
||||
#ifndef NO_DH
|
||||
@@ -19691,6 +19692,7 @@ int DecodePrivateKey(WOLFSSL *ssl, word16* length)
|
||||
WOLFSSL_MSG("Using ED25519 private key");
|
||||
|
||||
/* Check it meets the minimum ECC key size requirements. */
|
||||
(void)keySz;
|
||||
if (ED25519_KEY_SIZE < ssl->options.minEccKeySz) {
|
||||
WOLFSSL_MSG("ED25519 key size too small");
|
||||
ERROR_OUT(ECC_KEY_SIZE_E, exit_dpk);
|
||||
|
@@ -5219,6 +5219,7 @@ int ProcessBuffer(WOLFSSL_CTX* ctx, const unsigned char* buff,
|
||||
return WOLFSSL_BAD_FILE;
|
||||
|
||||
(void)ed25519Key;
|
||||
(void)devId;
|
||||
}
|
||||
else if (type == CERT_TYPE) {
|
||||
#ifdef WOLFSSL_SMALL_STACK
|
||||
|
10
src/tls.c
10
src/tls.c
@@ -5056,12 +5056,16 @@ static void TLSX_KeyShare_FreeAll(KeyShareEntry* list, void* heap)
|
||||
while ((current = list) != NULL) {
|
||||
list = current->next;
|
||||
if ((current->group & NAMED_DH_MASK) == 0) {
|
||||
#ifdef HAVE_CURVE25519
|
||||
if (current->group == WOLFSSL_ECC_X25519) {
|
||||
}
|
||||
else
|
||||
#ifdef HAVE_CURVE25519
|
||||
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#ifdef HAVE_ECC
|
||||
wc_ecc_free((ecc_key*)(current->key));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
XFREE(current->key, heap, DYNAMIC_TYPE_PRIVATE_KEY);
|
||||
XFREE(current->ke, heap, DYNAMIC_TYPE_PUBLIC_KEY);
|
||||
|
11
src/tls13.c
11
src/tls13.c
@@ -3856,7 +3856,7 @@ static int SendTls13CertificateRequest(WOLFSSL* ssl, byte* reqCtx,
|
||||
#endif /* NO_WOLFSSL_SERVER */
|
||||
|
||||
#ifndef NO_CERTS
|
||||
#if !defined(NO_RSA) || defined(HAVE_ECC)
|
||||
#if !defined(NO_RSA) || defined(HAVE_ECC) || defined(HAVE_ED25519)
|
||||
/* Encode the signature algorithm into buffer.
|
||||
*
|
||||
* hashalgo The hash algorithm.
|
||||
@@ -3871,13 +3871,14 @@ static INLINE void EncodeSigAlg(byte hashAlgo, byte hsType, byte* output)
|
||||
output[0] = hashAlgo;
|
||||
output[1] = ecc_dsa_sa_algo;
|
||||
break;
|
||||
#ifdef HAVE_ED25519
|
||||
#endif
|
||||
#ifdef HAVE_ED25519
|
||||
/* ED25519: 0x0807 */
|
||||
case ed25519_sa_algo:
|
||||
output[0] = ED25519_SA_MAJOR;
|
||||
output[1] = ED25519_SA_MINOR;
|
||||
(void)hashAlgo;
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
#ifndef NO_RSA
|
||||
/* PSS signatures: 0x080[4-6] */
|
||||
@@ -4838,7 +4839,7 @@ static int DoTls13Certificate(WOLFSSL* ssl, byte* input, word32* inOutIdx,
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if !defined(NO_RSA) || defined(HAVE_ECC)
|
||||
#if !defined(NO_RSA) || defined(HAVE_ECC) || defined(HAVE_ED25519)
|
||||
|
||||
typedef struct Dcv13Args {
|
||||
byte* output; /* not allocated */
|
||||
@@ -6163,7 +6164,7 @@ int DoTls13HandShakeMsgType(WOLFSSL* ssl, byte* input, word32* inOutIdx,
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if !defined(NO_RSA) || defined(HAVE_ECC)
|
||||
#if !defined(NO_RSA) || defined(HAVE_ECC) || defined(HAVE_ED25519)
|
||||
case certificate_verify:
|
||||
WOLFSSL_MSG("processing certificate verify");
|
||||
ret = DoTls13CertificateVerify(ssl, input, inOutIdx, size);
|
||||
|
@@ -2540,7 +2540,7 @@ typedef struct Ciphers {
|
||||
#endif
|
||||
#if defined(BUILD_AES) || defined(BUILD_AESGCM)
|
||||
Aes* aes;
|
||||
#if defined(BUILD_AESGCM) || defined(HAVE_AESCCM)
|
||||
#if defined(BUILD_AESGCM) || defined(HAVE_AESCCM) || defined(WOLFSSL_TLS13)
|
||||
byte* additional;
|
||||
byte* nonce;
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user