0

I've tried integrating library mbedTLS with LwIP 2.1.0. I've added the following to my lwipopts.h file

#ifndef LWIP_ALTCP
#define LWIP_ALTCP 1
#endif

#ifndef LWIP_ALTCP_TLS
#define LWIP_ALTCP_TLS 1
#endif

I've added the library to my project like this and referenced them for the compiler:

enter image description here

I've also made changes in the mbedtls/include/config.h file such that no windows or linux is used.

I'm getting a "undefined reference to "_gettimeofday" where I've narrowed it down to the only place where this is defined is in my arm-gnu toolchain:

#ifdef _COMPILING_NEWLIB
int _EXFUN(_gettimeofday, (struct timeval *__p, void *__tz));
#endif

What might the case be? Everything compiles file when I turn LWIP_ALTCP_TLS off but then TLS can't be used. Are there more flags I need to switch on/off?

Müller
  • 313
  • 5
  • 18

1 Answers1

1

RTFM: The _gettimeofday() function is a system call that the user has to implement when using date and time functions from newlib.

Minimum implementation is rather simple:

int _gettimeofday (struct timeval *tp, void *tzp){
  tp->tv_sec = unixTimeInSecs;
  tp->tv_usec = 0; 
  return 0;
}

TLS libraries require the current time for certificate checks: SSL certificates are only valid within a certain date range.

Turbo J
  • 7,563
  • 1
  • 23
  • 43