/* Creates a nonce and decrypts secured ZigBee GP payload. */
static gboolean zbee_gp_decrypt_payload(zbee_nwk_green_power_packet *packet, const gchar *enc_buffer, const gchar offset, guint8 *dec_buffer, guint payload_len, guint mic_len, guint8 *key)
/* Creates a nonce and decrypts secured ZigBee GP payload. */
static gboolean zbee_gp_decrypt_payload(zbee_nwk_green_power_packet *packet, const gchar *enc_buffer, const gchar offset, guint8 *dec_buffer, guint payload_len, guint mic_len, guint8 *key)
{
    guint8 *key_buffer = key;
    guint8 nonce[ZBEE_SEC_CONST_NONCE_LEN];
    zbee_gp_make_nonce(packet, nonce);
    if (zbee_sec_ccm_decrypt(key_buffer, nonce, enc_buffer, enc_buffer + offset, dec_buffer, offset, payload_len,
        mic_len)) {
        return TRUE;
    }
    return FALSE;
}