Skip to content

Commit 25b3d98

Browse files
committed
Assert that time_t is 64-bit
1 parent 5b4e770 commit 25b3d98

File tree

1 file changed

+2
-8
lines changed
  • src/native/libs/System.Security.Cryptography.Native

1 file changed

+2
-8
lines changed

src/native/libs/System.Security.Cryptography.Native/pal_x509.c

+2-8
Original file line numberDiff line numberDiff line change
@@ -1354,14 +1354,8 @@ int32_t CryptoNative_X509DecodeOcspToExpiration(const uint8_t* buf, int32_t len,
13541354
time_t expiration_t = 0;
13551355
X509VerifyStatusCode code = CheckOcspGetExpiry(req, resp, subject, issuers[0], ctx, &canCache, &expiration_t);
13561356

1357-
if (sizeof(time_t) == sizeof(int64_t))
1358-
{
1359-
*expiration = (int64_t)expiration_t;
1360-
}
1361-
else if (sizeof(time_t) == sizeof(int32_t))
1362-
{
1363-
*expiration = (int32_t)expiration_t;
1364-
}
1357+
c_static_assert(sizeof(time_t) == sizeof(int64_t));
1358+
*expiration = (int64_t)expiration_t;
13651359

13661360
if (code == PAL_X509_V_OK || code == PAL_X509_V_ERR_CERT_REVOKED)
13671361
{

0 commit comments

Comments
 (0)