Skip to content

Commit

Permalink
time
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlstrom-g committed Jan 23, 2024
1 parent 732c14c commit e36521e
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/* WARNING: Edited heavily by hand, based on lbshell config. Meant for all
* starboard platforms. */

#include "starboard/client_porting/eztime/eztime.h"
#include "starboard/common/log.h"
#include "starboard/configuration.h"
#include "starboard/file.h"
Expand Down
4 changes: 0 additions & 4 deletions third_party/boringssl/src/crypto/asn1/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@

#include <openssl/asn1.h>

#if defined(OPENSSL_SYS_STARBOARD)
#include "starboard/client_porting/poem/eztime_poem.h"
#endif // defined(OPENSSL_SYS_STARBOARD)

#if defined(__cplusplus)
extern "C" {
#endif
Expand Down
4 changes: 0 additions & 4 deletions third_party/boringssl/src/crypto/asn1/time_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@
#define SECS_PER_DAY (24 * 60 * 60)

struct tm *OPENSSL_gmtime(const time_t *time, struct tm *result) {
#if defined(OPENSSL_SYS_STARBOARD)
return OPENSSL_port_gmtime_r(time, result);
#else // defined(OPENSSL_SYS_STARBOARD)
#if defined(OPENSSL_WINDOWS)
if (gmtime_s(result, time)) {
return NULL;
Expand All @@ -78,7 +75,6 @@ struct tm *OPENSSL_gmtime(const time_t *time, struct tm *result) {
#else
return gmtime_r(time, result);
#endif
#endif // defined(OPENSSL_SYS_STARBOARD)
}

/* Convert date to and from julian day Uses Fliegel & Van Flandern algorithm */
Expand Down
22 changes: 13 additions & 9 deletions third_party/boringssl/src/crypto/x509/x509_vfy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,7 @@ static int check_cert(X509_STORE_CTX *ctx)

static int check_crl_time(X509_STORE_CTX *ctx, X509_CRL *crl, int notify)
{
OPENSSL_port_time_t *ptime;
time_t *ptime;
int i;
if (notify)
ctx->current_crl = crl;
Expand Down Expand Up @@ -1780,7 +1780,7 @@ static int check_policy(X509_STORE_CTX *ctx)

static int check_cert_time(X509_STORE_CTX *ctx, X509 *x)
{
OPENSSL_port_time_t *ptime;
time_t *ptime;
int i;

if (ctx->param->flags & X509_V_FLAG_USE_CHECK_TIME)
Expand Down Expand Up @@ -1911,7 +1911,8 @@ int X509_cmp_current_time(const ASN1_TIME *ctm)
return X509_cmp_time(ctm, NULL);
}

int X509_cmp_time(const ASN1_TIME *ctm, OPENSSL_port_time_t *cmp_time) {
int X509_cmp_time(const ASN1_TIME *ctm, time_t *cmp_time)
{
static const size_t utctime_length = sizeof("YYMMDDHHMMSSZ") - 1;
static const size_t generalizedtime_length = sizeof("YYYYMMDDHHMMSSZ") - 1;
ASN1_TIME *asn1_cmp_time = NULL;
Expand Down Expand Up @@ -1980,18 +1981,20 @@ ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long offset_sec)
return X509_time_adj(s, offset_sec, NULL);
}

ASN1_TIME *X509_time_adj(ASN1_TIME *s, long offset_sec, OPENSSL_port_time_t *in_tm) {
ASN1_TIME *X509_time_adj(ASN1_TIME *s, long offset_sec, time_t *in_tm)
{
return X509_time_adj_ex(s, 0, offset_sec, in_tm);
}

ASN1_TIME *X509_time_adj_ex(ASN1_TIME *s, int offset_day, long offset_sec,
OPENSSL_port_time_t *in_tm) {
OPENSSL_port_time_t t = 0;
ASN1_TIME *X509_time_adj_ex(ASN1_TIME *s,
int offset_day, long offset_sec, time_t *in_tm)
{
time_t t = 0;

if (in_tm) {
t = *in_tm;
} else {
OPENSSL_port_time(&t);
time(&t);
}

return ASN1_TIME_adj(s, t, offset_day, offset_sec);
Expand Down Expand Up @@ -2439,7 +2442,8 @@ void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags)
}

void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags,
OPENSSL_port_time_t t) {
time_t t)
{
X509_VERIFY_PARAM_set_time(ctx->param, t);
}

Expand Down
2 changes: 1 addition & 1 deletion third_party/boringssl/src/crypto/x509/x509_vpm.c
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param, int depth)
param->depth = depth;
}

void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, OPENSSL_port_time_t t)
void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param, time_t t)
{
param->check_time = t;
param->flags |= X509_V_FLAG_USE_CHECK_TIME;
Expand Down
7 changes: 3 additions & 4 deletions third_party/boringssl/src/include/openssl/x509.h
Original file line number Diff line number Diff line change
Expand Up @@ -816,21 +816,20 @@ OPENSSL_EXPORT int X509_NAME_get0_der(X509_NAME *nm, const unsigned char **pder,
//
// WARNING: Unlike most comparison functions, this function returns zero on
// error, not equality.
OPENSSL_EXPORT int X509_cmp_time(const ASN1_TIME *s, OPENSSL_port_time_t *t);
OPENSSL_EXPORT int X509_cmp_time(const ASN1_TIME *s, time_t *t);

// X509_cmp_current_time behaves like |X509_cmp_time| but compares |s| against
// the current time.
OPENSSL_EXPORT int X509_cmp_current_time(const ASN1_TIME *s);

// X509_time_adj calls |X509_time_adj_ex| with |offset_day| equal to zero.
OPENSSL_EXPORT ASN1_TIME *X509_time_adj(ASN1_TIME *s, long offset_sec,
OPENSSL_port_time_t *t);
time_t *t);

// X509_time_adj_ex behaves like |ASN1_TIME_adj|, but adds an offset to |*t|. If
// |t| is NULL, it uses the current time instead of |*t|.
OPENSSL_EXPORT ASN1_TIME *X509_time_adj_ex(ASN1_TIME *s, int offset_day,
long offset_sec,
OPENSSL_port_time_t *t);
long offset_sec, time_t *t);

// X509_gmtime_adj behaves like |X509_time_adj_ex| but adds |offset_sec| to the
// current time.
Expand Down
6 changes: 3 additions & 3 deletions third_party/boringssl/src/include/openssl/x509_vfy.h
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,8 @@ OPENSSL_EXPORT int X509_STORE_CTX_purpose_inherit(X509_STORE_CTX *ctx,
int trust);
OPENSSL_EXPORT void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx,
unsigned long flags);
OPENSSL_EXPORT void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags,
OPENSSL_port_time_t t);
OPENSSL_EXPORT void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx,
unsigned long flags, time_t t);
OPENSSL_EXPORT void X509_STORE_CTX_set_verify_cb(
X509_STORE_CTX *ctx, int (*verify_cb)(int, X509_STORE_CTX *));

Expand Down Expand Up @@ -499,7 +499,7 @@ OPENSSL_EXPORT int X509_VERIFY_PARAM_set_trust(X509_VERIFY_PARAM *param,
OPENSSL_EXPORT void X509_VERIFY_PARAM_set_depth(X509_VERIFY_PARAM *param,
int depth);
OPENSSL_EXPORT void X509_VERIFY_PARAM_set_time(X509_VERIFY_PARAM *param,
OPENSSL_port_time_t t);
time_t t);
OPENSSL_EXPORT int X509_VERIFY_PARAM_add0_policy(X509_VERIFY_PARAM *param,
ASN1_OBJECT *policy);
OPENSSL_EXPORT int X509_VERIFY_PARAM_set1_policies(
Expand Down

0 comments on commit e36521e

Please sign in to comment.