VirtualBox

Ignore:
Timestamp:
Feb 10, 2016 12:47:33 AM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
105459
Message:

IPRT: Added 'off' parameter to RTVfsIoStrmSgWrite and RTVfsIoStrmSgRead so it's easier to write passthru layers. Added RTVfsIoStrmReadAll, RTVfsIoStrmReadAllFree, RTVfsIoStrmFromBuffer, RTManifestPtIosIsInstanceOf, RTCrX509Certificate_ReadFromBuffer and RTCrDigestUpdateFromVfsFile. Updated the manifest passthru read code to handle ReadAt requests which skips parts and jumps back to re-read stuff on streams/files which are seekable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/crypto/x509-file.cpp

    r57358 r59620  
    7979
    8080
     81RTDECL(int) RTCrX509Certificate_ReadFromBuffer(PRTCRX509CERTIFICATE pCertificate, const void *pvBuf, size_t cbBuf,
     82                                               uint32_t fFlags, PCRTASN1ALLOCATORVTABLE pAllocator,
     83                                               PRTERRINFO pErrInfo, const char *pszErrorTag)
     84{
     85    AssertReturn(!fFlags, VERR_INVALID_FLAGS);
     86    PCRTCRPEMSECTION pSectionHead;
     87    int rc = RTCrPemParseContent(pvBuf, cbBuf, 0, g_aCertificateMarkers, RT_ELEMENTS(g_aCertificateMarkers),
     88                                 &pSectionHead, pErrInfo);
     89    if (RT_SUCCESS(rc))
     90    {
     91        RTCRX509CERTIFICATE TmpCert;
     92        RTASN1CURSORPRIMARY PrimaryCursor;
     93        RTAsn1CursorInitPrimary(&PrimaryCursor, pSectionHead->pbData, (uint32_t)RT_MIN(pSectionHead->cbData, UINT32_MAX),
     94                                pErrInfo, pAllocator, RTASN1CURSOR_FLAGS_DER, pszErrorTag);
     95        rc = RTCrX509Certificate_DecodeAsn1(&PrimaryCursor.Cursor, 0, &TmpCert, "Cert");
     96        if (RT_SUCCESS(rc))
     97        {
     98            rc = RTCrX509Certificate_CheckSanity(&TmpCert, 0, pErrInfo, "Cert");
     99            if (RT_SUCCESS(rc))
     100            {
     101                rc = RTCrX509Certificate_Clone(pCertificate, &TmpCert, &g_RTAsn1DefaultAllocator);
     102                if (RT_SUCCESS(rc))
     103                {
     104                    if (pSectionHead->pNext || PrimaryCursor.Cursor.cbLeft)
     105                        rc = VINF_ASN1_MORE_DATA;
     106                }
     107            }
     108            RTCrX509Certificate_Delete(&TmpCert);
     109        }
     110        RTCrPemFreeSections(pSectionHead);
     111    }
     112    return rc;
     113}
     114
     115
    81116
    82117#if 0
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