Skip to content

Commit

Permalink
[config] add guard checks for features that require DTLS/TLS support (o…
Browse files Browse the repository at this point in the history
…penthread#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.
  • Loading branch information
abtink authored Dec 19, 2024
1 parent 0c4b8d7 commit 143ebbf
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/core/coap/coap_secure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@

#include "openthread-core-config.h"

#if OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE && !OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE
#error "CoAP Secure API feature requires `OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE`"
#endif

#if OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE

#include "coap/coap.hpp"
Expand Down
4 changes: 4 additions & 0 deletions src/core/config/openthread-core-config-check.h
Original file line number Diff line number Diff line change
Expand Up @@ -694,4 +694,8 @@
#error "OPENTHREAD_CONFIG_MLE_SEND_LINK_REQUEST_ON_ADV_TIMEOUT is removed, behavior is always applied"
#endif

#ifdef OPENTHREAD_CONFIG_DTLS_ENABLE
#error "OPENTHREAD_CONFIG_DTLS_ENABLE was replaced by OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE"
#endif

#endif // OPENTHREAD_CORE_CONFIG_CHECK_H_
4 changes: 0 additions & 4 deletions src/core/config/secure_transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@
OPENTHREAD_CONFIG_COMMISSIONER_ENABLE || OPENTHREAD_CONFIG_JOINER_ENABLE || OPENTHREAD_CONFIG_BLE_TCAT_ENABLE)
#endif

#ifdef OPENTHREAD_CONFIG_DTLS_ENABLE
#error "OPENTHREAD_CONFIG_DTLS_ENABLE is deprecated please use OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE instead"
#endif

/**
* @}
*/
Expand Down
4 changes: 4 additions & 0 deletions src/core/meshcop/border_agent.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ namespace ot {

namespace MeshCoP {

#if !OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE
#error "Border Agent feature requires `OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE`"
#endif

class BorderAgent : public InstanceLocator, private NonCopyable
{
friend class ot::Notifier;
Expand Down
4 changes: 4 additions & 0 deletions src/core/meshcop/commissioner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ namespace ot {

namespace MeshCoP {

#if !OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE
#error "Commissioner feature requires `OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE`"
#endif

class Commissioner : public InstanceLocator, private NonCopyable
{
friend class Tmf::Agent;
Expand Down
4 changes: 4 additions & 0 deletions src/core/meshcop/joiner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ namespace ot {

namespace MeshCoP {

#if !OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE
#error "Joiner feature requires `OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE`"
#endif

class Joiner : public InstanceLocator, private NonCopyable
{
friend class Tmf::Agent;
Expand Down
4 changes: 4 additions & 0 deletions src/core/radio/ble_secure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ namespace ot {

namespace Ble {

#if !OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE
#error "BLE TCAT feature requires `OPENTHREAD_CONFIG_SECURE_TRANSPORT_ENABLE`"
#endif

class BleSecure : public InstanceLocator, public MeshCoP::Tls::Extension, private NonCopyable
{
public:
Expand Down

0 comments on commit 143ebbf

Please sign in to comment.