Skip to content

Commit 143ebbf

Browse files
authored
[config] add guard checks for features that require DTLS/TLS support (openthread#11068)
This commit adds guard checks for Border Agent, Commissioner, Joiner, and CoAP Secure API features that use Secure Transport (DTLS/TLS) to ensure `OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE` is enabled. It also moves the deprecation check for the earlier DTLS configuration to `openthread-core-config-check.h` to be consistent with other removed/deprecated configurations.
1 parent 0c4b8d7 commit 143ebbf

7 files changed

+24
-4
lines changed

src/core/coap/coap_secure.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131

3232
#include "openthread-core-config.h"
3333

34+
#if OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE && !OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE
35+
#error "CoAP Secure API feature requires `OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE`"
36+
#endif
37+
3438
#if OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE
3539

3640
#include "coap/coap.hpp"

src/core/config/openthread-core-config-check.h

+4
Original file line numberDiff line numberDiff line change
@@ -694,4 +694,8 @@
694694
#error "OPENTHREAD_CONFIG_MLE_SEND_LINK_REQUEST_ON_ADV_TIMEOUT is removed, behavior is always applied"
695695
#endif
696696

697+
#ifdef OPENTHREAD_CONFIG_DTLS_ENABLE
698+
#error "OPENTHREAD_CONFIG_DTLS_ENABLE was replaced by OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE"
699+
#endif
700+
697701
#endif // OPENTHREAD_CORE_CONFIG_CHECK_H_

src/core/config/secure_transport.h

-4
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,6 @@
6868
OPENTHREAD_CONFIG_COMMISSIONER_ENABLE || OPENTHREAD_CONFIG_JOINER_ENABLE || OPENTHREAD_CONFIG_BLE_TCAT_ENABLE)
6969
#endif
7070

71-
#ifdef OPENTHREAD_CONFIG_DTLS_ENABLE
72-
#error "OPENTHREAD_CONFIG_DTLS_ENABLE is deprecated please use OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE instead"
73-
#endif
74-
7571
/**
7672
* @}
7773
*/

src/core/meshcop/border_agent.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ namespace ot {
5656

5757
namespace MeshCoP {
5858

59+
#if !OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE
60+
#error "Border Agent feature requires `OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE`"
61+
#endif
62+
5963
class BorderAgent : public InstanceLocator, private NonCopyable
6064
{
6165
friend class ot::Notifier;

src/core/meshcop/commissioner.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ namespace ot {
6363

6464
namespace MeshCoP {
6565

66+
#if !OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE
67+
#error "Commissioner feature requires `OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE`"
68+
#endif
69+
6670
class Commissioner : public InstanceLocator, private NonCopyable
6771
{
6872
friend class Tmf::Agent;

src/core/meshcop/joiner.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ namespace ot {
5959

6060
namespace MeshCoP {
6161

62+
#if !OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE
63+
#error "Joiner feature requires `OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE`"
64+
#endif
65+
6266
class Joiner : public InstanceLocator, private NonCopyable
6367
{
6468
friend class Tmf::Agent;

src/core/radio/ble_secure.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ namespace ot {
4848

4949
namespace Ble {
5050

51+
#if !OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE
52+
#error "BLE TCAT feature requires `OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE`"
53+
#endif
54+
5155
class BleSecure : public InstanceLocator, public MeshCoP::Tls::Extension, private NonCopyable
5256
{
5357
public:

0 commit comments

Comments
 (0)