Changeset 99668 in vbox
- Timestamp:
- May 8, 2023 1:03:08 PM (19 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/ldr/ldrPE.cpp
r98103 r99668 191 191 { 192 192 RTSHA512CONTEXT Sha512; 193 RTSHA384CONTEXT Sha384; 193 194 RTSHA256CONTEXT Sha256; 194 195 RTSHA1CONTEXT Sha1; … … 205 206 { 206 207 uint8_t abSha512[RTSHA512_HASH_SIZE]; 208 uint8_t abSha384[RTSHA384_HASH_SIZE]; 207 209 uint8_t abSha256[RTSHA256_HASH_SIZE]; 208 210 uint8_t abSha1[RTSHA1_HASH_SIZE]; … … 2181 2183 { 2182 2184 case RTDIGESTTYPE_SHA512: RTSha512Init(&pHashCtx->Sha512); break; 2185 case RTDIGESTTYPE_SHA384: RTSha384Init(&pHashCtx->Sha384); break; 2183 2186 case RTDIGESTTYPE_SHA256: RTSha256Init(&pHashCtx->Sha256); break; 2184 2187 case RTDIGESTTYPE_SHA1: RTSha1Init(&pHashCtx->Sha1); break; … … 2203 2206 { 2204 2207 case RTDIGESTTYPE_SHA512: RTSha512Update(&pHashCtx->Sha512, pvBuf, cbBuf); break; 2208 case RTDIGESTTYPE_SHA384: RTSha384Update(&pHashCtx->Sha384, pvBuf, cbBuf); break; 2205 2209 case RTDIGESTTYPE_SHA256: RTSha256Update(&pHashCtx->Sha256, pvBuf, cbBuf); break; 2206 2210 case RTDIGESTTYPE_SHA1: RTSha1Update(&pHashCtx->Sha1, pvBuf, cbBuf); break; … … 2223 2227 { 2224 2228 case RTDIGESTTYPE_SHA512: RTSha512Final(&pHashCtx->Sha512, pHashRes->abSha512); break; 2229 case RTDIGESTTYPE_SHA384: RTSha384Final(&pHashCtx->Sha384, pHashRes->abSha384); break; 2225 2230 case RTDIGESTTYPE_SHA256: RTSha256Final(&pHashCtx->Sha256, pHashRes->abSha256); break; 2226 2231 case RTDIGESTTYPE_SHA1: RTSha1Final(&pHashCtx->Sha1, pHashRes->abSha1); break; … … 2242 2247 { 2243 2248 case RTDIGESTTYPE_SHA512: return RTSHA512_HASH_SIZE; 2249 case RTDIGESTTYPE_SHA384: return RTSHA384_HASH_SIZE; 2244 2250 case RTDIGESTTYPE_SHA256: return RTSHA256_HASH_SIZE; 2245 2251 case RTDIGESTTYPE_SHA1: return RTSHA1_HASH_SIZE; 2246 2252 case RTDIGESTTYPE_MD5: return RTMD5_HASH_SIZE; 2247 2253 default: AssertReleaseFailedReturn(0); 2254 } 2255 } 2256 2257 2258 /** 2259 * Checks if the hash type is supported. 2260 * 2261 * @returns true/false. 2262 * @param enmDigest The hash type in question. 2263 */ 2264 static bool rtLdrPE_HashIsSupported(RTDIGESTTYPE enmDigest) 2265 { 2266 switch (enmDigest) 2267 { 2268 case RTDIGESTTYPE_SHA512: 2269 case RTDIGESTTYPE_SHA384: 2270 case RTDIGESTTYPE_SHA256: 2271 case RTDIGESTTYPE_SHA1: 2272 case RTDIGESTTYPE_MD5: 2273 return true; 2274 default: 2275 return false; 2248 2276 } 2249 2277 } … … 3247 3275 AssertReturn(RTASN1CORE_IS_PRESENT(&pInfo->pIndData->DigestInfo.Digest.Asn1Core), VERR_INTERNAL_ERROR_5); 3248 3276 AssertPtrReturn(pInfo->pIndData->DigestInfo.Digest.Asn1Core.uData.pv, VERR_INTERNAL_ERROR_5); 3277 3278 /* Check that the hash is supported by the code here before continuing. */ 3279 AssertReturn(rtLdrPE_HashIsSupported(pInfo->enmDigest), 3280 RTErrInfoSetF(pErrInfo, VERR_CR_DIGEST_NOT_SUPPORTED, "Unsupported digest type: %d", pInfo->enmDigest)); 3249 3281 3250 3282 /*
Note:
See TracChangeset
for help on using the changeset viewer.