Skip to content

Commit e69639c

Browse files
small fixes:
test for overflow more consistency in setting ech->type simpler hpke check when parsing ech config
1 parent b9e1faf commit e69639c

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

src/ssl_ech.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -547,9 +547,9 @@ int SetEchConfigsEx(WOLFSSL_EchConfig** outputConfigs, void* heap,
547547
ato16(echConfig, &hpkePubkeyLen);
548548
echConfig += 2;
549549

550-
/* hpke public_key */
551-
if (hpkePubkeyLen == 0 || hpkePubkeyLen > HPKE_Npk_MAX ||
552-
hpkePubkeyLen != wc_HpkeKemGetEncLen(workingConfig->kemId)) {
550+
/* hpke public_key
551+
* KEM support will be checked along with the ciphersuites */
552+
if (hpkePubkeyLen != wc_HpkeKemGetEncLen(workingConfig->kemId)) {
553553
ret = BUFFER_E;
554554
break;
555555
}

src/tls13.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3801,6 +3801,7 @@ int EchConfigGetSupportedCipherSuite(WOLFSSL_EchConfig* config)
38013801
int i = 0;
38023802

38033803
if (!wc_HpkeKemIsSupported(config->kemId)) {
3804+
WOLFSSL_MSG("ECH config: KEM not supported");
38043805
return WOLFSSL_FATAL_ERROR;
38053806
}
38063807

@@ -3811,6 +3812,7 @@ int EchConfigGetSupportedCipherSuite(WOLFSSL_EchConfig* config)
38113812
}
38123813
}
38133814

3815+
WOLFSSL_MSG("ECH config: KDF or AEAD not supported");
38143816
return WOLFSSL_FATAL_ERROR;
38153817
}
38163818

@@ -4759,15 +4761,18 @@ int SendTls13ClientHello(WOLFSSL* ssl)
47594761

47604762
/* get size for inner */
47614763
ret = TLSX_GetRequestSize(ssl, client_hello, &args->length);
4764+
4765+
/* set the type to outer */
4766+
args->ech->type = ECH_TYPE_OUTER;
47624767
if (ret != 0)
47634768
return ret;
47644769

4765-
/* set the type to outer */
4766-
args->ech->type = 0;
47674770
/* set innerClientHelloLen to ClientHelloInner + padding + tag */
47684771
args->ech->paddingLen = 31 - ((args->length - 1) % 32);
47694772
args->ech->innerClientHelloLen = args->length +
47704773
args->ech->paddingLen + args->ech->hpke->Nt;
4774+
if (args->ech->innerClientHelloLen > 0xFFFF)
4775+
return BUFFER_E;
47714776
/* set the length back to before we computed ClientHelloInner size */
47724777
args->length = (word32)args->preXLength;
47734778
}

0 commit comments

Comments
 (0)