Topic: Generate CSR on Arduino - incomplete type 'struct tm'

Hello. I'm trying your CSR generating example on an Arduino and the compile fails with:

:\Arduino\arduino-1.8.12\libraries\wolfSSL\asn.c: In function 'SetTime':

C:\Arduino\arduino-1.8.12\libraries\wolfSSL\asn.c:10402:29: error: dereferencing pointer to incomplete type 'struct tm'

     output[i++] = itob((date->tm_year % 10000) / 1000);

                             ^

C:\Arduino\arduino-1.8.12\libraries\wolfSSL\asn.c: In function 'SetValidity':

C:\Arduino\arduino-1.8.12\libraries\wolfSSL\asn.c:10461:15: error: storage size of 'localTime' isn't known

     struct tm localTime;

               ^

Is there some time setting somewhere I'm missing?

Thanks!

Share

Re: Generate CSR on Arduino - incomplete type 'struct tm'

Hi torntrousers,

Looks like your Arduino doesn't have "time.h" support.

You have a couple options:

1. Disable ASN time support using "NO_ASN_TIME"

2. Override the time support. See this example:
https://github.com/wolfSSL/wolfssl/blob … ngs.h#L452
https://github.com/wolfSSL/wolfssl/blob … main.c#L32

Thanks,
David Garske, wolfSSL

Share

Re: Generate CSR on Arduino - incomplete type 'struct tm'

Thanks for the reply David.

I do have "NO_ASN_TIME" set already.

I gave the custom time function a try but I still get the compile error in asn.c shown in the original post.

This is whats in my user_settings.h file now:

/* Generated wolfSSL user_settings.h file for Arduino */
#ifndef ARDUINO_USER_SETTINGS_H
#define ARDUINO_USER_SETTINGS_H

/* Platform */
#define WOLFSSL_ARDUINO

/* Math library (remove this to use normal math)*/
#define USE_FAST_MATH
#define TFM_NO_ASM

/* RNG DEFAULT !!FOR TESTING ONLY!! */
/* comment out the error below to get started w/ bad entropy source
* This will need fixed before distribution but is OK to test with */
//#error "needs solved, see: https://www.wolfssl.com/docs/porting-guide/"
#define WOLFSSL_GENSEED_FORTEST

#define WOLFSSL_DER_TO_PEM

#define WOLFSSL_CERT_GEN
#define WOLFSSL_CERT_REQ
#define NO_ASN_TIME
#define XGMTIME
#define XTIME fnSecondsSinceEpoch
extern unsigned long my_time(unsigned long* timer);

#endif /* ARDUINO_USER_SETTINGS_H */

Thanks for any help.

   ...ant

Share

Re: Generate CSR on Arduino - incomplete type 'struct tm'

Keen to find a fix for this so have raise an issue on Github: https://github.com/wolfSSL/wolfssl-examples/issues/220

Share