Skip to content

Commit c953716

Browse files
Merge pull request #6391 from rizlik/dtls13-label-fix
dtls13: fix: use correct label to derive resumption key
2 parents c26a5f7 + e9303a5 commit c953716

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

src/tls13.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,9 +885,19 @@ int Tls13_Exporter(WOLFSSL* ssl, unsigned char *out, size_t outLen,
885885
const byte* protocol = tls13ProtocolLabel;
886886
word32 protocolLen = TLS13_PROTOCOL_LABEL_SZ;
887887

888-
if (ssl->version.minor != TLSv1_3_MINOR)
888+
if (ssl->options.dtls && ssl->version.minor != DTLSv1_3_MINOR)
889889
return VERSION_ERROR;
890890

891+
if (!ssl->options.dtls && ssl->version.minor != TLSv1_3_MINOR)
892+
return VERSION_ERROR;
893+
894+
#ifdef WOLFSSL_DTLS13
895+
if (ssl->options.dtls) {
896+
protocol = dtls13ProtocolLabel;
897+
protocolLen = DTLS13_PROTOCOL_LABEL_SZ;
898+
}
899+
#endif /* WOLFSSL_DTLS13 */
900+
891901
switch (ssl->specs.mac_algorithm) {
892902
#ifndef NO_SHA256
893903
case sha256_mac:
@@ -1166,6 +1176,13 @@ int DeriveResumptionPSK(WOLFSSL* ssl, byte* nonce, byte nonceLen, byte* secret)
11661176

11671177
WOLFSSL_MSG("Derive Resumption PSK");
11681178

1179+
#ifdef WOLFSSL_DTLS13
1180+
if (ssl->options.dtls) {
1181+
protocol = dtls13ProtocolLabel;
1182+
protocolLen = DTLS13_PROTOCOL_LABEL_SZ;
1183+
}
1184+
#endif /* WOLFSSL_DTLS13 */
1185+
11691186
switch (ssl->specs.mac_algorithm) {
11701187
#ifndef NO_SHA256
11711188
case sha256_mac:

0 commit comments

Comments
 (0)