VirtualBox

Ignore:
Timestamp:
Mar 2, 2012 4:13:50 PM (13 years ago)
Author:
vboxsync
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/checksum/manifest.cpp

    r33289 r40329  
    196196}
    197197
    198 RTR3DECL(int) RTManifestWriteFiles(const char *pszManifestFile, const char * const *papszFiles, size_t cFiles,
     198RTR3DECL(int) RTManifestWriteFiles(const char *pszManifestFile, RTDIGESTTYPE enmDigestType,
     199                                   const char * const *papszFiles, size_t cFiles,
    199200                                   PFNRTPROGRESS pfnProgressCallback, void *pvUser)
    200201{
     
    239240        {
    240241            size_t cbSize = 0;
    241             rc = RTManifestWriteFilesBuf(&pvBuf, &cbSize, paFiles, cFiles);
     242            rc = RTManifestWriteFilesBuf(&pvBuf, &cbSize, enmDigestType, paFiles, cFiles);
    242243            if (RT_FAILURE(rc))
    243244                break;
     
    442443}
    443444
    444 RTR3DECL(int) RTManifestWriteFilesBuf(void **ppvBuf, size_t *pcbSize, PRTMANIFESTTEST paFiles, size_t cFiles)
     445RTR3DECL(int) RTManifestWriteFilesBuf(void **ppvBuf, size_t *pcbSize, RTDIGESTTYPE enmDigestType, PRTMANIFESTTEST paFiles, size_t cFiles)
    445446{
    446447    /* Validate input */
     
    468469    char * pszTmp = RTStrAlloc(cbMaxSize + 1);
    469470    size_t cbPos = 0;
     471    const char *pcszDigestType;
     472    switch (enmDigestType)
     473    {
     474        case RTDIGESTTYPE_CRC32:  pcszDigestType = "CRC32:"; break;
     475        case RTDIGESTTYPE_CRC64:  pcszDigestType = "CRC64:"; break;
     476        case RTDIGESTTYPE_MD5:    pcszDigestType = "MD5:";   break;
     477        case RTDIGESTTYPE_SHA1:   pcszDigestType = "SHA1:";  break;
     478        case RTDIGESTTYPE_SHA256: pcszDigestType = "SHA256"; break;
     479        default: return VERR_INVALID_PARAMETER;
     480    }
    470481    for (size_t i = 0; i < cFiles; ++i)
    471482    {
    472         size_t cch = RTStrPrintf(pszTmp, cbMaxSize + 1, "SHA1 (%s)= %s\n", RTPathFilename(paFiles[i].pszTestFile), paFiles[i].pszTestDigest);
     483        size_t cch = RTStrPrintf(pszTmp, cbMaxSize + 1, "%s (%s)= %s\n", pcszDigestType, RTPathFilename(paFiles[i].pszTestFile), paFiles[i].pszTestDigest);
    473484        memcpy(&((char*)pvBuf)[cbPos], pszTmp, cch);
    474485        cbPos += cch;
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