mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-29 18:27:29 +02:00
dtls13: fix: use dtls label to derive ExportKey/Resumption secrets
This commit is contained in:
19
src/tls13.c
19
src/tls13.c
@ -885,9 +885,19 @@ int Tls13_Exporter(WOLFSSL* ssl, unsigned char *out, size_t outLen,
|
||||
const byte* protocol = tls13ProtocolLabel;
|
||||
word32 protocolLen = TLS13_PROTOCOL_LABEL_SZ;
|
||||
|
||||
if (ssl->version.minor != TLSv1_3_MINOR)
|
||||
if (ssl->options.dtls && ssl->version.minor != DTLSv1_3_MINOR)
|
||||
return VERSION_ERROR;
|
||||
|
||||
if (!ssl->options.dtls && ssl->version.minor != TLSv1_3_MINOR)
|
||||
return VERSION_ERROR;
|
||||
|
||||
#ifdef WOLFSSL_DTLS13
|
||||
if (ssl->options.dtls) {
|
||||
protocol = dtls13ProtocolLabel;
|
||||
protocolLen = DTLS13_PROTOCOL_LABEL_SZ;
|
||||
}
|
||||
#endif /* WOLFSSL_DTLS13 */
|
||||
|
||||
switch (ssl->specs.mac_algorithm) {
|
||||
#ifndef NO_SHA256
|
||||
case sha256_mac:
|
||||
@ -1166,6 +1176,13 @@ int DeriveResumptionPSK(WOLFSSL* ssl, byte* nonce, byte nonceLen, byte* secret)
|
||||
|
||||
WOLFSSL_MSG("Derive Resumption PSK");
|
||||
|
||||
#ifdef WOLFSSL_DTLS13
|
||||
if (ssl->options.dtls) {
|
||||
protocol = dtls13ProtocolLabel;
|
||||
protocolLen = DTLS13_PROTOCOL_LABEL_SZ;
|
||||
}
|
||||
#endif /* WOLFSSL_DTLS13 */
|
||||
|
||||
switch (ssl->specs.mac_algorithm) {
|
||||
#ifndef NO_SHA256
|
||||
case sha256_mac:
|
||||
|
Reference in New Issue
Block a user