aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-zbee-nwk-gp.c
diff options
context:
space:
mode:
authorJulien Staub <atsju2@yahoo.fr>2018-07-02 14:34:28 +0200
committerPeter Wu <peter@lekensteyn.nl>2018-07-02 15:52:26 +0000
commit4572b77148828d87e1eab2aadd8dafa4549d7146 (patch)
treecf45ca1c768855d65851b788b7f092910b817316 /epan/dissectors/packet-zbee-nwk-gp.c
parent53e04b621caa00c5cd5641d2fb8eb7e2783f85bd (diff)
WSUTIL: create phtole32 and 64 functions
Change-Id: I15c3c40665ccab1e60057837ffce5bae50d1b52c Reviewed-on: https://code.wireshark.org/review/28567 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Diffstat (limited to 'epan/dissectors/packet-zbee-nwk-gp.c')
-rw-r--r--epan/dissectors/packet-zbee-nwk-gp.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/epan/dissectors/packet-zbee-nwk-gp.c b/epan/dissectors/packet-zbee-nwk-gp.c
index 18a7830514..56ee9ad082 100644
--- a/epan/dissectors/packet-zbee-nwk-gp.c
+++ b/epan/dissectors/packet-zbee-nwk-gp.c
@@ -21,6 +21,7 @@
#include <epan/prefs.h>
#include <epan/uat.h>
#include <wsutil/bits_ctz.h>
+#include <wsutil/pint.h>
#include "packet-zbee.h"
#include "packet-zbee-nwk.h"
#include "packet-zbee-security.h"
@@ -1564,19 +1565,11 @@ zbee_gp_make_nonce(zbee_nwk_green_power_packet *packet, gchar *nonce)
{
memset(nonce, 0, ZBEE_SEC_CONST_NONCE_LEN);
if (packet->direction == ZBEE_NWK_GP_FC_EXT_DIRECTION_FROM_ZGPD) {
- nonce[0] = (guint8)((packet->source_id) & 0xff);
- nonce[1] = (guint8)((packet->source_id) >> 8 & 0xff);
- nonce[2] = (guint8)((packet->source_id) >> 16 & 0xff);
- nonce[3] = (guint8)((packet->source_id) >> 24 & 0xff);
+ phtole32(nonce, packet->source_id);
}
- nonce[4] = (guint8)((packet->source_id) & 0xff);
- nonce[5] = (guint8)((packet->source_id) >> 8 & 0xff);
- nonce[6] = (guint8)((packet->source_id) >> 16 & 0xff);
- nonce[7] = (guint8)((packet->source_id) >> 24 & 0xff);
- nonce[8] = (guint8)((packet->security_frame_counter) & 0xff);
- nonce[9] = (guint8)((packet->security_frame_counter) >> 8 & 0xff);
- nonce[10] = (guint8)((packet->security_frame_counter) >> 16 & 0xff);
- nonce[11] = (guint8)((packet->security_frame_counter) >> 24 & 0xff);
+ phtole32(nonce+4, packet->source_id);
+ phtole32(nonce+8, packet->security_frame_counter);
+
if ((packet->application_id == ZBEE_NWK_GP_APP_ID_ZGP) && (packet->direction !=
ZBEE_NWK_GP_FC_EXT_DIRECTION_FROM_ZGPD)) {
nonce[12] = (gchar)0xa3;