VirtualBox

Changeset 74716 in vbox for trunk


Ignore:
Timestamp:
Oct 9, 2018 11:59:42 AM (6 years ago)
Author:
vboxsync
Message:

IPRT/ldr: More Mach-O signing hacking. bugref:9232

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/crypto/pkcs7.h

    r74692 r74716  
    107107    /** Microsoft statement type, use pObjIdSeqs. */
    108108    RTCRPKCS7ATTRIBUTETYPE_MS_STATEMENT_TYPE,
     109    /** Apple plist with the all code directory digests, use pOctetStrings. */
     110    RTCRPKCS7ATTRIBUTETYPE_APPLE_MULTI_CD_PLIST,
    109111    /** Blow the type up to 32-bits. */
    110112    RTCRPKCS7ATTRIBUTETYPE_32BIT_HACK = 0x7fffffff
     
    212214 * @remarks This isn't defined by PKCS \#9, but lumped in here for convenience. It's actually listed as SPC by MS. */
    213215#define RTCR_PKCS9_ID_MS_SP_OPUS_INFO       "1.3.6.1.4.1.311.2.1.12"
     216/** Apple code signing multi-code-directory plist.
     217 * @remarks This isn't defined by PKCS \#9, but lumped in here for convenience. */
     218#define RTCR_PKCS9_ID_APPLE_MULTI_CD_PLIST  "1.2.840.113635.100.9.1"
    214219/** @} */
    215220
  • trunk/src/VBox/Runtime/common/crypto/pkcs7-template.h

    r69111 r74716  
    6565RTASN1TMPL_MEMBER_DYN(          uValues,    pObjIdSeqs,     RTASN1SETOFOBJIDSEQS,       RTAsn1SetOfObjIdSeqs,       Allocation,
    6666    enmType, RTCRPKCS7ATTRIBUTETYPE_MS_STATEMENT_TYPE, RTAsn1ObjId_CompareWithString(&pThis->Type, RTCR_PKCS9_ID_MS_STATEMENT_TYPE) == 0);
     67RTASN1TMPL_MEMBER_DYN(          uValues,    pOctetStrings,  RTASN1SETOFOCTETSTRINGS,    RTAsn1SetOfOctetStrings,    Allocation,
     68    enmType, RTCRPKCS7ATTRIBUTETYPE_APPLE_MULTI_CD_PLIST,  RTAsn1ObjId_CompareWithString(&pThis->Type, RTCR_PKCS9_ID_APPLE_MULTI_CD_PLIST) == 0);
    6769RTASN1TMPL_MEMBER_DYN_DEFAULT(  uValues,    pCores,         RTASN1SETOFCORES,           RTAsn1SetOfCores,           Allocation,
    6870    enmType, RTCRPKCS7ATTRIBUTETYPE_UNKNOWN);
  • trunk/src/VBox/Runtime/tools/RTSignTool.cpp

    r74707 r74716  
    17891789            break;
    17901790
     1791        case RTCRPKCS7ATTRIBUTETYPE_APPLE_MULTI_CD_PLIST:
     1792            if (pAttr->uValues.pContentInfos->cItems != 1)
     1793                RTPrintf("%s%u plists, expected only 1.\n", pThis->szPrefix, pAttr->uValues.pOctetStrings->cItems);
     1794            for (unsigned i = 0; i < pAttr->uValues.pOctetStrings->cItems; i++)
     1795            {
     1796                PCRTASN1OCTETSTRING pOctetString = pAttr->uValues.pOctetStrings->papItems[i];
     1797                size_t              cbContent    = pOctetString->Asn1Core.cb;
     1798                char  const        *pchContent   = pOctetString->Asn1Core.uData.pch;
     1799                rc = RTStrValidateEncodingEx(pchContent, cbContent, RTSTR_VALIDATE_ENCODING_EXACT_LENGTH);
     1800                if (RT_SUCCESS(rc))
     1801                {
     1802                    while (cbContent > 0)
     1803                    {
     1804                        const char *pchNewLine = (const char *)memchr(pchContent, '\n', cbContent);
     1805                        size_t      cchToWrite = pchNewLine ? pchNewLine - pchContent : cbContent;
     1806                        if (pAttr->uValues.pOctetStrings->cItems == 1)
     1807                            RTPrintf("%s %.*s\n", pThis->szPrefix, cchToWrite, pchContent);
     1808                        else
     1809                            RTPrintf("%s plist[%u]: %.*s\n", pThis->szPrefix, i, cchToWrite, pchContent);
     1810                        if (!pchNewLine)
     1811                            break;
     1812                        pchContent = pchNewLine + 1;
     1813                        cbContent -= cchToWrite + 1;
     1814                    }
     1815                }
     1816                else
     1817                {
     1818                    if (pAttr->uValues.pContentInfos->cItems != 1)
     1819                        RTPrintf("%s: plist[%u]: Invalid UTF-8: %Rrc\n", pThis->szPrefix, i, rc);
     1820                    else
     1821                        RTPrintf("%s: Invalid UTF-8: %Rrc\n", pThis->szPrefix, rc);
     1822                    for (uint32_t off = 0; off < cbContent; off += 16)
     1823                    {
     1824                        size_t cbNow = RT_MIN(cbContent - off, 16);
     1825                        if (pAttr->uValues.pOctetStrings->cItems == 1)
     1826                            RTPrintf("%s %#06x: %.*Rhxs\n", pThis->szPrefix, off, cbNow, &pchContent[off]);
     1827                        else
     1828                            RTPrintf("%s plist[%u]: %#06x: %.*Rhxs\n", pThis->szPrefix, i, off, cbNow, &pchContent[off]);
     1829                    }
     1830                }
     1831            }
     1832            break;
     1833
    17911834        case RTCRPKCS7ATTRIBUTETYPE_INVALID:
    17921835            RTPrintf("%sINVALID!\n", pThis->szPrefix);
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