Bluetooth: controller: Restrict enc to 1M 27 bytes PDU on nRF51

Restrict encryption support on nRF51 series SoC to Bluetooth
LE 1M PHY and max. 27 bytes PDU. If 251 bytes PDU using Data
Length Update procedure is desired, then LE Encryption
procedure will not be supported (until a software CCM is
implemented in future).

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
This commit is contained in:
Vinayak Kariappa Chettimada 2017-05-30 00:44:19 +02:00 committed by Carles Cufi
commit d055252ea9
4 changed files with 21 additions and 6 deletions

View file

@ -101,6 +101,7 @@ if BLUETOOTH_CONN
config BLUETOOTH_CONTROLLER_LE_ENC
bool
depends on !BLUETOOTH_CONTROLLER_DATA_LENGTH_CLEAR && !BLUETOOTH_CONTROLLER_PHY_2M_NRF
default y
# Enable support for Bluetooth v4.0 LE Encryption feature in the
# Controller.
@ -123,7 +124,8 @@ config BLUETOOTH_CONTROLLER_DATA_LENGTH_MAX
depends on BLUETOOTH_CONTROLLER_DATA_LENGTH
int
default 27
range 27 251
range 27 251 if SOC_SERIES_NRF52X || BLUETOOTH_CONTROLLER_DATA_LENGTH_CLEAR
range 27 27
help
Set the maximum data length of PDU supported in the Controller.
@ -151,6 +153,14 @@ config BLUETOOTH_CONTROLLER_ADVANCED_FEATURES
menu "Advanced features"
visible if BLUETOOTH_CONTROLLER_ADVANCED_FEATURES
config BLUETOOTH_CONTROLLER_DATA_LENGTH_CLEAR
bool "Data Length Support (Cleartext only)"
depends on BLUETOOTH_CONTROLLER_DATA_LENGTH && SOC_SERIES_NRF51X
help
Enable support for Bluetooh v4.2 LE Data Length Update procedure, upto
251 byte cleartext payloads in the Controller. Encrypted connections
are not supported.
if BLUETOOTH_CONTROLLER_PHY
config BLUETOOTH_CONTROLLER_PHY_2M
@ -161,7 +171,7 @@ config BLUETOOTH_CONTROLLER_PHY_2M
Enable support for Bluetooth 5.0 2Mbps PHY in the Controller.
config BLUETOOTH_CONTROLLER_PHY_2M_NRF
bool "2Mbps Nordic Semiconductor PHY Support (Open Text)"
bool "2Mbps Nordic Semiconductor PHY Support (Cleartext only)"
depends on SOC_SERIES_NRF51X
select BLUETOOTH_CONTROLLER_PHY_2M
help

View file

@ -134,7 +134,7 @@ void radio_pkt_configure(u8_t bits_len, u8_t max_len, u8_t flags)
extra = 0;
/* nRF51 supports only 27 byte PDU when using h/w CCM for encryption. */
if (dc) {
if (!IS_ENABLED(CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH_CLEAR) && dc) {
bits_len = 5;
}
#elif defined(CONFIG_SOC_SERIES_NRF52X)

View file

@ -6853,7 +6853,10 @@ static void prepare_pdu_data_tx(struct connection *conn,
}
_pdu_data_tx->rfu = 0;
#if !defined(CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH_CLEAR)
_pdu_data_tx->resv = 0;
#endif /* !CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH_CLEAR */
*pdu_data_tx = _pdu_data_tx;
}

View file

@ -11,10 +11,10 @@
#define BDADDR_SIZE 6
/* PDU Sizes */
#define PDU_EM_SIZE_MAX 3
#define PDU_AC_SIZE_OVERHEAD 2
#define PDU_AC_PAYLOAD_SIZE_MAX 37
#define PDU_AC_SIZE_MAX (PDU_AC_PAYLOAD_SIZE_MAX + PDU_AC_SIZE_OVERHEAD)
#define PDU_AC_SIZE_MAX (offsetof(struct pdu_adv, payload) + \
PDU_AC_PAYLOAD_SIZE_MAX)
#define PDU_EM_SIZE_MAX offsetof(struct pdu_data, payload)
struct pdu_adv_payload_adv_ind {
u8_t addr[BDADDR_SIZE];
@ -281,7 +281,9 @@ struct pdu_data {
u8_t len:8;
#if !defined(CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH_CLEAR)
u8_t resv:8; /* TODO: remove nRF specific code */
#endif /* !CONFIG_BLUETOOTH_CONTROLLER_DATA_LENGTH_CLEAR */
union {
u8_t lldata[1];