wolfSSL_get_ocsp_producedDate*(): gate on !defined(NO_ASN_TIME), and in client_test(), gate call to strftime() on HAVE_STRFTIME and add fallback code; add HAVE_STRFTIME test to configure.ac.

This commit is contained in:
Daniel Pouzzner
2020-10-08 23:26:28 -05:00
parent 7a77b6d990
commit 570f55a0e3
4 changed files with 17 additions and 7 deletions
+13 -3
View File
@@ -3007,14 +3007,24 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
showPeerEx(ssl, lng_index);
#ifdef HAVE_OCSP
#if defined(HAVE_OCSP) && !defined(NO_ASN_TIME)
#ifdef HAVE_STRFTIME
{
struct tm tm;
char date[32];
ret = wolfSSL_get_ocsp_producedDate_tm(ssl, &tm);
if ((ret == 0) && (strftime(date, sizeof date, "%Y-%m-%d %H:%M:%S %z",&tm) > 0))
printf("OCSP response timestamp: %s\n",date);
if ((ret == 0) && (strftime(date, sizeof date, "%Y-%m-%d %H:%M:%S %z", &tm) > 0))
printf("OCSP response timestamp: %s\n", date);
}
#else
{
byte date[MAX_DATE_SIZE];
int asn_date_format;
ret = wolfSSL_get_ocsp_producedDate(ssl, date, sizeof date, &asn_date_format);
if (ret == 0)
printf("OCSP response timestamp: %s (ASN.1 type %d)\n", (char *)date, asn_date_format);
}
#endif
#endif
#ifdef OPENSSL_EXTRA