net/ieee802154: aux sec header frame counter is in little endian

So manipulating it requires to be ready to swap it if the CPU is BE.

Change-Id: I8d657c31cecfc9f3fcd010efbb6d090bf021f5f5
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2017-04-12 16:58:38 +02:00 committed by Jukka Rissanen
commit 62b710384d

View file

@ -644,7 +644,7 @@ uint8_t *generate_aux_security_hdr(struct ieee802154_security_ctx *sec_ctx,
aux_sec->control.key_id_mode = sec_ctx->key_mode;
aux_sec->control.reserved = 0;
aux_sec->frame_counter = sec_ctx->frame_counter;
aux_sec->frame_counter = sys_cpu_to_le32(sec_ctx->frame_counter);
return p_buf + IEEE802154_SECURITY_CF_LENGTH +
IEEE802154_SECURITY_FRAME_COUNTER_LENGTH;
@ -920,7 +920,8 @@ bool ieee802154_decipher_data_frame(struct net_if *iface, struct net_buf *buf,
net_nbuf_ll_reserve(buf),
net_buf_frags_len(buf),
net_nbuf_ll_src(buf)->addr,
mpdu->mhr.aux_sec->frame_counter)) {
sys_le32_to_cpu(
mpdu->mhr.aux_sec->frame_counter))) {
NET_ERR("Could not decipher the frame");
return false;
}