1 (edited by eli.hughes 2018-12-13 12:46:33)

Topic: AzureIoTHub Example


I am trying to run the AzureIOT Hub client using the ltaest version of WolfSSL and Wolf MQTT from the latest snapshot on github.

1.)  (Build Related) 

It seems there are some possible issue in the build system under windows.     The Solution for the 64-bit build of WolfSSL still builds 32-bit libraries.

Also,   when I setup the projext for a 32-bit build,   calls to wc_GetTime corrupt the stack.   I get a 

"Run-Time Check Failure #2 - Stack around the variable 'lTime' was corrupted."

around line 245 in azureiothub.c

The only workaround was to add a line like this:

lTime = XTIME(0);

and comment out the call on line line 195 of azureiothub.c

2.)   After #1,   I found that I got an exception in "external.c" (see attached png).

The only fix was to copy the source files for WolfSSL into the MQTT library project and build.


After getting the projects/libraries to build,  I ran azureiothub.exe with visualstudio 2017 with a debugger attached.      The example seems to hang:

AzureIoTHub Client: QoS 1, Use TLS 1
MQTT Net Init: Success (0)
SharedAccessSignature sr=DEMO-IOT-HUB2.azure-devices.net%2fdevices%2fwolftest&sig=HMI1IlcMI5C5%2be8XRxsRMulI%2fXZ2nhqIYABQbmP25eA%3d&se=1544729501
MQTT Init: Success (0)
MQTT TLS Setup (1)

I did change the URI for my own azure account as well as the key.     I got the same results with the stock settings.

When I look in wireshark I can see some DNS queries go out for DEMO-IOT-HUB2.azure-devices.net but nothing else.

What would be the next best step to debug this issue?

Post's attachments

wolferr.png 179.61 kb, 2 downloads since 2018-12-13 

You don't have the permssions to download the attachments of this post.


Re: AzureIoTHub Example


1.)    I did get a proper x64 build setup for the core WolfSSL Library (which solved #2)  but I still needed to work around the wc_GetTime problem.

3.) I was able to get data through.   one thing compounding errors was my internet connection was spotty today.  There were several websites that kept report SSL/TLS problems.     

At this point things are working enough where I can start thinking about porting the IO layer and getting it working on the embedded platform.     It would be nice to know what is going on the with the time function.

Related to the time,    is it absolutely necessary to have correct UTC time?   My embedded system does not have an RTC.


Re: AzureIoTHub Example

Hi eli.hughes,

Are you only testing at this point? If so then you can get around the requirement for correct UTC time for now but you will want to resolve this issue prior to releasing a production product. The way to resolve time on boards that do not have a real time clock is to use a network time server to get a timestamp and then use the internal oscillator to increment time from there while the device is powered on.

To temporarily bypass the time checks you can use wolfSSL_CTX_set_verify(ctx, WOLFSSL_VERIFY_NONE, 0); to turn off verification of certificate date expiration (or before issuance) checks.

- K

Re: AzureIoTHub Example

Thanks for the info.     We are in development mode so this will work the time being.   

I am plumbing this code into a cell modem so I am trying to figure out how much code I actually have to write.