Skip to content

Commit 31ed2a2

Browse files
committed
dtls13: support Authentication and Integrity-Only Cipher Suites
See RFC 9150. To enable the feature use HAVE_NULL_CIPHER compilation flag.
1 parent 5f1ce09 commit 31ed2a2

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

src/dtls13.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,12 @@ static int Dtls13EncryptDecryptRecordNumber(WOLFSSL* ssl, byte* seq,
301301
byte mask[DTLS13_RN_MASK_SIZE];
302302
int ret;
303303

304+
#ifdef HAVE_NULL_CIPHER
305+
/* Do not encrypt record numbers with null cipher. See RFC 9150 Sec 9 */
306+
if (ssl->specs.bulk_cipher_algorithm == wolfssl_cipher_null)
307+
return 0;
308+
#endif /*HAVE_NULL_CIPHER */
309+
304310
ret = Dtls13GetRnMask(ssl, ciphertext, mask, dir);
305311
if (ret != 0)
306312
return ret;
@@ -2266,6 +2272,15 @@ int Dtls13SetRecordNumberKeys(WOLFSSL* ssl, enum encrypt_side side)
22662272
}
22672273
#endif /* HAVE_CHACHA */
22682274

2275+
#ifdef HAVE_NULL_CIPHER
2276+
if (ssl->specs.bulk_cipher_algorithm == wolfssl_cipher_null) {
2277+
#ifdef WOLFSSL_DEBUG_TLS
2278+
WOLFSSL_MSG("Skipping Record Number key provisioning with null cipher");
2279+
#endif /* WOLFSSL_DEBUG_TLS */
2280+
return 0;
2281+
}
2282+
#endif /* HAVE_NULL_CIPHER */
2283+
22692284
return NOT_COMPILED_IN;
22702285
}
22712286

0 commit comments

Comments
 (0)