Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mbedtls_time_t does not name a type in ssl.h #522

Closed
janjongboom opened this issue Jun 27, 2016 · 7 comments
Closed

mbedtls_time_t does not name a type in ssl.h #522

janjongboom opened this issue Jun 27, 2016 · 7 comments
Labels

Comments

@janjongboom
Copy link

Trying to compile a program that depends on mbed TLS on a Raspberry Pi Zero...

[98/126] Building CXX object ym/mbed-client-mbedtls/source/CMakeFiles/mbed-client-mbedtl...mbed-client-gateway/yotta_modules/mbed-client-mbedtls/source/m2mconnectionsecurity.cpp.o
FAILED: /usr/bin/c++   -DYOTTA_MODULE_NAME=mbed-client-mbedtls -std=gnu++11 -O2 -g -DNDEBUG -I/home/pi/connector-loriot/mbed-client-gateway -I/home/pi/connector-loriot/mbed-client-gateway/yotta_modules/mbed-client -I/home/pi/connector-loriot/mbed-client-gateway/yotta_modules/mbed-client-c -I/home/pi/connector-loriot/mbed-client-gateway/yotta_modules/mbed-trace -I/home/pi/connector-loriot/mbed-client-gateway/yotta_modules/mbed-client-linux -I/home/pi/connector-loriot/mbed-client-gateway/yotta_modules/mbed-client-mbedtls -I/home/pi/connector-loriot/mbed-client-gateway/yotta_modules/nanostack-libservice -I/home/pi/connector-loriot/mbed-client-gateway/yotta_modules/mbedtls -I/home/pi/connector-loriot/mbed-client-gateway/yotta_modules/mbed-client-mbedtls/source    -include "/home/pi/connector-loriot/mbed-client-gateway/build/arm-linux-native/yotta_config.h" -MMD -MT ym/mbed-client-mbedtls/source/CMakeFiles/mbed-client-mbedtls.dir/home/pi/connector-loriot/mbed-client-gateway/yotta_modules/mbed-client-mbedtls/source/m2mconnectionsecurity.cpp.o -MF ym/mbed-client-mbedtls/source/CMakeFiles/mbed-client-mbedtls.dir/home/pi/connector-loriot/mbed-client-gateway/yotta_modules/mbed-client-mbedtls/source/m2mconnectionsecurity.cpp.o.d -o ym/mbed-client-mbedtls/source/CMakeFiles/mbed-client-mbedtls.dir/home/pi/connector-loriot/mbed-client-gateway/yotta_modules/mbed-client-mbedtls/source/m2mconnectionsecurity.cpp.o -c /home/pi/connector-loriot/mbed-client-gateway/yotta_modules/mbed-client-mbedtls/source/m2mconnectionsecurity.cpp
In file included from /home/pi/connector-loriot/mbed-client-gateway/yotta_modules/mbedtls/mbedtls/debug.h:32:0,
                 from /home/pi/connector-loriot/mbed-client-gateway/yotta_modules/mbed-client-mbedtls/mbed-client-mbedtls/m2mconnectionsecuritypimpl.h:26,
                 from /home/pi/connector-loriot/mbed-client-gateway/yotta_modules/mbed-client-mbedtls/source/m2mconnectionsecurity.cpp:22:
/home/pi/connector-loriot/mbed-client-gateway/yotta_modules/mbedtls/mbedtls/ssl.h:545:5: error: ‘mbedtls_time_t’ does not name a type
     mbedtls_time_t start;       /*!< starting time      */

If I change the #define to read (in include/mbedtls/ssl.h):

#if defined(MBEDTLS_HAVE_TIME)
#include <time.h>
#define mbedtls_time_t   time_t    # <-- this is new
#endif

It does compile. Ain't that interesting... Wonder why this is not triggered in test suite.

cc @pjbakker

@ciarmcom
Copy link

ARM Internal Ref: IOTSSL-841

@anttiylitokola
Copy link

@janjongboom, can you try to compile again? mbed-client-mbed-tls module is now updated to yotta containing following fix:
ARMmbed/mbed-client-mbed-tls@4e81d7f

@jcowgill
Copy link
Contributor

FYI since this bug broke some applications in Debian, I have applied the following patch to the Debian packaging for the 2.3.0 release:

--- a/include/mbedtls/ssl.h
+++ b/include/mbedtls/ssl.h
@@ -52,7 +52,7 @@
 #endif

 #if defined(MBEDTLS_HAVE_TIME)
-#include <time.h>
+#include "platform.h"
 #endif

 /*

@janjongboom
Copy link
Author

@anttiylitokola Yeah, that would do. But @jcowgill's comment makes me think this should be patched in mbedtls repo as well...

@pjbakker
Copy link
Contributor

@janjongboom agreed. We'll pick it up.

pjbakker referenced this issue Jun 29, 2016
Substitutes time() into a configurable platform interface to allow it to be
easily substituted.
@sithglan
Copy link

sithglan commented Jul 3, 2016

Hello,
I hit the same issue with curl and mbedtls 2.3.0. The above patch of @jcowgill fixed it for me. See also: http://permalink.gmane.org/gmane.comp.web.curl.library/47856 Please apply.

Cheers,
Thomas

@simonbutcher
Copy link
Contributor

This has now been resolved in a series of commits (b5b6af2, b928343 and 23e9778). Thanks to @jcowgill for the pointer, but the fix above isn't sufficient, and there was an underlying issue that mbedtls_time_t was dependent on the symbol MBEDTLS_HAVE_TIME which wasn't being properly respected.

The issue has now been reviewed, committed, tested and fixed in the above commits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants