- Timestamp:
- Oct 2, 2009 10:59:42 AM (15 years ago)
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 3 added
- 3 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/Makefile.kmk
r23452 r23501 848 848 common/misc/s3.cpp \ 849 849 r3/xml.cpp \ 850 common/checksum/RTSha1Digest.cpp \ 851 common/checksum/manifest.cpp \ 850 852 common/checksum/sha1.cpp \ 851 common/checksum/manifest.cpp 853 common/checksum/sha256.cpp \ 854 common/checksum/sha512.cpp 852 855 VBoxRT_SOURCES.$(KBUILD_TARGET) = $(RuntimeR3_SOURCES.$(KBUILD_TARGET)) 853 856 VBoxRT_SOURCES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH) = $(RuntimeR3_SOURCES.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) -
trunk/src/VBox/Runtime/common/checksum/RTSha1Digest.cpp
r23489 r23501 29 29 */ 30 30 31 #include <iprt/sha1.h> 31 32 /******************************************************************************* 33 * Header Files * 34 *******************************************************************************/ 35 #include "internal/iprt.h" 36 #include <iprt/sha.h> 37 38 #include <iprt/assert.h> 39 #include <iprt/err.h> 32 40 #include <iprt/stream.h> 33 41 #include <iprt/string.h> 34 #include <iprt/assert.h>35 #include <iprt/err.h>36 42 37 43 #include <openssl/sha.h> 38 44 39 /******************************************************************************* 40 * Public RTSha1Digest interface * 41 *******************************************************************************/ 45 42 46 43 47 RTR3DECL(int) RTSha1Digest(const char *pszFile, char **ppszDigest) 44 48 { 45 49 /* Validate input */ 46 if (!pszFile || !ppszDigest) 47 { 48 AssertMsgFailed(("Must supply pszFile and ppszDigest!\n")); 49 return VERR_INVALID_PARAMETER; 50 } 50 AssertPtrReturn(pszFile, VERR_INVALID_POINTER); 51 AssertPtrReturn(ppszDigest, VERR_INVALID_POINTER); 51 52 52 53 *ppszDigest = NULL; … … 56 57 if (!SHA1_Init(&ctx)) 57 58 return VERR_INTERNAL_ERROR; 59 60 /** @todo r=bird: Using a stream here doesn't really serve much purpose as 61 * few stream implementations uses a buffer much larger than 4KB. (The 62 * only I'm aware of is libc on OS/2, which uses 8KB.) */ 58 63 59 64 /* Open the file to calculate a SHA1 sum of */ … … 77 82 break; 78 83 } 79 } 80 while (cbRead > 0); 84 } while (cbRead > 0); 81 85 RTStrmClose(pStream); 82 86 … … 85 89 86 90 /* Finally calculate & format the SHA1 sum */ 87 unsigned char pucDig[20];88 if (!SHA1_Final( pucDig, &ctx))91 unsigned char auchDig[20]; 92 if (!SHA1_Final(auchDig, &ctx)) 89 93 return VERR_INTERNAL_ERROR; 90 94 91 int c bRet= RTStrAPrintf(ppszDigest, "%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x",92 pucDig[0] , pucDig[1] , pucDig[2] , pucDig[3] , pucDig[4],93 pucDig[5] , pucDig[6] , pucDig[7] , pucDig[8] , pucDig[9],94 pucDig[10], pucDig[11], pucDig[12], pucDig[13], pucDig[14],95 pucDig[15], pucDig[16], pucDig[17], pucDig[18], pucDig[19]);96 if (RT_UNLIKELY(c bRet== -1))95 int cch = RTStrAPrintf(ppszDigest, "%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x", 96 auchDig[0] , auchDig[1] , auchDig[2] , auchDig[3] , auchDig[4], 97 auchDig[5] , auchDig[6] , auchDig[7] , auchDig[8] , auchDig[9], 98 auchDig[10], auchDig[11], auchDig[12], auchDig[13], auchDig[14], 99 auchDig[15], auchDig[16], auchDig[17], auchDig[18], auchDig[19]); 100 if (RT_UNLIKELY(cch == -1)) 97 101 rc = VERR_INTERNAL_ERROR; 98 102 -
trunk/src/VBox/Runtime/common/checksum/manifest.cpp
r23499 r23501 40 40 #include <iprt/mem.h> 41 41 #include <iprt/path.h> 42 #include <iprt/sha 1.h>42 #include <iprt/sha.h> 43 43 #include <iprt/stream.h> 44 44 #include <iprt/string.h> -
trunk/src/VBox/Runtime/testcase/Makefile.kmk
r23452 r23501 55 55 tstRTCritSect \ 56 56 tstDeadlock \ 57 tstRTDigest \ 57 58 tstDir \ 58 59 tstDir-2 \ … … 167 168 tstDeadlock_SOURCES = tstDeadlock.cpp 168 169 170 tstRTDigest_SOURCES = tstRTDigest.cpp 171 169 172 tstDir_SOURCES = tstDir.cpp 170 173
Note:
See TracChangeset
for help on using the changeset viewer.