Skip to content

Commit d793452

Browse files
authored
Merge pull request #10353 from julek-wolfssl/dtls-13-client-only
DTLS 1.3 client-only minimum: WOLFSSL_DTLS_ONLY + autoconf cascade
2 parents 80c9d3f + a012a8f commit d793452

7 files changed

Lines changed: 56 additions & 9 deletions

File tree

.github/workflows/os-check.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,18 @@ jobs:
108108
'--enable-lms=small,verify-only --enable-xmss=small,verify-only',
109109
'--enable-curve25519=nonblock --enable-ecc=nonblock --enable-sp=yes,nonblock CPPFLAGS="-DWOLFSSL_PUBLIC_MP -DWOLFSSL_DEBUG_NONBLOCK"',
110110
'--enable-certreq --enable-certext --enable-certgen --disable-secure-renegotiation-info CPPFLAGS="-DNO_TLS"',
111+
# Minimal DTLS 1.3 client-only build. The SHA-224/384/512/3
112+
# disables are deliberately omitted: --disable-sha384 alone
113+
# trips a pre-existing wolfSSL bug in
114+
# test_tls13_duplicate_extension (reproducible on clean master).
115+
'--enable-dtls13 --disable-tlsv12 --disable-oldtls --disable-rsa --disable-dh
116+
--disable-aescbc --disable-aesecb --disable-md5 --disable-chacha
117+
--disable-poly1305 --disable-errorstrings --disable-asn-print
118+
--disable-eccshamir --disable-base64encode --disable-coding --disable-sni
119+
--enable-aesgcm=small --enable-sp-math --enable-sp=smallec256 --disable-sp-asm
120+
CPPFLAGS=''-DNO_WOLFSSL_SERVER -DWOLFSSL_NO_TLS12 -DNO_SESSION_CACHE
121+
-DWOLFSSL_AES_NO_UNROLL -DUSE_SLOW_SHA256 -DWOLFSSL_NO_ASYNC_IO
122+
-DWOLFSSL_DTLS_ONLY'' ',
111123
]
112124
name: make check linux
113125
if: github.repository_owner == 'wolfssl'

configure.ac

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5631,9 +5631,26 @@ AC_ARG_ENABLE([dtls13],
56315631
)
56325632
if test "x$ENABLED_DTLS13" = "xyes"
56335633
then
5634-
if test "x$ENABLED_DTLS" != "xyes" || test "x$ENABLED_TLS13" != "xyes"
5634+
# DTLSv1.3 implies TLS 1.3 and DTLS; auto-enable, but don't
5635+
# override explicit --disable.
5636+
if test "x$enable_tls13" = "xno" || test "x$ENABLED_TLS13" = "xno"
56355637
then
5636-
AC_MSG_ERROR([You need to enable both DTLS and TLSv1.3 to use DTLSv1.3])
5638+
AC_MSG_ERROR([--enable-dtls13 requires TLS 1.3, but TLS 1.3 is disabled])
5639+
fi
5640+
if test "x$ENABLED_TLS13" != "xyes"
5641+
then
5642+
AC_MSG_NOTICE([DTLSv1.3 is enabled, enabling TLS 1.3])
5643+
ENABLED_TLS13=yes
5644+
fi
5645+
if test "x$enable_dtls" = "xno"
5646+
then
5647+
AC_MSG_ERROR([--enable-dtls13 requires DTLS, but --disable-dtls was given])
5648+
fi
5649+
if test "x$ENABLED_DTLS" != "xyes"
5650+
then
5651+
AC_MSG_NOTICE([DTLSv1.3 is enabled, enabling DTLS])
5652+
AM_CFLAGS="$AM_CFLAGS -DWOLFSSL_DTLS"
5653+
ENABLED_DTLS=yes
56375654
fi
56385655
if test "x$ENABLED_SEND_HRR_COOKIE" = "xundefined"
56395656
then
@@ -8134,6 +8151,11 @@ then
81348151
# disable TLS 1.3
81358152
ENABLED_TLS13=no
81368153
fi
8154+
# DTLSv1.3 cannot survive a downgrade of TLS 1.3.
8155+
if test "x$ENABLED_DTLS13" = "xyes" && test "x$ENABLED_TLS13" = "xno"
8156+
then
8157+
AC_MSG_ERROR([--enable-dtls13 requires TLS 1.3, but TLS 1.3 was disabled by an earlier prerequisite check (no key-exchange or signature algorithms reachable). Enable at least one of ECC, RSA+DH, Curve25519+Ed25519, Curve448+Ed448, PSK, or ML-KEM.])
8158+
fi
81378159
if test "$ENABLED_TLS13" = "yes" && (test "x$ENABLED_ECC" = "xyes" || \
81388160
test "$ENABLED_DH" != "no" || test "x$ENABLED_MLKEM" = "xyes")
81398161
then

src/internal.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2703,8 +2703,10 @@ int InitSSL_Ctx(WOLFSSL_CTX* ctx, WOLFSSL_METHOD* method, void* heap)
27032703
}
27042704
#endif
27052705
#else
2706-
ctx->CBIORecv = EmbedReceive;
2707-
ctx->CBIOSend = EmbedSend;
2706+
#ifndef WOLFSSL_DTLS_ONLY
2707+
ctx->CBIORecv = EmbedReceive;
2708+
ctx->CBIOSend = EmbedSend;
2709+
#endif
27082710
#ifdef WOLFSSL_SESSION_EXPORT
27092711
ctx->CBGetPeer = EmbedGetPeer;
27102712
ctx->CBSetPeer = EmbedSetPeer;

src/wolfio.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ int SslBioSend(WOLFSSL* ssl, char *buf, int sz, void *ctx)
402402

403403
#ifdef USE_WOLFSSL_IO
404404

405+
#ifndef WOLFSSL_DTLS_ONLY
405406
/* The receive embedded callback
406407
* return : nb bytes read, or error
407408
*/
@@ -450,6 +451,7 @@ int EmbedSend(WOLFSSL* ssl, char *buf, int sz, void *ctx)
450451

451452
return sent;
452453
}
454+
#endif /* !WOLFSSL_DTLS_ONLY */
453455

454456

455457
#ifdef WOLFSSL_DTLS

wolfcrypt/src/aes.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,8 +1920,9 @@ static WARN_UNUSED_RESULT word32 col_mul(
19201920
return GETBYTE(t, ia) ^ GETBYTE(t, ib) ^ t3 ^ tm;
19211921
}
19221922

1923-
#if defined(HAVE_AES_CBC) || defined(HAVE_AES_ECB) || \
1924-
defined(WOLFSSL_AES_DIRECT)
1923+
#if defined(HAVE_AES_DECRYPT) && \
1924+
(defined(HAVE_AES_CBC) || defined(HAVE_AES_ECB) || \
1925+
defined(WOLFSSL_AES_DIRECT))
19251926
static WARN_UNUSED_RESULT word32 inv_col_mul(
19261927
word32 t, int i9, int ib, int id, int ie)
19271928
{
@@ -1932,7 +1933,7 @@ static WARN_UNUSED_RESULT word32 inv_col_mul(
19321933
byte t0 = t9 ^ tb ^ td;
19331934
return t0 ^ AES_XTIME(AES_XTIME(AES_XTIME(t0 ^ te) ^ td ^ te) ^ tb ^ te);
19341935
}
1935-
#endif /* HAVE_AES_CBC || WOLFSSL_AES_DIRECT */
1936+
#endif /* HAVE_AES_DECRYPT && (HAVE_AES_CBC || HAVE_AES_ECB || WOLFSSL_AES_DIRECT) */
19361937
#endif /* WOLFSSL_AES_SMALL_TABLES */
19371938
#endif
19381939
#endif

wolfssl/wolfcrypt/settings.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4669,6 +4669,10 @@ extern void uITRON4_free(void *p) ;
46694669
#error "DTLS v1.3 requires both WOLFSSL_TLS13 and WOLFSSL_DTLS"
46704670
#endif
46714671

4672+
#if defined(WOLFSSL_DTLS_ONLY) && !defined(WOLFSSL_DTLS)
4673+
#error "WOLFSSL_DTLS_ONLY requires WOLFSSL_DTLS"
4674+
#endif
4675+
46724676
#if defined(WOLFSSL_QUIC) && defined(WOLFSSL_CALLBACKS)
46734677
#error WOLFSSL_QUIC is incompatible with WOLFSSL_CALLBACKS.
46744678
#endif

wolfssl/wolfio.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,8 +674,10 @@ WOLFSSL_LOCAL int SslBioReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx);
674674
/* default IO callbacks */
675675

676676
#ifdef WOLFSSL_API_PREFIX_MAP
677-
#define EmbedReceive wolfSSL_EmbedReceive
678-
#define EmbedSend wolfSSL_EmbedSend
677+
#ifndef WOLFSSL_DTLS_ONLY
678+
#define EmbedReceive wolfSSL_EmbedReceive
679+
#define EmbedSend wolfSSL_EmbedSend
680+
#endif
679681
#ifdef WOLFSSL_DTLS
680682
#define EmbedReceiveFrom wolfSSL_EmbedReceiveFrom
681683
#define EmbedSendTo wolfSSL_EmbedSendTo
@@ -686,8 +688,10 @@ WOLFSSL_LOCAL int SslBioReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx);
686688
#endif /* WOLFSSL_DTLS */
687689
#endif /* WOLFSSL_API_PREFIX_MAP */
688690

691+
#ifndef WOLFSSL_DTLS_ONLY
689692
WOLFSSL_API int EmbedReceive(WOLFSSL* ssl, char* buf, int sz, void* ctx);
690693
WOLFSSL_API int EmbedSend(WOLFSSL* ssl, char* buf, int sz, void* ctx);
694+
#endif
691695

692696
#ifdef WOLFSSL_DTLS
693697
#ifdef NUCLEUS_PLUS_2_3

0 commit comments

Comments
 (0)