VirtualBox

Changeset 64916 in vbox


Ignore:
Timestamp:
Dec 16, 2016 4:32:03 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
112329
Message:

RTSignTool: Deal with primary signatures lacking timestamp (for local testing).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/tools/RTSignTool.cpp

    r64905 r64916  
    346346{
    347347    PRTCRPKCS7SIGNERINFO pSignerInfo = pThis->pSignedData->SignerInfos.papItems[0];
     348    int rc;
     349
     350    /*
     351     * Deal with UnauthenticatedAttributes being absent before trying to append to the array.
     352     */
     353    if (pSignerInfo->UnauthenticatedAttributes.cItems == 0)
     354    {
     355        /* HACK ALERT! Invent ASN.1 setters/whatever for members to replace this mess. */
     356
     357        if (pSignerInfo->AuthenticatedAttributes.cItems == 0)
     358            return RTMsgErrorExit(RTEXITCODE_FAILURE, "No authenticated or unauthenticated attributes! Sorry, no can do.");
     359
     360        Assert(pSignerInfo->UnauthenticatedAttributes.SetCore.Asn1Core.uTag == 0);
     361        rc = RTAsn1SetCore_Init(&pSignerInfo->UnauthenticatedAttributes.SetCore,
     362                                pSignerInfo->AuthenticatedAttributes.SetCore.Asn1Core.pOps);
     363        if (RT_FAILURE(rc))
     364            return RTMsgErrorExit(RTEXITCODE_FAILURE, "RTAsn1SetCore_Init failed: %Rrc", rc);
     365        pSignerInfo->UnauthenticatedAttributes.SetCore.Asn1Core.uTag   = 1;
     366        pSignerInfo->UnauthenticatedAttributes.SetCore.Asn1Core.fClass = ASN1_TAGCLASS_CONTEXT | ASN1_TAGFLAG_CONSTRUCTED;
     367        RTAsn1MemInitArrayAllocation(&pSignerInfo->UnauthenticatedAttributes.Allocation,
     368                                     pSignerInfo->AuthenticatedAttributes.Allocation.pAllocator,
     369                                     sizeof(**pSignerInfo->UnauthenticatedAttributes.papItems));
     370    }
     371
    348372    int32_t iPos = RTCrPkcs7Attributes_Append(&pSignerInfo->UnauthenticatedAttributes);
    349373    if (iPos >= 0)
     
    354378
    355379        PRTCRPKCS7ATTRIBUTE pAttr = pSignerInfo->UnauthenticatedAttributes.papItems[iPos];
    356         int rc = RTAsn1ObjId_InitFromString(&pAttr->Type, RTCR_PKCS9_ID_MS_NESTED_SIGNATURE, pAttr->Allocation.pAllocator);
     380        rc = RTAsn1ObjId_InitFromString(&pAttr->Type, RTCR_PKCS9_ID_MS_NESTED_SIGNATURE, pAttr->Allocation.pAllocator);
    357381        if (RT_SUCCESS(rc))
    358382        {
Note: See TracChangeset for help on using the changeset viewer.

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