update master-with-bazel from master branch
This commit is contained in:
@@ -102,34 +102,3 @@ ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, int64_t posix_time,
|
||||
s->type = V_ASN1_UTCTIME;
|
||||
return s;
|
||||
}
|
||||
|
||||
int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t) {
|
||||
struct tm stm, ttm;
|
||||
int day, sec;
|
||||
|
||||
if (!asn1_utctime_to_tm(&stm, s, /*allow_timezone_offset=*/1)) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (!OPENSSL_posix_to_tm(t, &ttm)) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (!OPENSSL_gmtime_diff(&day, &sec, &ttm, &stm)) {
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (day > 0) {
|
||||
return 1;
|
||||
}
|
||||
if (day < 0) {
|
||||
return -1;
|
||||
}
|
||||
if (sec > 0) {
|
||||
return 1;
|
||||
}
|
||||
if (sec < 0) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1169,7 +1169,7 @@ TEST(ASN1Test, UTCTimeZoneOffsets) {
|
||||
EXPECT_EQ(V_ASN1_UTCTIME, ASN1_STRING_type(s.get()));
|
||||
EXPECT_EQ("700101000000Z", ASN1StringToStringView(s.get()));
|
||||
|
||||
// UTCTIME_set_string should not allow a timezeone offset
|
||||
// UTCTIME_set_string should not allow a timezone offset
|
||||
EXPECT_FALSE(ASN1_UTCTIME_set_string(s.get(), "700101000000-0400"));
|
||||
|
||||
// Forcibly construct a utc time with a timezone offset.
|
||||
@@ -1178,13 +1178,9 @@ TEST(ASN1Test, UTCTimeZoneOffsets) {
|
||||
EXPECT_EQ(V_ASN1_UTCTIME, ASN1_STRING_type(s.get()));
|
||||
EXPECT_EQ("700101000000-0400", ASN1StringToStringView(s.get()));
|
||||
|
||||
// check is expected to be valid with timezeone offsets
|
||||
// check is expected to be valid with timezone offsets
|
||||
ASSERT_TRUE(ASN1_UTCTIME_check(s.get()));
|
||||
|
||||
// cmp_time_t allows timezeone offset, and we are expected to be 4 hours
|
||||
// behind the epoch.
|
||||
EXPECT_EQ(ASN1_UTCTIME_cmp_time_t(s.get(), (4 * 60 * 60 * -1)), 0);
|
||||
|
||||
int64_t posix_time;
|
||||
EXPECT_FALSE(ASN1_TIME_to_posix(s.get(), &posix_time));
|
||||
ASSERT_TRUE(ASN1_TIME_to_posix_nonstandard(s.get(), &posix_time));
|
||||
|
||||
@@ -1181,10 +1181,6 @@ OPENSSL_EXPORT ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s,
|
||||
// If |s| is NULL, this function validates |str| without copying it.
|
||||
OPENSSL_EXPORT int ASN1_UTCTIME_set_string(ASN1_UTCTIME *s, const char *str);
|
||||
|
||||
// ASN1_UTCTIME_cmp_time_t compares |s| to |t|. It returns -1 if |s| < |t|, 0 if
|
||||
// they are equal, 1 if |s| > |t|, and -2 on error.
|
||||
OPENSSL_EXPORT int ASN1_UTCTIME_cmp_time_t(const ASN1_UTCTIME *s, time_t t);
|
||||
|
||||
// ASN1_GENERALIZEDTIME_new calls |ASN1_STRING_type_new| with
|
||||
// |V_ASN1_GENERALIZEDTIME|. The resulting object contains empty contents and
|
||||
// must be initialized to be a valid GeneralizedTime.
|
||||
|
||||
Reference in New Issue
Block a user