• AVR Freaks

Hot!Harmony 3 WolfMQTT confusion

Author
Chris79
Starting Member
  • Total Posts : 35
  • Reward points : 0
  • Joined: 2013/12/06 03:20:35
  • Location: 0
  • Status: offline
2020/07/30 05:06:39 (permalink)
0

Harmony 3 WolfMQTT confusion

I am not really sure on the settings that are being generated for WolfMQTT by the configurator, in particular the enable TLS field. I have the settings in the attached mqtt.jpg with TLS enabled, yet when I look in configuration.h I see:
 
/*** wolfMQTT configuration ***/
#define WOLFMQTT_NONBLOCK
#define WOLFMQTT_USER_SETTINGS
// #define WOLFMQTT_NO_TIMEOUT
// #define WOLFMQTT_NO_STDIN_CAP

#define WOLFMQTT_DISCONNECT_CB
#define WOLFMQTT_NO_ERROR_STRINGS
#define WOLFMQTT_V5
#define WOLFMQTT_NO_STDIO

//#define ENABLE_MQTT_TLS

/*** wolMQTT Net Glue configuration ***/
#define WMQTT_NET_GLUE_FORCE_TLS true
#define WMQTT_NET_GLUE_IPV6 false
#define WMQTT_NET_GLUE_MAX_BROKER_NAME 64
#define WMQTT_NET_GLUE_DEBUG_ENABLE false
#define WMQTT_NET_GLUE_ERROR_STRINGS false
#define WMQTT_NET_GLUE_MALLOC malloc
#define WMQTT_NET_GLUE_FREE free
#define WMQTT_NET_SKT_TX_BUFF 2048
#define WMQTT_NET_SKT_RX_BUFF 2048
 
 
Note the enable appears commented out.
 
Additionally I get an error from mqtt_net_glue that it can't start TLS for the generated example (WMQTT_NET_GLUE_START_ENCRYPT_ERR). This despite the example contacting mqtt.eclipse.org on port 1883 (no TLS) and the stack being able to send TLS encrypted email with no issues.
I see there is a force TLS, but I am pretty sure that the stack doesn't implement this as it decides based on the port number.
Are these bugs, or am I missing some setup?

Attached Image(s)

#1

5 Replies Related Threads

    rainad
    Moderator
    • Total Posts : 1399
    • Reward points : 0
    • Joined: 2009/05/01 13:39:25
    • Location: 0
    • Status: offline
    Re: Harmony 3 WolfMQTT confusion 2020/07/31 07:57:43 (permalink)
    0
    If you're referring to 
    //#define ENABLE_MQTT_TLS
    that's because the the MQTT NET_GLUE layer uses directly the Harmony NET_PRES which takes care of the TLS encryption itself (using wolfSSL, of course). That's why wolfMQTT itself doesn't need to make calls into wolfSSL itself to encrypt the connection.
     
    If you're getting WMQTT_NET_GLUE_START_ENCRYPT_ERR error, then the call to NET_PRES_SocketEncryptSocket() fails. Are you trying on port 8883? Does the broker support encrypted connections?
     
     
    #2
    Chris79
    Starting Member
    • Total Posts : 35
    • Reward points : 0
    • Joined: 2013/12/06 03:20:35
    • Location: 0
    • Status: offline
    Re: Harmony 3 WolfMQTT confusion 2020/07/31 08:13:20 (permalink)
    0
    Thanks Rainad, I have since got further along and I am now getting MQTT responses, I am unsure if the problem is a bug in the configuration utility or a reflection of a incorrect configuration of my wolfssl (although TLS email works).
     
    I am using the example template that's generated by the configuration utility, but it doesn't work for me until I change:
    #define WMQTT_NET_GLUE_FORCE_TLS true

    to
    #define WMQTT_NET_GLUE_FORCE_TLS false

     
    The generated example is accessing port 1883 (no TLS), so I am not sure why its attempting to force TLS, is this a bug?
      
    #3
    rainad
    Moderator
    • Total Posts : 1399
    • Reward points : 0
    • Joined: 2009/05/01 13:39:25
    • Location: 0
    • Status: offline
    Re: Harmony 3 WolfMQTT confusion 2020/07/31 11:03:21 (permalink)
    0
    If you try port 1883 and use WMQTT_NET_GLUE_FORCE_TLS, that won't work because the broker won't do any handshake on port 1883.
    If you select port 8883 then WMQTT_NET_GLUE_FORCE_TLS or not should work fine.
     
    P.S. This assumes that the broker accepts TLS connection on port 8883. 
     
    post edited by rainad - 2020/07/31 11:22:47
    #4
    shaun_any
    New Member
    • Total Posts : 10
    • Reward points : 0
    • Joined: 2018/05/21 08:48:40
    • Location: 0
    • Status: offline
    Re: Harmony 3 WolfMQTT confusion 2020/08/05 03:30:32 (permalink)
    0
    Hi,
     
    I've been fighting with the same issue and tracked the problem down to the following,
     
    Starting a new project with the PIC32MZ2048EFM144 (Same a demo project) and copying all the wolfmqtt_demo settings harmony 3 fails to include
    1. mqtt_net_glue.c and mqtt_net_glue.h,
    2. does not update initialization.c netPresCfgs[]
    3. does not generate net_pres_enc_glue.c and net_pres_enc_glue.h
    Adding the above from the demo causes the project to build ok, (I can't run / test this until I build a PCB with the PIC32MZ)
    I then enabled TLS 1.3 support and after fixing errors with needing "HAVE_HKDF" by enabling various SHAxxx & HMAC options this now complies correctly.
     
    I currently have a product that contains the PIC32MX795F512L and was hoping to update this, however all of the above complies to 489k so the PIC32MX is not usable with MQTT + TLS1.3 + USB enabled.
     
    My findings show that although you enable the pres layer and TLS1.3, harmony doesn't enable everything to make things work.
     
    I think the presentation layer issue is a fully blown bug as harmony 2 had the enable encryption checkbox that would then add the flags to include the glue. In Harmony 3 this has been removed and one of the flags can't be set to cause net_pres_ENC_Glue.ftl to add the functions needed to the project.
    #5
    Chris79
    Starting Member
    • Total Posts : 35
    • Reward points : 0
    • Joined: 2013/12/06 03:20:35
    • Location: 0
    • Status: offline
    Re: Harmony 3 WolfMQTT confusion 2020/08/11 03:49:39 (permalink)
    0
    shaun_any
    I've been fighting with the same issue and tracked the problem down to the following,
     
    Starting a new project with the PIC32MZ2048EFM144 (Same a demo project) and copying all the wolfmqtt_demo settings harmony 3 fails to include
    1. mqtt_net_glue.c and mqtt_net_glue.h,
    2. does not update initialization.c netPresCfgs[]
    3. does not generate net_pres_enc_glue.c and net_pres_enc_glue.h



    All these are present in my project, it sounds like you have a configuration issue in the presentation layer instance or MQTT options.
    #6
    Jump to:
    © 2020 APG vNext Commercial Version 4.5