VirtualBox

Changeset 40329 in vbox for trunk/src/VBox/Main/src-server


Ignore:
Timestamp:
Mar 2, 2012 4:13:50 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
76594
Message:

Main/Runtime/VBoxManage: SHA256 support comes with OVF 2.0

Location:
trunk/src/VBox/Main/src-server
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/ApplianceImplExport.cpp

    r39248 r40329  
    558558    else if (strFormat == "ovf-1.0")
    559559        ovfF = OVF_1_0;
     560    else if (strFormat == "ovf-2.0")
     561        ovfF = OVF_2_0;
    560562    else
    561563        return setError(VBOX_E_FILE_ERROR,
    562564                        tr("Invalid format \"%s\" specified"), strFormat.c_str());
     565
     566    /* as of OVF 2.0 we have to use SHA256 */
     567    m->fSha256 = ovfF >= OVF_2_0;
    563568
    564569    ComObjPtr<Progress> progress;
     
    658663    xml::ElementNode *pelmRoot = doc.createRootElement("Envelope");
    659664
    660     pelmRoot->setAttribute("ovf:version", (enFormat == OVF_1_0) ? "1.0" : "0.9");
     665    pelmRoot->setAttribute("ovf:version", enFormat == OVF_2_0 ? "2.0"
     666                                        : enFormat == OVF_1_0 ? "1.0"
     667                                        :                       "0.9");
    661668    pelmRoot->setAttribute("xml:lang", "en-US");
    662669
     
    16211628    HRESULT rc = S_OK;
    16221629
    1623     PVDINTERFACEIO pSha1Io = 0;
     1630    PVDINTERFACEIO pShaIo = 0;
    16241631    PVDINTERFACEIO pFileIo = 0;
    16251632    do
    16261633    {
    1627         pSha1Io = Sha1CreateInterface();
    1628         if (!pSha1Io)
     1634        pShaIo = ShaCreateInterface();
     1635        if (!pShaIo)
    16291636        {
    16301637            rc = E_OUTOFMEMORY;
     
    16381645        }
    16391646
    1640         SHA1STORAGE storage;
     1647        SHASTORAGE storage;
    16411648        RT_ZERO(storage);
    16421649        storage.fCreateDigest = m->fManifest;
     1650        storage.fSha256 = m->fSha256;
    16431651        int vrc = VDInterfaceAdd(&pFileIo->Core, "Appliance::IOFile",
    16441652                                 VDINTERFACETYPE_IO, 0, sizeof(VDINTERFACEIO),
     
    16491657            break;
    16501658        }
    1651         rc = writeFSImpl(pTask, writeLock, pSha1Io, &storage);
     1659        rc = writeFSImpl(pTask, writeLock, pShaIo, &storage);
    16521660    }while(0);
    16531661
    16541662    /* Cleanup */
    1655     if (pSha1Io)
    1656         RTMemFree(pSha1Io);
     1663    if (pShaIo)
     1664        RTMemFree(pShaIo);
    16571665    if (pFileIo)
    16581666        RTMemFree(pFileIo);
     
    16751683    HRESULT rc = S_OK;
    16761684
    1677     PVDINTERFACEIO pSha1Io = 0;
     1685    PVDINTERFACEIO pShaIo = 0;
    16781686    PVDINTERFACEIO pTarIo = 0;
    16791687    do
    16801688    {
    1681         pSha1Io = Sha1CreateInterface();
    1682         if (!pSha1Io)
     1689        pShaIo = ShaCreateInterface();
     1690        if (!pShaIo)
    16831691        {
    16841692            rc = E_OUTOFMEMORY;
     
    16911699            break;
    16921700        }
    1693         SHA1STORAGE storage;
     1701        SHASTORAGE storage;
    16941702        RT_ZERO(storage);
    16951703        storage.fCreateDigest = m->fManifest;
     1704        storage.fSha256 = m->fSha256;
    16961705        vrc = VDInterfaceAdd(&pTarIo->Core, "Appliance::IOTar",
    16971706                             VDINTERFACETYPE_IO, tar, sizeof(VDINTERFACEIO),
     
    17021711            break;
    17031712        }
    1704         rc = writeFSImpl(pTask, writeLock, pSha1Io, &storage);
     1713        rc = writeFSImpl(pTask, writeLock, pShaIo, &storage);
    17051714    }while(0);
    17061715
     
    17081717
    17091718    /* Cleanup */
    1710     if (pSha1Io)
    1711         RTMemFree(pSha1Io);
     1719    if (pShaIo)
     1720        RTMemFree(pShaIo);
    17121721    if (pTarIo)
    17131722        RTMemFree(pTarIo);
     
    17211730}
    17221731
    1723 HRESULT Appliance::writeFSImpl(TaskOVF *pTask, AutoWriteLockBase& writeLock, PVDINTERFACEIO pIfIo, PSHA1STORAGE pStorage)
     1732HRESULT Appliance::writeFSImpl(TaskOVF *pTask, AutoWriteLockBase& writeLock, PVDINTERFACEIO pIfIo, PSHASTORAGE pStorage)
    17241733{
    17251734    LogFlowFuncEnter();
     
    17531762                               strOvfFile.c_str());
    17541763            /* Write the ovf file to disk. */
    1755             vrc = Sha1WriteBuf(strOvfFile.c_str(), pvBuf, cbSize, pIfIo, pStorage);
     1764            vrc = ShaWriteBuf(strOvfFile.c_str(), pvBuf, cbSize, pIfIo, pStorage);
    17561765            if (RT_FAILURE(vrc))
    17571766                throw setError(VBOX_E_FILE_ERROR,
     
    18611870            void *pvBuf;
    18621871            size_t cbSize;
    1863             vrc = RTManifestWriteFilesBuf(&pvBuf, &cbSize, paManifestFiles, fileList.size());
     1872            vrc = RTManifestWriteFilesBuf(&pvBuf, &cbSize, m->fSha256 ? RTDIGESTTYPE_SHA256 : RTDIGESTTYPE_SHA1,
     1873                                          paManifestFiles, fileList.size());
    18641874            RTMemFree(paManifestFiles);
    18651875            if (RT_FAILURE(vrc))
     
    18701880            pStorage->fCreateDigest = false;
    18711881            /* Write the manifest file to disk. */
    1872             vrc = Sha1WriteBuf(strMfFilePath.c_str(), pvBuf, cbSize, pIfIo, pStorage);
     1882            vrc = ShaWriteBuf(strMfFilePath.c_str(), pvBuf, cbSize, pIfIo, pStorage);
    18731883            RTMemFree(pvBuf);
    18741884            if (RT_FAILURE(vrc))
  • trunk/src/VBox/Main/src-server/ApplianceImplIO.cpp

    r39352 r40329  
    5353} TARSTORAGEINTERNAL, *PTARSTORAGEINTERNAL;
    5454
    55 typedef struct SHA1STORAGEINTERNAL
     55typedef struct SHASTORAGEINTERNAL
    5656{
    5757    /** Completion callback. */
     
    6262    uint32_t fOpenMode;
    6363    /** Our own storage handle. */
    64     PSHA1STORAGE pSha1Storage;
     64    PSHASTORAGE pShaStorage;
    6565    /** Circular buffer used for transferring data from/to the worker thread. */
    6666    PRTCIRCBUF pCircBuf;
     
    7777    /** Event for signaling a finished task of the worker thread. */
    7878    RTSEMEVENT workFinishedEvent;
    79     /** SHA1 calculation context. */
    80     RTSHA1CONTEXT ctx;
     79    /** SHA1/SHA256 calculation context. */
     80    union
     81    {
     82        RTSHA1CONTEXT    Sha1;
     83        RTSHA256CONTEXT  Sha256;
     84    } ctx;
    8185    /** Write mode only: Memory buffer for writing zeros. */
    8286    void *pvZeroBuf;
     
    8791//    uint64_t calls;
    8892//    uint64_t waits;
    89 } SHA1STORAGEINTERNAL, *PSHA1STORAGEINTERNAL;
     93} SHASTORAGEINTERNAL, *PSHASTORAGEINTERNAL;
    9094
    9195/******************************************************************************
     
    458462
    459463/******************************************************************************
    460  *   Internal: RTSha1 interface
     464 *   Internal: RTSha interface
    461465 ******************************************************************************/
    462466
    463 DECLCALLBACK(int) sha1CalcWorkerThread(RTTHREAD /* aThread */, void *pvUser)
    464 {
    465     /* Validate input. */
    466     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
    467 
    468     PSHA1STORAGEINTERNAL pInt = (PSHA1STORAGEINTERNAL)pvUser;
    469 
    470     PVDINTERFACEIO pIfIo = VDIfIoGet(pInt->pSha1Storage->pVDImageIfaces);
     467DECLCALLBACK(int) shaCalcWorkerThread(RTTHREAD /* aThread */, void *pvUser)
     468{
     469    /* Validate input. */
     470    AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
     471
     472    PSHASTORAGEINTERNAL pInt = (PSHASTORAGEINTERNAL)pvUser;
     473
     474    PVDINTERFACEIO pIfIo = VDIfIoGet(pInt->pShaStorage->pVDImageIfaces);
    471475    AssertPtrReturn(pIfIo, VERR_INVALID_PARAMETER);
    472476
     
    526530                        pInt->cbCurFile += cbWritten;
    527531                    }
    528                     /* Update the SHA1 context with the next data block. */
     532                    /* Update the SHA1/SHA256 context with the next data block. */
    529533                    if (   RT_SUCCESS(rc)
    530                         && pInt->pSha1Storage->fCreateDigest)
    531                         RTSha1Update(&pInt->ctx, pcBuf, cbAllWritten);
     534                        && pInt->pShaStorage->fCreateDigest)
     535                    {
     536                        if (pInt->pShaStorage->fSha256)
     537                            RTSha256Update(&pInt->ctx.Sha256, pcBuf, cbAllWritten);
     538                        else
     539                            RTSha1Update(&pInt->ctx.Sha1, pcBuf, cbAllWritten);
     540                    }
    532541                    /* Mark the block as empty. */
    533542                    RTCircBufReleaseReadBlock(pInt->pCircBuf, cbAllWritten);
     
    585594                        pInt->cbCurFile += cbRead;
    586595                    }
    587                     /* Update the SHA1 context with the next data block. */
     596                    /* Update the SHA1/SHA256 context with the next data block. */
    588597                    if (   RT_SUCCESS(rc)
    589                         && pInt->pSha1Storage->fCreateDigest)
    590                         RTSha1Update(&pInt->ctx, pcBuf, cbAllRead);
     598                        && pInt->pShaStorage->fCreateDigest)
     599                    {
     600                        if (pInt->pShaStorage->fSha256)
     601                            RTSha256Update(&pInt->ctx.Sha256, pcBuf, cbAllRead);
     602                        else
     603                            RTSha1Update(&pInt->ctx.Sha1, pcBuf, cbAllRead);
     604                    }
    591605                    /* Mark the block as full. */
    592606                    RTCircBufReleaseWriteBlock(pInt->pCircBuf, cbAllRead);
     
    614628}
    615629
    616 DECLINLINE(int) sha1SignalManifestThread(PSHA1STORAGEINTERNAL pInt, uint32_t uStatus)
     630DECLINLINE(int) shaSignalManifestThread(PSHASTORAGEINTERNAL pInt, uint32_t uStatus)
    617631{
    618632    ASMAtomicWriteU32(&pInt->u32Status, uStatus);
     
    620634}
    621635
    622 DECLINLINE(int) sha1WaitForManifestThreadFinished(PSHA1STORAGEINTERNAL pInt)
     636DECLINLINE(int) shaWaitForManifestThreadFinished(PSHASTORAGEINTERNAL pInt)
    623637{
    624638//    RTPrintf("start\n");
     
    640654}
    641655
    642 DECLINLINE(int) sha1FlushCurBuf(PSHA1STORAGEINTERNAL pInt)
     656DECLINLINE(int) shaFlushCurBuf(PSHASTORAGEINTERNAL pInt)
    643657{
    644658    int rc = VINF_SUCCESS;
     
    646660    {
    647661        /* Let the write worker thread start immediately. */
    648         rc = sha1SignalManifestThread(pInt, STATUS_WRITE);
     662        rc = shaSignalManifestThread(pInt, STATUS_WRITE);
    649663        if (RT_FAILURE(rc))
    650664            return rc;
    651665
    652666        /* Wait until the write worker thread has finished. */
    653         rc = sha1WaitForManifestThreadFinished(pInt);
     667        rc = shaWaitForManifestThreadFinished(pInt);
    654668    }
    655669
     
    657671}
    658672
    659 static int sha1OpenCallback(void *pvUser, const char *pszLocation, uint32_t fOpen,
     673static int shaOpenCallback(void *pvUser, const char *pszLocation, uint32_t fOpen,
    660674                              PFNVDCOMPLETED pfnCompleted, void **ppInt)
    661675{
     
    667681    AssertReturn((fOpen & RTFILE_O_READWRITE) != RTFILE_O_READWRITE, VERR_INVALID_PARAMETER); /* No read/write allowed */
    668682
    669     PSHA1STORAGE pSha1Storage = (PSHA1STORAGE)pvUser;
    670     PVDINTERFACEIO pIfIo = VDIfIoGet(pSha1Storage->pVDImageIfaces);
     683    PSHASTORAGE pShaStorage = (PSHASTORAGE)pvUser;
     684    PVDINTERFACEIO pIfIo = VDIfIoGet(pShaStorage->pVDImageIfaces);
    671685    AssertPtrReturn(pIfIo, VERR_INVALID_PARAMETER);
    672686
    673687    DEBUG_PRINT_FLOW();
    674688
    675     PSHA1STORAGEINTERNAL pInt = (PSHA1STORAGEINTERNAL)RTMemAllocZ(sizeof(SHA1STORAGEINTERNAL));
     689    PSHASTORAGEINTERNAL pInt = (PSHASTORAGEINTERNAL)RTMemAllocZ(sizeof(SHASTORAGEINTERNAL));
    676690    if (!pInt)
    677691        return VERR_NO_MEMORY;
     
    681695    {
    682696        pInt->pfnCompleted = pfnCompleted;
    683         pInt->pSha1Storage = pSha1Storage;
     697        pInt->pShaStorage  = pShaStorage;
    684698        pInt->fEOF         = false;
    685699        pInt->fOpenMode    = fOpen;
     
    716730            break;
    717731        /* Create the worker thread. */
    718         rc = RTThreadCreate(&pInt->pWorkerThread, sha1CalcWorkerThread, pInt, 0, RTTHREADTYPE_MAIN_HEAVY_WORKER, RTTHREADFLAGS_WAITABLE, "SHA1-Worker");
     732        rc = RTThreadCreate(&pInt->pWorkerThread, shaCalcWorkerThread, pInt, 0, RTTHREADTYPE_MAIN_HEAVY_WORKER, RTTHREADFLAGS_WAITABLE, "SHA-Worker");
    719733        if (RT_FAILURE(rc))
    720734            break;
    721735
    722         if (pSha1Storage->fCreateDigest)
    723             /* Create a SHA1 context the worker thread will work with. */
    724             RTSha1Init(&pInt->ctx);
     736        if (pShaStorage->fCreateDigest)
     737        {
     738            /* Create a SHA1/SHA256 context the worker thread will work with. */
     739            if (pShaStorage->fSha256)
     740                RTSha256Init(&pInt->ctx.Sha256);
     741            else
     742                RTSha1Init(&pInt->ctx.Sha1);
     743        }
    725744
    726745        /* Open the file. */
     
    733752        {
    734753            /* Immediately let the worker thread start the reading. */
    735             rc = sha1SignalManifestThread(pInt, STATUS_READ);
     754            rc = shaSignalManifestThread(pInt, STATUS_READ);
    736755        }
    737756    }
     
    742761        if (pInt->pWorkerThread)
    743762        {
    744             sha1SignalManifestThread(pInt, STATUS_END);
     763            shaSignalManifestThread(pInt, STATUS_END);
    745764            RTThreadWait(pInt->pWorkerThread, RT_INDEFINITE_WAIT, 0);
    746765        }
     
    761780}
    762781
    763 static int sha1CloseCallback(void *pvUser, void *pvStorage)
    764 {
    765     /* Validate input. */
    766     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
    767     AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
    768 
    769     PSHA1STORAGE pSha1Storage = (PSHA1STORAGE)pvUser;
    770     PVDINTERFACEIO pIfIo = VDIfIoGet(pSha1Storage->pVDImageIfaces);
     782static int shaCloseCallback(void *pvUser, void *pvStorage)
     783{
     784    /* Validate input. */
     785    AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
     786    AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
     787
     788    PSHASTORAGE pShaStorage = (PSHASTORAGE)pvUser;
     789    PVDINTERFACEIO pIfIo = VDIfIoGet(pShaStorage->pVDImageIfaces);
    771790    AssertPtrReturn(pIfIo, VERR_INVALID_PARAMETER);
    772791
    773     PSHA1STORAGEINTERNAL pInt = (PSHA1STORAGEINTERNAL)pvStorage;
     792    PSHASTORAGEINTERNAL pInt = (PSHASTORAGEINTERNAL)pvStorage;
    774793
    775794    DEBUG_PRINT_FLOW();
     
    778797
    779798    /* Make sure all pending writes are flushed */
    780     rc = sha1FlushCurBuf(pInt);
     799    rc = shaFlushCurBuf(pInt);
    781800
    782801    if (pInt->pWorkerThread)
    783802    {
    784803        /* Signal the worker thread to end himself */
    785         rc = sha1SignalManifestThread(pInt, STATUS_END);
     804        rc = shaSignalManifestThread(pInt, STATUS_END);
    786805        /* Worker thread stopped? */
    787806        rc = RTThreadWait(pInt->pWorkerThread, RT_INDEFINITE_WAIT, 0);
     
    789808
    790809    if (   RT_SUCCESS(rc)
    791         && pSha1Storage->fCreateDigest)
    792     {
    793         /* Finally calculate & format the SHA1 sum */
    794         unsigned char auchDig[RTSHA1_HASH_SIZE];
     810        && pShaStorage->fCreateDigest)
     811    {
     812        /* Finally calculate & format the SHA1/SHA256 sum */
     813        unsigned char auchDig[RTSHA256_HASH_SIZE];
    795814        char *pszDigest;
    796         RTSha1Final(&pInt->ctx, auchDig);
    797         rc = RTStrAllocEx(&pszDigest, RTSHA1_DIGEST_LEN + 1);
     815        size_t cbDigest;
     816        if (pShaStorage->fSha256)
     817        {
     818            RTSha256Final(&pInt->ctx.Sha256, auchDig);
     819            cbDigest = RTSHA256_DIGEST_LEN;
     820        }
     821        else
     822        {
     823            RTSha1Final(&pInt->ctx.Sha1, auchDig);
     824            cbDigest = RTSHA1_DIGEST_LEN;
     825        }
     826        rc = RTStrAllocEx(&pszDigest, cbDigest + 1);
    798827        if (RT_SUCCESS(rc))
    799828        {
    800             rc = RTSha1ToString(auchDig, pszDigest, RTSHA1_DIGEST_LEN + 1);
     829            if (pShaStorage->fSha256)
     830                rc = RTSha256ToString(auchDig, pszDigest, cbDigest + 1);
     831            else
     832                rc = RTSha1ToString(auchDig, pszDigest, cbDigest + 1);
    801833            if (RT_SUCCESS(rc))
    802                 pSha1Storage->strDigest = pszDigest;
     834                pShaStorage->strDigest = pszDigest;
    803835            RTStrFree(pszDigest);
    804836        }
     
    824856}
    825857
    826 static int sha1DeleteCallback(void *pvUser, const char *pcszFilename)
    827 {
    828     /* Validate input. */
    829     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
    830 
    831     PSHA1STORAGE pSha1Storage = (PSHA1STORAGE)pvUser;
    832     PVDINTERFACEIO pIfIo = VDIfIoGet(pSha1Storage->pVDImageIfaces);
     858static int shaDeleteCallback(void *pvUser, const char *pcszFilename)
     859{
     860    /* Validate input. */
     861    AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
     862
     863    PSHASTORAGE pShaStorage = (PSHASTORAGE)pvUser;
     864    PVDINTERFACEIO pIfIo = VDIfIoGet(pShaStorage->pVDImageIfaces);
    833865    AssertPtrReturn(pIfIo, VERR_INVALID_PARAMETER);
    834866
     
    838870}
    839871
    840 static int sha1MoveCallback(void *pvUser, const char *pcszSrc, const char *pcszDst, unsigned fMove)
    841 {
    842     /* Validate input. */
    843     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
    844 
    845     PSHA1STORAGE pSha1Storage = (PSHA1STORAGE)pvUser;
    846     PVDINTERFACEIO pIfIo = VDIfIoGet(pSha1Storage->pVDImageIfaces);
     872static int shaMoveCallback(void *pvUser, const char *pcszSrc, const char *pcszDst, unsigned fMove)
     873{
     874    /* Validate input. */
     875    AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
     876
     877    PSHASTORAGE pShaStorage = (PSHASTORAGE)pvUser;
     878    PVDINTERFACEIO pIfIo = VDIfIoGet(pShaStorage->pVDImageIfaces);
    847879    AssertPtrReturn(pIfIo, VERR_INVALID_PARAMETER);
    848880
     
    853885}
    854886
    855 static int sha1GetFreeSpaceCallback(void *pvUser, const char *pcszFilename, int64_t *pcbFreeSpace)
    856 {
    857     /* Validate input. */
    858     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
    859 
    860     PSHA1STORAGE pSha1Storage = (PSHA1STORAGE)pvUser;
    861     PVDINTERFACEIO pIfIo = VDIfIoGet(pSha1Storage->pVDImageIfaces);
     887static int shaGetFreeSpaceCallback(void *pvUser, const char *pcszFilename, int64_t *pcbFreeSpace)
     888{
     889    /* Validate input. */
     890    AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
     891
     892    PSHASTORAGE pShaStorage = (PSHASTORAGE)pvUser;
     893    PVDINTERFACEIO pIfIo = VDIfIoGet(pShaStorage->pVDImageIfaces);
    862894    AssertPtrReturn(pIfIo, VERR_INVALID_PARAMETER);
    863895
     
    867899}
    868900
    869 static int sha1GetModificationTimeCallback(void *pvUser, const char *pcszFilename, PRTTIMESPEC pModificationTime)
    870 {
    871     /* Validate input. */
    872     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
    873 
    874     PSHA1STORAGE pSha1Storage = (PSHA1STORAGE)pvUser;
    875     PVDINTERFACEIO pIfIo = VDIfIoGet(pSha1Storage->pVDImageIfaces);
     901static int shaGetModificationTimeCallback(void *pvUser, const char *pcszFilename, PRTTIMESPEC pModificationTime)
     902{
     903    /* Validate input. */
     904    AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
     905
     906    PSHASTORAGE pShaStorage = (PSHASTORAGE)pvUser;
     907    PVDINTERFACEIO pIfIo = VDIfIoGet(pShaStorage->pVDImageIfaces);
    876908    AssertPtrReturn(pIfIo, VERR_INVALID_PARAMETER);
    877909
     
    882914
    883915
    884 static int sha1GetSizeCallback(void *pvUser, void *pvStorage, uint64_t *pcbSize)
    885 {
    886     /* Validate input. */
    887     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
    888     AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
    889 
    890     PSHA1STORAGE pSha1Storage = (PSHA1STORAGE)pvUser;
    891     PVDINTERFACEIO pIfIo = VDIfIoGet(pSha1Storage->pVDImageIfaces);
     916static int shaGetSizeCallback(void *pvUser, void *pvStorage, uint64_t *pcbSize)
     917{
     918    /* Validate input. */
     919    AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
     920    AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
     921
     922    PSHASTORAGE pShaStorage = (PSHASTORAGE)pvUser;
     923    PVDINTERFACEIO pIfIo = VDIfIoGet(pShaStorage->pVDImageIfaces);
    892924    AssertPtrReturn(pIfIo, VERR_INVALID_PARAMETER);
    893925
    894     PSHA1STORAGEINTERNAL pInt = (PSHA1STORAGEINTERNAL)pvStorage;
     926    PSHASTORAGEINTERNAL pInt = (PSHASTORAGEINTERNAL)pvStorage;
    895927
    896928    DEBUG_PRINT_FLOW();
     
    906938}
    907939
    908 static int sha1SetSizeCallback(void *pvUser, void *pvStorage, uint64_t cbSize)
    909 {
    910     /* Validate input. */
    911     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
    912     AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
    913 
    914     PSHA1STORAGE pSha1Storage = (PSHA1STORAGE)pvUser;
    915     PVDINTERFACEIO pIfIo = VDIfIoGet(pSha1Storage->pVDImageIfaces);
     940static int shaSetSizeCallback(void *pvUser, void *pvStorage, uint64_t cbSize)
     941{
     942    /* Validate input. */
     943    AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
     944    AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
     945
     946    PSHASTORAGE pShaStorage = (PSHASTORAGE)pvUser;
     947    PVDINTERFACEIO pIfIo = VDIfIoGet(pShaStorage->pVDImageIfaces);
    916948    AssertPtrReturn(pIfIo, VERR_INVALID_PARAMETER);
    917949
    918     PSHA1STORAGEINTERNAL pInt = (PSHA1STORAGEINTERNAL)pvStorage;
     950    PSHASTORAGEINTERNAL pInt = (PSHASTORAGEINTERNAL)pvStorage;
    919951
    920952    DEBUG_PRINT_FLOW();
     
    923955}
    924956
    925 static int sha1WriteSyncCallback(void *pvUser, void *pvStorage, uint64_t uOffset,
     957static int shaWriteSyncCallback(void *pvUser, void *pvStorage, uint64_t uOffset,
    926958                                 const void *pvBuf, size_t cbWrite, size_t *pcbWritten)
    927959{
     
    930962    AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
    931963
    932     PSHA1STORAGE pSha1Storage = (PSHA1STORAGE)pvUser;
    933     PVDINTERFACEIO pIfIo = VDIfIoGet(pSha1Storage->pVDImageIfaces);
     964    PSHASTORAGE pShaStorage = (PSHASTORAGE)pvUser;
     965    PVDINTERFACEIO pIfIo = VDIfIoGet(pShaStorage->pVDImageIfaces);
    934966    AssertPtrReturn(pIfIo, VERR_INVALID_PARAMETER);
    935967
    936     PSHA1STORAGEINTERNAL pInt = (PSHA1STORAGEINTERNAL)pvStorage;
     968    PSHASTORAGEINTERNAL pInt = (PSHASTORAGEINTERNAL)pvStorage;
    937969
    938970    DEBUG_PRINT_FLOW();
     
    956988            size_t cbToWrite = RT_MIN(pInt->cbZeroBuf, cbSize - cbAllWritten);
    957989            size_t cbWritten = 0;
    958             rc = sha1WriteSyncCallback(pvUser, pvStorage, pInt->cbCurAll,
    959                                        pInt->pvZeroBuf, cbToWrite, &cbWritten);
     990            rc = shaWriteSyncCallback(pvUser, pvStorage, pInt->cbCurAll,
     991                                      pInt->pvZeroBuf, cbToWrite, &cbWritten);
    960992            if (RT_FAILURE(rc))
    961993                break;
     
    9811013        if ((cbWrite - cbAllWritten) > cbAvail)
    9821014        {
    983             rc = sha1SignalManifestThread(pInt, STATUS_WRITE);
     1015            rc = shaSignalManifestThread(pInt, STATUS_WRITE);
    9841016            if(RT_FAILURE(rc))
    9851017                break;
     
    9871019            if (cbAvail == 0)
    9881020            {
    989                 rc = sha1WaitForManifestThreadFinished(pInt);
     1021                rc = shaWaitForManifestThreadFinished(pInt);
    9901022                if (RT_FAILURE(rc))
    9911023                    break;
     
    10131045    if (   RT_SUCCESS(rc)
    10141046           && RTCircBufUsed(pInt->pCircBuf) >= (RTCircBufSize(pInt->pCircBuf) / 2))
    1015         rc = sha1SignalManifestThread(pInt, STATUS_WRITE);
     1047        rc = shaSignalManifestThread(pInt, STATUS_WRITE);
    10161048
    10171049    return rc;
    10181050}
    10191051
    1020 static int sha1ReadSyncCallback(void *pvUser, void *pvStorage, uint64_t uOffset,
    1021                                   void *pvBuf, size_t cbRead, size_t *pcbRead)
    1022 {
    1023     /* Validate input. */
    1024     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
    1025     AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
    1026 
    1027     PSHA1STORAGE pSha1Storage = (PSHA1STORAGE)pvUser;
    1028     PVDINTERFACEIO pIfIo = VDIfIoGet(pSha1Storage->pVDImageIfaces);
     1052static int shaReadSyncCallback(void *pvUser, void *pvStorage, uint64_t uOffset,
     1053                               void *pvBuf, size_t cbRead, size_t *pcbRead)
     1054{
     1055    /* Validate input. */
     1056    AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
     1057    AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
     1058
     1059    PSHASTORAGE pShaStorage = (PSHASTORAGE)pvUser;
     1060    PVDINTERFACEIO pIfIo = VDIfIoGet(pShaStorage->pVDImageIfaces);
    10291061    AssertPtrReturn(pIfIo, VERR_INVALID_PARAMETER);
    10301062
    10311063//    DEBUG_PRINT_FLOW();
    10321064
    1033     PSHA1STORAGEINTERNAL pInt = (PSHA1STORAGEINTERNAL)pvStorage;
     1065    PSHASTORAGEINTERNAL pInt = (PSHASTORAGEINTERNAL)pvStorage;
    10341066
    10351067    int rc = VINF_SUCCESS;
     
    10391071
    10401072    /* Check if we jump forward in the file. If so we have to read the
    1041      * remaining stuff in the gap anyway (SHA1; streaming). */
     1073     * remaining stuff in the gap anyway (SHA1/SHA256; streaming). */
    10421074    if (pInt->cbCurAll < uOffset)
    10431075    {
    1044         rc = sha1ReadSyncCallback(pvUser, pvStorage, pInt->cbCurAll, 0,
    1045                                   (size_t)(uOffset - pInt->cbCurAll), 0);
     1076        rc = shaReadSyncCallback(pvUser, pvStorage, pInt->cbCurAll, 0,
     1077                                 (size_t)(uOffset - pInt->cbCurAll), 0);
    10461078        if (RT_FAILURE(rc))
    10471079            return rc;
     
    10661098        if ((cbRead - cbAllRead) > cbAvail)
    10671099        {
    1068             rc = sha1SignalManifestThread(pInt, STATUS_READ);
     1100            rc = shaSignalManifestThread(pInt, STATUS_READ);
    10691101            if(RT_FAILURE(rc))
    10701102                break;
     
    10721104            if (cbAvail == 0)
    10731105            {
    1074                 rc = sha1WaitForManifestThreadFinished(pInt);
     1106                rc = shaWaitForManifestThreadFinished(pInt);
    10751107                if (RT_FAILURE(rc))
    10761108                    break;
     
    11031135    if (   RT_SUCCESS(rc)
    11041136        && RTCircBufFree(pInt->pCircBuf) >= (RTCircBufSize(pInt->pCircBuf) / 2))
    1105         rc = sha1SignalManifestThread(pInt, STATUS_READ);
     1137        rc = shaSignalManifestThread(pInt, STATUS_READ);
    11061138
    11071139    return rc;
    11081140}
    11091141
    1110 static int sha1FlushSyncCallback(void *pvUser, void *pvStorage)
    1111 {
    1112     /* Validate input. */
    1113     AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
    1114     AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
    1115 
    1116     PSHA1STORAGE pSha1Storage = (PSHA1STORAGE)pvUser;
    1117     PVDINTERFACEIO pIfIo = VDIfIoGet(pSha1Storage->pVDImageIfaces);
     1142static int shaFlushSyncCallback(void *pvUser, void *pvStorage)
     1143{
     1144    /* Validate input. */
     1145    AssertPtrReturn(pvUser, VERR_INVALID_POINTER);
     1146    AssertPtrReturn(pvStorage, VERR_INVALID_POINTER);
     1147
     1148    PSHASTORAGE pShaStorage = (PSHASTORAGE)pvUser;
     1149    PVDINTERFACEIO pIfIo = VDIfIoGet(pShaStorage->pVDImageIfaces);
    11181150    AssertPtrReturn(pIfIo, VERR_INVALID_PARAMETER);
    11191151
    11201152    DEBUG_PRINT_FLOW();
    11211153
    1122     PSHA1STORAGEINTERNAL pInt = (PSHA1STORAGEINTERNAL)pvStorage;
     1154    PSHASTORAGEINTERNAL pInt = (PSHASTORAGEINTERNAL)pvStorage;
    11231155
    11241156    /* Check if there is still something in the buffer. If yes, flush it. */
    1125     int rc = sha1FlushCurBuf(pInt);
     1157    int rc = shaFlushCurBuf(pInt);
    11261158    if (RT_FAILURE(rc))
    11271159        return rc;
     
    11341166 ******************************************************************************/
    11351167
    1136 PVDINTERFACEIO Sha1CreateInterface()
     1168PVDINTERFACEIO ShaCreateInterface()
    11371169{
    11381170    PVDINTERFACEIO pCallbacks = (PVDINTERFACEIO)RTMemAllocZ(sizeof(VDINTERFACEIO));
     
    11401172        return NULL;
    11411173
    1142     pCallbacks->pfnOpen                = sha1OpenCallback;
    1143     pCallbacks->pfnClose               = sha1CloseCallback;
    1144     pCallbacks->pfnDelete              = sha1DeleteCallback;
    1145     pCallbacks->pfnMove                = sha1MoveCallback;
    1146     pCallbacks->pfnGetFreeSpace        = sha1GetFreeSpaceCallback;
    1147     pCallbacks->pfnGetModificationTime = sha1GetModificationTimeCallback;
    1148     pCallbacks->pfnGetSize             = sha1GetSizeCallback;
    1149     pCallbacks->pfnSetSize             = sha1SetSizeCallback;
    1150     pCallbacks->pfnReadSync            = sha1ReadSyncCallback;
    1151     pCallbacks->pfnWriteSync           = sha1WriteSyncCallback;
    1152     pCallbacks->pfnFlushSync           = sha1FlushSyncCallback;
     1174    pCallbacks->pfnOpen                = shaOpenCallback;
     1175    pCallbacks->pfnClose               = shaCloseCallback;
     1176    pCallbacks->pfnDelete              = shaDeleteCallback;
     1177    pCallbacks->pfnMove                = shaMoveCallback;
     1178    pCallbacks->pfnGetFreeSpace        = shaGetFreeSpaceCallback;
     1179    pCallbacks->pfnGetModificationTime = shaGetModificationTimeCallback;
     1180    pCallbacks->pfnGetSize             = shaGetSizeCallback;
     1181    pCallbacks->pfnSetSize             = shaSetSizeCallback;
     1182    pCallbacks->pfnReadSync            = shaReadSyncCallback;
     1183    pCallbacks->pfnWriteSync           = shaWriteSyncCallback;
     1184    pCallbacks->pfnFlushSync           = shaFlushSyncCallback;
    11531185
    11541186    return pCallbacks;
     
    11971229}
    11981230
    1199 int Sha1ReadBuf(const char *pcszFilename, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pIfIo, void *pvUser)
     1231int ShaReadBuf(const char *pcszFilename, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pIfIo, void *pvUser)
    12001232{
    12011233    /* Validate input. */
     
    12631295}
    12641296
    1265 int Sha1WriteBuf(const char *pcszFilename, void *pvBuf, size_t cbSize, PVDINTERFACEIO pIfIo, void *pvUser)
     1297int ShaWriteBuf(const char *pcszFilename, void *pvBuf, size_t cbSize, PVDINTERFACEIO pIfIo, void *pvUser)
    12661298{
    12671299    /* Validate input. */
  • trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp

    r39248 r40329  
    818818    HRESULT rc = S_OK;
    819819
    820     PVDINTERFACEIO pSha1Io = 0;
     820    PVDINTERFACEIO pShaIo = 0;
    821821    PVDINTERFACEIO pFileIo = 0;
    822822    do
    823823    {
    824         pSha1Io = Sha1CreateInterface();
    825         if (!pSha1Io)
     824        pShaIo = ShaCreateInterface();
     825        if (!pShaIo)
    826826        {
    827827            rc = E_OUTOFMEMORY;
     
    834834            break;
    835835        }
    836         SHA1STORAGE storage;
     836        SHASTORAGE storage;
    837837        RT_ZERO(storage);
    838838        int vrc = VDInterfaceAdd(&pFileIo->Core, "Appliance::IOFile",
     
    845845        }
    846846
    847         rc = readFSImpl(pTask, pTask->locInfo.strPath, pSha1Io, &storage);
     847        rc = readFSImpl(pTask, pTask->locInfo.strPath, pShaIo, &storage);
    848848    }while(0);
    849849
    850850    /* Cleanup */
    851     if (pSha1Io)
    852         RTMemFree(pSha1Io);
     851    if (pShaIo)
     852        RTMemFree(pShaIo);
    853853    if (pFileIo)
    854854        RTMemFree(pFileIo);
     
    873873    HRESULT rc = S_OK;
    874874
    875     PVDINTERFACEIO pSha1Io = 0;
     875    PVDINTERFACEIO pShaIo = 0;
    876876    PVDINTERFACEIO pTarIo = 0;
    877877    char *pszFilename = 0;
     
    884884            break;
    885885        }
    886         pSha1Io = Sha1CreateInterface();
    887         if (!pSha1Io)
     886        pShaIo = ShaCreateInterface();
     887        if (!pShaIo)
    888888        {
    889889            rc = E_OUTOFMEMORY;
     
    896896            break;
    897897        }
    898         SHA1STORAGE storage;
     898        SHASTORAGE storage;
    899899        RT_ZERO(storage);
    900900        vrc = VDInterfaceAdd(&pTarIo->Core, "Appliance::IOTar",
     
    906906            break;
    907907        }
    908         rc = readFSImpl(pTask, pszFilename, pSha1Io, &storage);
     908        rc = readFSImpl(pTask, pszFilename, pShaIo, &storage);
    909909    }while(0);
    910910
     
    914914    if (pszFilename)
    915915        RTMemFree(pszFilename);
    916     if (pSha1Io)
    917         RTMemFree(pSha1Io);
     916    if (pShaIo)
     917        RTMemFree(pShaIo);
    918918    if (pTarIo)
    919919        RTMemFree(pTarIo);
     
    925925}
    926926
    927 HRESULT Appliance::readFSImpl(TaskOVF *pTask, const RTCString &strFilename, PVDINTERFACEIO pIfIo, PSHA1STORAGE pStorage)
     927HRESULT Appliance::readFSImpl(TaskOVF *pTask, const RTCString &strFilename, PVDINTERFACEIO pIfIo, PSHASTORAGE pStorage)
    928928{
    929929    LogFlowFuncEnter();
     
    938938        /* Read the OVF into a memory buffer */
    939939        size_t cbSize = 0;
    940         int vrc = Sha1ReadBuf(strFilename.c_str(), &pvTmpBuf, &cbSize, pIfIo, pStorage);
     940        int vrc = ShaReadBuf(strFilename.c_str(), &pvTmpBuf, &cbSize, pIfIo, pStorage);
    941941        if (   RT_FAILURE(vrc)
    942942            || !pvTmpBuf)
     
    944944                           tr("Could not read OVF file '%s' (%Rrc)"),
    945945                           RTPathFilename(strFilename.c_str()), vrc);
    946         /* Copy the SHA1 sum of the OVF file for later validation */
    947         m->strOVFSHA1Digest = pStorage->strDigest;
     946        /* Copy the SHA1/SHA256 sum of the OVF file for later validation */
     947        m->strOVFSHADigest = pStorage->strDigest;
    948948        /* Read & parse the XML structure of the OVF file */
    949949        m->pReader = new ovf::OVFReader(pvTmpBuf, cbSize, pTask->locInfo.strPath);
     
    12331233    HRESULT rc = S_OK;
    12341234
    1235     PVDINTERFACEIO pSha1Io = 0;
     1235    PVDINTERFACEIO pShaIo = 0;
    12361236    PVDINTERFACEIO pFileIo = 0;
    12371237    void *pvMfBuf = 0;
     
    12401240    {
    12411241        /* Create the necessary file access interfaces. */
    1242         pSha1Io = Sha1CreateInterface();
    1243         if (!pSha1Io)
     1242        pShaIo = ShaCreateInterface();
     1243        if (!pShaIo)
    12441244            throw setError(E_OUTOFMEMORY);
    12451245        pFileIo = FileCreateInterface();
     
    12471247            throw setError(E_OUTOFMEMORY);
    12481248
    1249         SHA1STORAGE storage;
     1249        SHASTORAGE storage;
    12501250        RT_ZERO(storage);
    12511251        storage.fCreateDigest = true;
     
    12631263        storage.fCreateDigest = RTFileExists(strMfFile.c_str());
    12641264        /* Now import the appliance. */
    1265         importMachines(stack, pSha1Io, &storage);
     1265        importMachines(stack, pShaIo, &storage);
    12661266        /* Read & verify the manifest file, if there is one. */
    12671267        if (storage.fCreateDigest)
    12681268        {
    12691269            /* Add the ovf file to the digest list. */
    1270             stack.llSrcDisksDigest.push_front(STRPAIR(pTask->locInfo.strPath, m->strOVFSHA1Digest));
    1271             rc = readManifestFile(strMfFile, &pvMfBuf, &cbMfSize, pSha1Io, &storage);
     1270            stack.llSrcDisksDigest.push_front(STRPAIR(pTask->locInfo.strPath, m->strOVFSHADigest));
     1271            rc = readManifestFile(strMfFile, &pvMfBuf, &cbMfSize, pShaIo, &storage);
    12721272            if (FAILED(rc)) throw rc;
    12731273            rc = verifyManifestFile(strMfFile, stack, pvMfBuf, cbMfSize);
     
    12841284    if (pvMfBuf)
    12851285        RTMemFree(pvMfBuf);
    1286     if (pSha1Io)
    1287         RTMemFree(pSha1Io);
     1286    if (pShaIo)
     1287        RTMemFree(pShaIo);
    12881288    if (pFileIo)
    12891289        RTMemFree(pFileIo);
     
    13081308    HRESULT rc = S_OK;
    13091309
    1310     PVDINTERFACEIO pSha1Io = 0;
     1310    PVDINTERFACEIO pShaIo = 0;
    13111311    PVDINTERFACEIO pTarIo = 0;
    13121312    char *pszFilename = 0;
     
    13161316    {
    13171317        /* Create the necessary file access interfaces. */
    1318         pSha1Io = Sha1CreateInterface();
    1319         if (!pSha1Io)
     1318        pShaIo = ShaCreateInterface();
     1319        if (!pShaIo)
    13201320            throw setError(E_OUTOFMEMORY);
    13211321        pTarIo = TarCreateInterface();
     
    13231323            throw setError(E_OUTOFMEMORY);
    13241324
    1325         SHA1STORAGE storage;
     1325        SHASTORAGE storage;
    13261326        RT_ZERO(storage);
    13271327        vrc = VDInterfaceAdd(&pTarIo->Core, "Appliance::IOTar",
     
    13451345                           tr("Seeking within the archive failed (%Rrc)"), vrc);
    13461346
    1347         PVDINTERFACEIO pCallbacks = pSha1Io;
    1348         PSHA1STORAGE pStorage = &storage;
     1347        PVDINTERFACEIO pCallbacks = pShaIo;
     1348        PSHASTORAGE pStorage = &storage;
    13491349
    13501350        /* We always need to create the digest, cause we didn't know if there
     
    13821382        {
    13831383            /* Add the ovf file to the digest list. */
    1384             stack.llSrcDisksDigest.push_front(STRPAIR(Utf8Str(pszFilename).stripExt().append(".ovf"), m->strOVFSHA1Digest));
     1384            stack.llSrcDisksDigest.push_front(STRPAIR(Utf8Str(pszFilename).stripExt().append(".ovf"), m->strOVFSHADigest));
    13851385            rc = verifyManifestFile(strMfFile, stack, pvMfBuf, cbMfSize);
    13861386            if (FAILED(rc)) throw rc;
     
    14001400    if (pvMfBuf)
    14011401        RTMemFree(pvMfBuf);
    1402     if (pSha1Io)
    1403         RTMemFree(pSha1Io);
     1402    if (pShaIo)
     1403        RTMemFree(pShaIo);
    14041404    if (pTarIo)
    14051405        RTMemFree(pTarIo);
     
    16041604#endif /* VBOX_WITH_S3 */
    16051605
    1606 HRESULT Appliance::readManifestFile(const Utf8Str &strFile, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pCallbacks, PSHA1STORAGE pStorage)
     1606HRESULT Appliance::readManifestFile(const Utf8Str &strFile, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pCallbacks, PSHASTORAGE pStorage)
    16071607{
    16081608    HRESULT rc = S_OK;
     
    16101610    bool fOldDigest = pStorage->fCreateDigest;
    16111611    pStorage->fCreateDigest = false; /* No digest for the manifest file */
    1612     int vrc = Sha1ReadBuf(strFile.c_str(), ppvBuf, pcbSize, pCallbacks, pStorage);
     1612    int vrc = ShaReadBuf(strFile.c_str(), ppvBuf, pcbSize, pCallbacks, pStorage);
    16131613    if (   RT_FAILURE(vrc)
    16141614        && vrc != VERR_FILE_NOT_FOUND)
     
    16211621}
    16221622
    1623 HRESULT Appliance::readTarManifestFile(RTTAR tar, const Utf8Str &strFile, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pCallbacks, PSHA1STORAGE pStorage)
     1623HRESULT Appliance::readTarManifestFile(RTTAR tar, const Utf8Str &strFile, void **ppvBuf, size_t *pcbSize, PVDINTERFACEIO pCallbacks, PSHASTORAGE pStorage)
    16241624{
    16251625    HRESULT rc = S_OK;
     
    17951795                                   ImportStack &stack,
    17961796                                   PVDINTERFACEIO pCallbacks,
    1797                                    PSHA1STORAGE pStorage)
     1797                                   PSHASTORAGE pStorage)
    17981798{
    17991799    ComObjPtr<Progress> pProgress;
     
    19341934                                     ImportStack &stack,
    19351935                                     PVDINTERFACEIO pCallbacks,
    1936                                      PSHA1STORAGE pStorage)
     1936                                     PSHASTORAGE pStorage)
    19371937{
    19381938    HRESULT rc;
     
    25022502                                  ImportStack &stack,
    25032503                                  PVDINTERFACEIO pCallbacks,
    2504                                   PSHA1STORAGE pStorage)
     2504                                  PSHASTORAGE pStorage)
    25052505{
    25062506    Assert(vsdescThis->m->pConfig);
     
    28142814void Appliance::importMachines(ImportStack &stack,
    28152815                               PVDINTERFACEIO pCallbacks,
    2816                                PSHA1STORAGE pStorage)
     2816                               PSHASTORAGE pStorage)
    28172817{
    28182818    HRESULT rc = S_OK;
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