VirtualBox

Changeset 75176 in vbox for trunk


Ignore:
Timestamp:
Oct 30, 2018 1:01:29 PM (6 years ago)
Author:
vboxsync
Message:

IPRT: Workaround for leap seconds and seconds rounding error on OS X in their DER_CFDateToUTCTime() function. bugref:9232

Location:
trunk/src/VBox/Runtime
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/asn1/asn1-ut-time-decode.cpp

    r69111 r75176  
    5757        && pThis->Time.u8Hour   <  24
    5858        && pThis->Time.u8Minute <  60
    59         && pThis->Time.u8Second <  60) /** @todo what about leap seconds? */
    60     {
     59        && pThis->Time.u8Second <= 60)
     60    {
     61        /* Suppress leap seconds and work around clever rounding error in DER_CFDateToUTCTime() on OS X. */
     62        if (pThis->Time.u8Second < 60)
     63        { /* likely */ }
     64        else
     65            pThis->Time.u8Second = 59;
     66
     67        /* Normalize and move on. */
    6168        RTTIME const TimeCopy = pThis->Time;
    6269        if (RTTimeNormalize(&pThis->Time))
     
    7178
    7279            rc = RTAsn1CursorSetInfo(pCursor, VERR_ASN1_TIME_NORMALIZE_MISMATCH,
    73                                      "%s: Normalized result not the same as %s: '%.*s'",
    74                                      pszErrorTag, pszType, pThis->Asn1Core.cb, pThis->Asn1Core.uData.pch);
     80                                     "%s: Normalized result not the same as %s: '%.*s' / %04u-%02u-%02uT%02u:%02u:%02u vs %04u-%02u-%02uT%02u:%02u:%02u",
     81                                     pszErrorTag, pszType, pThis->Asn1Core.cb, pThis->Asn1Core.uData.pch,
     82                                     TimeCopy.i32Year, TimeCopy.u8Month, TimeCopy.u8MonthDay,
     83                                     TimeCopy.u8Hour, TimeCopy.u8Minute, TimeCopy.u8Second,
     84                                     pThis->Time.i32Year, pThis->Time.u8Month, pThis->Time.u8MonthDay,
     85                                     pThis->Time.u8Hour, pThis->Time.u8Minute, pThis->Time.u8Second);
    7586        }
    7687        else
  • trunk/src/VBox/Runtime/tools/RTSignTool.cpp

    r74767 r75176  
    18031803        /* Signing time (PKCS \#9), use pSigningTime. */
    18041804        case RTCRPKCS7ATTRIBUTETYPE_SIGNING_TIME:
    1805             RTPrintf("%sTODO: RTCRPKCS7ATTRIBUTETYPE_SIGNING_TIME! %u bytes\n",
    1806                      pThis->szPrefix, pAttr->uValues.pSigningTime->SetCore.Asn1Core.cb);
     1805            for (uint32_t i = 0; i < pAttr->uValues.pSigningTime->cItems; i++)
     1806            {
     1807                PCRTASN1TIME pTime = pAttr->uValues.pSigningTime->papItems[i];
     1808                char szTS[RTTIME_STR_LEN];
     1809                RTTimeToString(&pTime->Time, szTS, sizeof(szTS));
     1810                if (pAttr->uValues.pSigningTime->cItems == 1)
     1811                    RTPrintf("%s %s (%.*s)\n", pThis->szPrefix, szTS, pTime->Asn1Core.cb, pTime->Asn1Core.uData.pch);
     1812                else
     1813                    RTPrintf("%s #%u: %s (%.*s)\n", pThis->szPrefix, i, szTS, pTime->Asn1Core.cb, pTime->Asn1Core.uData.pch);
     1814            }
    18071815            break;
    18081816
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette