Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update revision of nrf_802154 #1667

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions nrf_802154/doc/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ Notable changes
* The internal implementation of *notification* module is selected by the :c:macro:`NRF_802154_NOTIFICATION_IMPL` configuration macro.
The internal implementation of *request* module is selected by the :c:macro:`NRF_802154_REQUEST_IMPL` configuration macro.
* Introduced limited support for receiving and transmitting multipurpose frames. (KRKNWK-19492)
* The driver no longer inserts HT2 termination into authenticated Enh-Acks when Information Element injection is performed.
When a frame has Header IEs, no Payload IEs, and no MAC payload, HT2 will not be inserted regardless of the frame security field. (KRKNWK-16856)

Added
=====
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,35 +416,6 @@ static void ie_header_set(const uint8_t * p_ie_data,
#endif
}

static uint8_t ie_header_terminate(const uint8_t * p_ie_data,
uint8_t ie_data_len,
nrf_802154_frame_parser_data_t * p_ack_data)
{
if (p_ie_data == NULL)
{
// No IEs to terminate.
return 0U;
}

if ((nrf_802154_frame_parser_security_enabled_bit_is_set(p_ack_data) == false) ||
(nrf_802154_frame_parser_sec_ctrl_sec_lvl_get(p_ack_data) == SECURITY_LEVEL_NONE))
{
// This code assumes that neither regular frame payload nor Payload IEs can be set by the
// driver. Therefore without security, the Ack has no payload, so termination is not necessary.
return 0U;
}

uint8_t * p_ack_ie = (uint8_t *)p_ack_data->p_frame + p_ack_data->helper.aux_sec_hdr_end_offset;
uint8_t ie_hdr_term[IE_HEADER_SIZE];

NRF_802154_ASSERT(p_ack_ie != NULL);

host_16_to_little((IE_HT2) << IE_HEADER_ELEMENT_ID_OFFSET, ie_hdr_term);

memcpy(p_ack_ie + ie_data_len, ie_hdr_term, sizeof(ie_hdr_term));
return sizeof(ie_hdr_term);
}

/***************************************************************************************************
* @section Authentication and encryption transformation
**************************************************************************************************/
Expand Down Expand Up @@ -543,8 +514,8 @@ static void ie_process(const nrf_802154_frame_parser_data_t * p_frame_data)
ie_header_set(mp_ie_data, m_ie_data_len, &m_ack_data);
m_ack[PHR_OFFSET] += m_ie_data_len;

// Terminate the IE header if needed.
m_ack[PHR_OFFSET] += ie_header_terminate(mp_ie_data, m_ie_data_len, &m_ack_data) + FCS_SIZE;
// Add space for the FCS field.
m_ack[PHR_OFFSET] += FCS_SIZE;

bool result = nrf_802154_frame_parser_valid_data_extend(&m_ack_data,
m_ack[PHR_OFFSET] + PHR_SIZE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ static bool sec_ctrl_parse(nrf_802154_frame_parser_data_t * p_parser_data)
if (nrf_802154_frame_parser_security_enabled_bit_is_set(p_parser_data) == false)
{
p_parser_data->helper.aux_sec_hdr_end_offset = offset;
p_parser_data->helper.mic_size = 0;
return true;
}

Expand Down
29 changes: 15 additions & 14 deletions nrf_802154/driver/src/mac_features/nrf_802154_frame_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -1016,6 +1016,19 @@ static inline const uint8_t * nrf_802154_frame_parser_mfr_get(
return &p_parser_data->p_frame[offset];
}

/**
* @brief Gets the length of the MIC field.
*
* @param[in] p_parser_data Pointer to a frame parser data.
*
* @returns Length of the MIC field.
*/
static inline uint8_t nrf_802154_frame_parser_mic_size_get(
const nrf_802154_frame_parser_data_t * p_parser_data)
{
return p_parser_data->helper.mic_size;
}

/**
* @brief Gets the length of the MAC payload.
*
Expand All @@ -1026,8 +1039,9 @@ static inline const uint8_t * nrf_802154_frame_parser_mfr_get(
static inline uint8_t nrf_802154_frame_parser_mac_payload_length_get(
const nrf_802154_frame_parser_data_t * p_parser_data)
{
uint8_t mic_len = nrf_802154_frame_parser_mic_size_get(p_parser_data);
uint8_t payload_start = nrf_802154_frame_parser_mac_payload_offset_get(p_parser_data);
uint8_t payload_end = nrf_802154_frame_parser_mfr_offset_get(p_parser_data);
uint8_t payload_end = nrf_802154_frame_parser_mfr_offset_get(p_parser_data) - mic_len;

return payload_end - payload_start;
}
Expand All @@ -1053,19 +1067,6 @@ static inline uint8_t nrf_802154_frame_parser_mac_header_length_get(
return mhr_end - mhr_start;
}

/**
* @brief Gets the length of the MIC field.
*
* @param[in] p_parser_data Pointer to a frame parser data.
*
* @returns Length of the MIC field.
*/
static inline uint8_t nrf_802154_frame_parser_mic_size_get(
const nrf_802154_frame_parser_data_t * p_parser_data)
{
return p_parser_data->helper.mic_size;
}

/**
* @brief Gets the end offset of the destination addressing section.
*
Expand Down
3 changes: 1 addition & 2 deletions nrf_802154/driver/src/nrf_802154_encrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,13 @@ static bool a_data_and_m_data_prepare(
// It is assumed that the provided frame has a placeholder of appropriate length for MIC
// at the end. The algorithm inputs should only contain MAC payload, so the MIC placeholder
// of the below length should be removed
uint8_t mic_len = nrf_802154_frame_parser_mic_size_get(p_frame_data);
uint8_t * p_mac_hdr = (uint8_t *)nrf_802154_frame_parser_psdu_get(p_frame_data);
uint8_t mac_hdr_len =
nrf_802154_frame_parser_mac_header_length_get(p_frame_data) + open_payload_len;
uint8_t * p_mac_payload =
(uint8_t *)(nrf_802154_frame_parser_mac_payload_get(p_frame_data) + open_payload_len);
uint8_t mac_payload_len =
nrf_802154_frame_parser_mac_payload_length_get(p_frame_data) - mic_len - open_payload_len;
nrf_802154_frame_parser_mac_payload_length_get(p_frame_data) - open_payload_len;

switch (nrf_802154_frame_parser_sec_ctrl_sec_lvl_get(p_frame_data))
{
Expand Down
Loading