Don't check for time() failing in CT_POLICY_EVAL_CTX_new
authorRob Percival <robpercival@google.com>
Mon, 12 Sep 2016 15:58:29 +0000 (16:58 +0100)
committerRich Salz <rsalz@openssl.org>
Tue, 15 Nov 2016 21:12:41 +0000 (16:12 -0500)
See https://github.com/openssl/openssl/pull/1554#issuecomment-246354677.

Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1554)

crypto/ct/ct_policy.c

index d2f72c4a5a0b0182e7c028c81cd7fb7fd17bd190..1bc22749d3c2b222ff85196eae62f8cd750a7d61 100644 (file)
 CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new(void)
 {
     CT_POLICY_EVAL_CTX *ctx = OPENSSL_zalloc(sizeof(CT_POLICY_EVAL_CTX));
-    time_t epoch_time_in_s;
 
     if (ctx == NULL) {
         CTerr(CT_F_CT_POLICY_EVAL_CTX_NEW, ERR_R_MALLOC_FAILURE);
         return NULL;
     }
 
-    // Use the current time if available.
-    time(&epoch_time_in_s);
-    if (epoch_time_in_s != -1)
-        ctx->epoch_time_in_ms = epoch_time_in_s * 1000;
-
+    // time(NULL) shouldn't ever fail, so don't bother checking for -1.
+    ctx->epoch_time_in_ms = time(NULL) * 1000;
     return ctx;
 }