Changeset 73705 in vbox for trunk/src/VBox/Runtime
- Timestamp:
- Aug 16, 2018 9:31:18 AM (6 years ago)
- Location:
- trunk/src/VBox/Runtime
- Files:
-
- 1 added
- 7 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/Makefile.kmk
r73665 r73705 343 343 common/checksum/crc16ccitt.cpp \ 344 344 common/checksum/alt-md2.cpp \ 345 common/checksum/alt-md4.cpp \ 345 346 common/checksum/alt-md5.cpp \ 346 347 common/checksum/alt-sha1.cpp \ … … 348 349 common/checksum/alt-sha512.cpp \ 349 350 common/checksum/md2str.cpp \ 351 common/checksum/md4str.cpp \ 350 352 common/checksum/md5str.cpp \ 351 353 common/checksum/ipv4.cpp \ … … 2369 2371 common/crypto/tsp-sanity.cpp \ 2370 2372 common/checksum/alt-md2.cpp \ 2373 common/checksum/alt-md4.cpp \ 2371 2374 common/checksum/alt-sha1.cpp \ 2372 2375 common/checksum/alt-sha256.cpp \ 2373 2376 common/checksum/alt-sha512.cpp \ 2374 2377 common/checksum/md2str.cpp \ 2378 common/checksum/md4str.cpp \ 2375 2379 common/checksum/md5str.cpp \ 2376 2380 common/checksum/sha1str.cpp \ -
trunk/src/VBox/Runtime/common/checksum/md4str.cpp
r73671 r73705 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - MD 2string functions.3 * IPRT - MD4 string functions. 4 4 */ 5 5 … … 30 30 *********************************************************************************************************************************/ 31 31 #include "internal/iprt.h" 32 #include <iprt/md 2.h>32 #include <iprt/md4.h> 33 33 34 34 #include <iprt/assert.h> … … 37 37 38 38 39 RTDECL(int) RTMd 2ToString(uint8_t const pabDigest[RTMD2_HASH_SIZE], char *pszDigest, size_t cchDigest)39 RTDECL(int) RTMd4ToString(uint8_t const pabDigest[RTMD4_HASH_SIZE], char *pszDigest, size_t cchDigest) 40 40 { 41 return RTStrPrintHexBytes(pszDigest, cchDigest, &pabDigest[0], RTMD 2_HASH_SIZE, 0 /*fFlags*/);41 return RTStrPrintHexBytes(pszDigest, cchDigest, &pabDigest[0], RTMD4_HASH_SIZE, 0 /*fFlags*/); 42 42 } 43 43 44 44 45 RTDECL(int) RTMd 2FromString(char const *pszDigest, uint8_t pabDigest[RTMD2_HASH_SIZE])45 RTDECL(int) RTMd4FromString(char const *pszDigest, uint8_t pabDigest[RTMD4_HASH_SIZE]) 46 46 { 47 return RTStrConvertHexBytes(RTStrStripL(pszDigest), &pabDigest[0], RTMD 2_HASH_SIZE, 0 /*fFlags*/);47 return RTStrConvertHexBytes(RTStrStripL(pszDigest), &pabDigest[0], RTMD4_HASH_SIZE, 0 /*fFlags*/); 48 48 } 49 49 -
trunk/src/VBox/Runtime/common/checksum/openssl-md4.cpp
r73671 r73705 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - Message-Digest Algorithm 2.3 * IPRT - Message-Digest Algorithm 4. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2009-201 7Oracle Corporation7 * Copyright (C) 2009-2018 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 32 32 33 33 #include <openssl/opensslconf.h> 34 #if ndef OPENSSL_NO_MD235 # include <openssl/md 2.h>34 #if 0 //ndef OPENSSL_NO_MD4 35 # include <openssl/md4.h> 36 36 37 # define RT_MD 2_PRIVATE_CONTEXT38 # include <iprt/md 2.h>37 # define RT_MD4_PRIVATE_CONTEXT 38 # include <iprt/md4.h> 39 39 40 40 # include <iprt/assert.h> 41 41 42 AssertCompile(RT_SIZEOFMEMB(RTMD 2CONTEXT, abPadding) >= RT_SIZEOFMEMB(RTMD2CONTEXT, Private));42 AssertCompile(RT_SIZEOFMEMB(RTMD4CONTEXT, abPadding) >= RT_SIZEOFMEMB(RTMD4CONTEXT, Private)); 43 43 44 44 45 RTDECL(void) RTMd 2(const void *pvBuf, size_t cbBuf, uint8_t pabDigest[RTMD2_HASH_SIZE])45 RTDECL(void) RTMd4(const void *pvBuf, size_t cbBuf, uint8_t pabDigest[RTMD4_HASH_SIZE]) 46 46 { 47 RTMD 2CONTEXT Ctx;48 RTMd 2Init(&Ctx);49 RTMd 2Update(&Ctx, pvBuf, cbBuf);50 RTMd 2Final(&Ctx, pabDigest);47 RTMD4CONTEXT Ctx; 48 RTMd4Init(&Ctx); 49 RTMd4Update(&Ctx, pvBuf, cbBuf); 50 RTMd4Final(&Ctx, pabDigest); 51 51 } 52 RT_EXPORT_SYMBOL(RTMd 2);52 RT_EXPORT_SYMBOL(RTMd4); 53 53 54 54 55 RTDECL(void) RTMd 2Init(PRTMD2CONTEXT pCtx)55 RTDECL(void) RTMd4Init(PRTMD4CONTEXT pCtx) 56 56 { 57 MD 2_Init(&pCtx->Private);57 MD4_Init(&pCtx->Private); 58 58 } 59 RT_EXPORT_SYMBOL(RTMd 2Init);59 RT_EXPORT_SYMBOL(RTMd4Init); 60 60 61 61 62 RTDECL(void) RTMd 2Update(PRTMD2CONTEXT pCtx, const void *pvBuf, size_t cbBuf)62 RTDECL(void) RTMd4Update(PRTMD4CONTEXT pCtx, const void *pvBuf, size_t cbBuf) 63 63 { 64 MD 2_Update(&pCtx->Private, (const unsigned char *)pvBuf, cbBuf);64 MD4_Update(&pCtx->Private, (const unsigned char *)pvBuf, cbBuf); 65 65 } 66 RT_EXPORT_SYMBOL(RTMd 2Update);66 RT_EXPORT_SYMBOL(RTMd4Update); 67 67 68 68 69 RTDECL(void) RTMd 2Final(PRTMD2CONTEXT pCtx, uint8_t pabDigest[RTMD2_HASH_SIZE])69 RTDECL(void) RTMd4Final(PRTMD4CONTEXT pCtx, uint8_t pabDigest[RTMD4_HASH_SIZE]) 70 70 { 71 MD 2_Final((unsigned char *)&pabDigest[0], &pCtx->Private);71 MD4_Final((unsigned char *)&pabDigest[0], &pCtx->Private); 72 72 } 73 RT_EXPORT_SYMBOL(RTMd 2Final);73 RT_EXPORT_SYMBOL(RTMd4Final); 74 74 75 75 76 #else /* OPENSSL_NO_MD 2*/76 #else /* OPENSSL_NO_MD4 */ 77 77 /* 78 * If the OpenSSL build doesn't have MD 2, use the IPRT implementation.78 * If the OpenSSL build doesn't have MD4, use the IPRT implementation. 79 79 */ 80 # include "alt-md 2.cpp"81 #endif /* OPENSSL_NO_MD 2*/80 # include "alt-md4.cpp" 81 #endif /* OPENSSL_NO_MD4 */ 82 82 -
trunk/src/VBox/Runtime/common/crypto/digest-builtin.cpp
r69111 r73705 36 36 #include <iprt/string.h> 37 37 #include <iprt/md2.h> 38 #include <iprt/md4.h> 38 39 #include <iprt/md5.h> 39 40 #include <iprt/sha.h> … … 45 46 #endif 46 47 48 49 47 50 /* 48 51 * MD2 49 52 */ 53 #ifndef IPRT_WITHOUT_DIGEST_MD2 50 54 51 55 /** @impl_interface_method{RTCRDIGESTDESC::pfnUpdate} */ … … 87 91 RTMD2_HASH_SIZE, 88 92 sizeof(RTMD2CONTEXT), 89 0,93 RTCRDIGESTDESC_F_DEPRECATED, 90 94 NULL, 91 95 NULL, … … 98 102 NULL, 99 103 }; 104 #endif /* !IPRT_WITHOUT_DIGEST_MD2 */ 105 106 107 /* 108 * MD4 109 */ 110 #ifndef IPRT_WITHOUT_DIGEST_MD4 111 112 /** @impl_interface_method{RTCRDIGESTDESC::pfnUpdate} */ 113 static DECLCALLBACK(void) rtCrDigestMd4_Update(void *pvState, const void *pvData, size_t cbData) 114 { 115 RTMd4Update((PRTMD4CONTEXT)pvState, pvData, cbData); 116 } 117 118 /** @impl_interface_method{RTCRDIGESTDESC::pfnFinal} */ 119 static DECLCALLBACK(void) rtCrDigestMd4_Final(void *pvState, uint8_t *pbHash) 120 { 121 RTMd4Final((PRTMD4CONTEXT)pvState, pbHash); 122 } 123 124 /** @impl_interface_method{RTCRDIGESTDESC::pfnInit} */ 125 static DECLCALLBACK(int) rtCrDigestMd4_Init(void *pvState, void *pvOpaque, bool fReInit) 126 { 127 RT_NOREF_PV(fReInit); RT_NOREF_PV(pvOpaque); 128 AssertReturn(pvOpaque == NULL, VERR_INVALID_PARAMETER); 129 RTMd4Init((PRTMD4CONTEXT)pvState); 130 return VINF_SUCCESS; 131 } 132 133 /** MD4 alias ODIs. */ 134 static const char * const g_apszMd4Aliases[] = 135 { 136 RTCR_PKCS1_MD4_WITH_RSA_OID, 137 NULL 138 }; 139 140 /** MD4 descriptor. */ 141 static RTCRDIGESTDESC const g_rtCrDigestMd4Desc = 142 { 143 "md4", 144 "1.2.840.113549.2.4", 145 g_apszMd4Aliases, 146 RTDIGESTTYPE_MD4, 147 RTMD4_HASH_SIZE, 148 sizeof(RTMD4CONTEXT), 149 RTCRDIGESTDESC_F_DEPRECATED | RTCRDIGESTDESC_F_COMPROMISED | RTCRDIGESTDESC_F_SERVERELY_COMPROMISED, 150 NULL, 151 NULL, 152 rtCrDigestMd4_Update, 153 rtCrDigestMd4_Final, 154 rtCrDigestMd4_Init, 155 NULL, 156 NULL, 157 NULL, 158 NULL, 159 }; 160 161 #endif /* !IPRT_WITHOUT_DIGEST_MD4 */ 100 162 101 163 … … 103 165 * MD5 104 166 */ 167 #ifndef IPRT_WITHOUT_DIGEST_MD5 105 168 106 169 /** @impl_interface_method{RTCRDIGESTDESC::pfnUpdate} */ … … 142 205 RTMD5_HASH_SIZE, 143 206 sizeof(RTMD5CONTEXT), 144 0,207 RTCRDIGESTDESC_F_COMPROMISED, 145 208 NULL, 146 209 NULL, … … 153 216 NULL, 154 217 }; 218 #endif /* !IPRT_WITHOUT_DIGEST_MD5 */ 155 219 156 220 … … 197 261 RTSHA1_HASH_SIZE, 198 262 sizeof(RTSHA1CONTEXT), 199 0,263 RTCRDIGESTDESC_F_DEPRECATED, 200 264 NULL, 201 265 NULL, … … 541 605 static PCRTCRDIGESTDESC const g_apDigestOps[] = 542 606 { 607 #ifndef IPRT_WITHOUT_DIGEST_MD2 543 608 &g_rtCrDigestMd2Desc, 609 #endif 610 #ifndef IPRT_WITHOUT_DIGEST_MD4 611 &g_rtCrDigestMd4Desc, 612 #endif 613 #ifndef IPRT_WITHOUT_DIGEST_MD5 544 614 &g_rtCrDigestMd5Desc, 615 #endif 545 616 &g_rtCrDigestSha1Desc, 546 617 &g_rtCrDigestSha256Desc, -
trunk/src/VBox/Runtime/common/crypto/digest-core.cpp
r73097 r73705 88 88 89 89 90 /** 91 * Used for successful returns which wants to hit at digest security. 92 * 93 * @retval VINF_SUCCESS 94 * @retval VINF_CR_DIGEST_DEPRECATED 95 * @retval VINF_CR_DIGEST_COMPROMISED 96 * @retval VINF_CR_DIGEST_SEVERELY_COMPROMISED 97 * @param pDesc The digest descriptor. 98 */ 99 DECLINLINE(int) rtCrDigestSuccessWithDigestWarnings(PCRTCRDIGESTDESC pDesc) 100 { 101 uint32_t const fFlags = pDesc->fFlags 102 & (RTCRDIGESTDESC_F_DEPRECATED | RTCRDIGESTDESC_F_COMPROMISED | RTCRDIGESTDESC_F_SERVERELY_COMPROMISED); 103 if (!fFlags) 104 return VINF_SUCCESS; 105 if (fFlags & RTCRDIGESTDESC_F_SERVERELY_COMPROMISED) 106 return VINF_CR_DIGEST_SEVERELY_COMPROMISED; 107 if (fFlags & RTCRDIGESTDESC_F_COMPROMISED) 108 return VINF_CR_DIGEST_COMPROMISED; 109 return VINF_CR_DIGEST_DEPRECATED; 110 } 111 112 90 113 RTDECL(int) RTCrDigestCreate(PRTCRDIGEST phDigest, PCRTCRDIGESTDESC pDesc, void *pvOpaque) 91 114 { … … 116 139 { 117 140 *phDigest = pThis; 118 return VINF_SUCCESS;141 return rtCrDigestSuccessWithDigestWarnings(pDesc); 119 142 } 120 143 if (pDesc->pfnFree) … … 166 189 { 167 190 *phDigest = pThis; 168 return VINF_SUCCESS;191 return rtCrDigestSuccessWithDigestWarnings(pThis->pDesc); 169 192 } 170 193 if (hSrc->pDesc->pfnFree) … … 300 323 } 301 324 302 return VINF_SUCCESS;325 return rtCrDigestSuccessWithDigestWarnings(pThis->pDesc); 303 326 } 304 327 … … 379 402 { 380 403 return RTCrDigestTypeToAlgorithmOid(RTCrDigestGetType(hDigest)); 404 } 405 406 407 RTDECL(uint32_t) RTCrDigestGetFlags(RTCRDIGEST hDigest) 408 { 409 PRTCRDIGESTINT pThis = hDigest; 410 AssertPtrReturn(pThis, UINT32_MAX); 411 AssertReturn(pThis->u32Magic == RTCRDIGESTINT_MAGIC, UINT32_MAX); 412 return pThis->pDesc->fFlags; 381 413 } 382 414 -
trunk/src/VBox/Runtime/common/crypto/pkix-signature-rsa.cpp
r73668 r73705 193 193 * describes in step in section 9.2.1 194 194 * (EMSA-PKCS1-v1_5) 195 * 196 * @remarks Must preserve informational status codes! 195 197 */ 196 198 static int rtCrPkixSignatureRsa_EmsaPkcs1V15Encode(PRTCRPKIXSIGNATURERSA pThis, RTCRDIGEST hDigest, size_t cbEncodedMsg, … … 242 244 memcpy(pbDst, pbDigestInfoStart, cbDigestInfoStart); 243 245 pbDst += cbDigestInfoStart; 246 /* Note! Must preserve informational status codes from this call . */ 244 247 int rc = RTCrDigestFinal(hDigest, pbDst, cbHash); 245 if (RT_FAILURE(rc)) 246 return rc; 247 pbDst += cbHash; 248 Assert((size_t)(pbDst - &pThis->Scratch.abSignature[0]) == cbEncodedMsg); 249 return VINF_SUCCESS; 248 if (RT_SUCCESS(rc)) 249 { 250 pbDst += cbHash; 251 Assert((size_t)(pbDst - &pThis->Scratch.abSignature[0]) == cbEncodedMsg); 252 } 253 return rc; 250 254 } 251 255 … … 313 317 */ 314 318 if (memcmp(&pThis->Scratch.abSignature[0], pbDecrypted, cbDecrypted) == 0) 315 rc = VINF_SUCCESS;319 { /* No rc = VINF_SUCCESS here, mustpreserve informational status codes from digest. */ } 316 320 else 317 321 { … … 325 329 { 326 330 if (memcmp(&pThis->Scratch.abSignature[0], pbDecrypted, cbDecrypted) == 0) 327 rc = VINF_SUCCESS;331 { /* No rc = VINF_SUCCESS here, mustpreserve informational status codes from digest. */ } 328 332 else 329 333 rc = VERR_CR_PKIX_SIGNATURE_MISMATCH; … … 378 382 * 8.1.1.1 - EMSA-PSS encoding. (RFC-3447) 379 383 */ 380 int rc = rtCrPkixSignatureRsa_EmsaPkcs1V15Encode(pThis, hDigest, cbEncodedMsg, false /* fNoDigestInfo */); 381 if (RT_FAILURE(rc)) 382 return rc; 383 384 /* 385 * 8.1.1.2 - RSA signature. 386 */ 387 /* a) m = OS2IP(EM) -- Convert the encoded message (EM) to integer. */ 388 rc = RTBigNumInit(&pThis->TmpBigNum1, RTBIGNUMINIT_F_ENDIAN_BIG | RTBIGNUMINIT_F_UNSIGNED, 389 pThis->Scratch.abSignature, cbEncodedMsg); 390 if (RT_FAILURE(rc)) 391 return rc; 392 393 /* b) s = RSASP1(K, m = EM) - 5.2.1.1: Range check (0 <= m < n). */ 394 if (RTBigNumCompare(&pThis->TmpBigNum1, pModulus) < 0) 384 int rcRetSuccess; 385 int rc = rcRetSuccess = rtCrPkixSignatureRsa_EmsaPkcs1V15Encode(pThis, hDigest, cbEncodedMsg, false /* fNoDigestInfo */); 386 if (RT_SUCCESS(rc)) 395 387 { 396 /* b) s = RSAVP1(K, m = EM) - 5.2.1.2.a: s = m^d mod n */ 397 rc = RTBigNumInitZero(&pThis->TmpBigNum2, 0); 388 /* 389 * 8.1.1.2 - RSA signature. 390 */ 391 /* a) m = OS2IP(EM) -- Convert the encoded message (EM) to integer. */ 392 rc = RTBigNumInit(&pThis->TmpBigNum1, RTBIGNUMINIT_F_ENDIAN_BIG | RTBIGNUMINIT_F_UNSIGNED, 393 pThis->Scratch.abSignature, cbEncodedMsg); 398 394 if (RT_SUCCESS(rc)) 399 395 { 400 rc = RTBigNumModExp(&pThis->TmpBigNum2, &pThis->TmpBigNum1, pExponent, pModulus);401 if (RT _SUCCESS(rc))396 /* b) s = RSASP1(K, m = EM) - 5.2.1.1: Range check (0 <= m < n). */ 397 if (RTBigNumCompare(&pThis->TmpBigNum1, pModulus) < 0) 402 398 { 403 /* c) S = I2OSP(s, k) -- Convert the result to bytes. */ 404 rc = RTBigNumToBytesBigEndian(&pThis->TmpBigNum2, pvSignature, cbEncodedMsg); 405 AssertStmt(RT_SUCCESS(rc) || rc != VERR_BUFFER_OVERFLOW, rc = VERR_CR_PKIX_INTERNAL_ERROR); 399 /* b) s = RSAVP1(K, m = EM) - 5.2.1.2.a: s = m^d mod n */ 400 rc = RTBigNumInitZero(&pThis->TmpBigNum2, 0); 401 if (RT_SUCCESS(rc)) 402 { 403 rc = RTBigNumModExp(&pThis->TmpBigNum2, &pThis->TmpBigNum1, pExponent, pModulus); 404 if (RT_SUCCESS(rc)) 405 { 406 /* c) S = I2OSP(s, k) -- Convert the result to bytes. */ 407 rc = RTBigNumToBytesBigEndian(&pThis->TmpBigNum2, pvSignature, cbEncodedMsg); 408 AssertStmt(RT_SUCCESS(rc) || rc != VERR_BUFFER_OVERFLOW, rc = VERR_CR_PKIX_INTERNAL_ERROR); 409 410 /* Make sure we return the informational status code from the digest on success. */ 411 if (rc == VINF_SUCCESS && rcRetSuccess != VINF_SUCCESS) 412 rc = rcRetSuccess; 413 } 414 RTBigNumDestroy(&pThis->TmpBigNum2); 415 } 406 416 } 407 RTBigNumDestroy(&pThis->TmpBigNum2); 417 else 418 rc = VERR_CR_PKIX_SIGNATURE_GE_KEY; 419 RTBigNumDestroy(&pThis->TmpBigNum1); 408 420 } 409 421 } 410 else411 rc = VERR_CR_PKIX_SIGNATURE_GE_KEY;412 RTBigNumDestroy(&pThis->TmpBigNum1);413 422 return rc; 414 423 } -
trunk/src/VBox/Runtime/common/crypto/pkix-verify.cpp
r73672 r73705 152 152 * Check the result. 153 153 */ 154 if ( RT_SUCCESS(rcIprt) && RT_SUCCESS(rcOssl))155 return VINF_SUCCESS;156 if (RT_FAILURE_NP(rcIprt) && RT_FAILURE_NP(rcOssl))154 if ( RT_SUCCESS(rcIprt) && RT_SUCCESS(rcOssl) 155 || (RT_FAILURE_NP(rcIprt) && RT_FAILURE_NP(rcOssl)) 156 || (RT_SUCCESS(rcIprt) && rcOssl == VERR_CR_PKIX_OSSL_CIPHER_ALGO_NOT_KNOWN_EVP) ) 157 157 return rcIprt; 158 158 AssertMsgFailed(("rcIprt=%Rrc rcOssl=%Rrc\n", rcIprt, rcOssl)); … … 274 274 * Check the result. 275 275 */ 276 if ( RT_SUCCESS(rcIprt) && RT_SUCCESS(rcOssl))277 return VINF_SUCCESS;278 if (RT_FAILURE_NP(rcIprt) && RT_FAILURE_NP(rcOssl))276 if ( RT_SUCCESS(rcIprt) && RT_SUCCESS(rcOssl) 277 || (RT_FAILURE_NP(rcIprt) && RT_FAILURE_NP(rcOssl)) 278 || (RT_SUCCESS(rcIprt) && rcOssl == VERR_CR_PKIX_OSSL_CIPHER_ALGO_NOT_KNOWN_EVP) ) 279 279 return rcIprt; 280 280 AssertMsgFailed(("rcIprt=%Rrc rcOssl=%Rrc\n", rcIprt, rcOssl)); -
trunk/src/VBox/Runtime/testcase/tstRTCrX509-1.cpp
r73688 r73705 49 49 bool fMaybeNotInOpenSSL; 50 50 bool fSelfSigned; 51 int rcSuccessDigestQuality; 51 52 52 53 char const *pchPem; … … 57 58 } g_aFiles[] = 58 59 { 59 #define MY_CERT_ENTRY(a_fMaybeNotInOpenSSL, a_fSelfSigned, a_ Name) \60 { #a_Name, a_fMaybeNotInOpenSSL, a_fSelfSigned, \60 #define MY_CERT_ENTRY(a_fMaybeNotInOpenSSL, a_fSelfSigned, a_rcSuccessDigestQuality, a_Name) \ 61 { #a_Name, a_fMaybeNotInOpenSSL, a_fSelfSigned, a_rcSuccessDigestQuality, \ 61 62 (const char *)RT_CONCAT(g_abPem_, a_Name), RT_CONCAT(g_cbPem_, a_Name), \ 62 63 RT_CONCAT(g_abDer_, a_Name), RT_CONCAT(g_cbDer_, a_Name) } 63 MY_CERT_ENTRY(true, true, md4),64 MY_CERT_ENTRY(false, true, md5),65 MY_CERT_ENTRY(false, true, sha1),66 MY_CERT_ENTRY(false, true, sha224),67 MY_CERT_ENTRY(false, true, sha256),68 MY_CERT_ENTRY(false, true, sha384),69 MY_CERT_ENTRY(false, true, sha512),70 MY_CERT_ENTRY(false, false, cert1),64 MY_CERT_ENTRY(true, true, VINF_CR_DIGEST_SEVERELY_COMPROMISED, md4), 65 MY_CERT_ENTRY(false, true, VINF_CR_DIGEST_COMPROMISED, md5), 66 MY_CERT_ENTRY(false, true, VINF_CR_DIGEST_DEPRECATED, sha1), 67 MY_CERT_ENTRY(false, true, VINF_SUCCESS, sha224), 68 MY_CERT_ENTRY(false, true, VINF_SUCCESS, sha256), 69 MY_CERT_ENTRY(false, true, VINF_SUCCESS, sha384), 70 MY_CERT_ENTRY(false, true, VINF_SUCCESS, sha512), 71 MY_CERT_ENTRY(false, false, -1, cert1), 71 72 }; 72 73 … … 156 157 { 157 158 rc = RTCrX509Certificate_VerifySignatureSelfSigned(paCerts[j], NULL /*pErrInfo*/); 158 if ( RT_FAILURE(rc) 159 && ( ( rc != VERR_CR_PKIX_OSSL_CIPHER_ALGO_NOT_KNOWN_EVP 160 && rc != VERR_NOT_FOUND) 161 || !g_aFiles[i].fMaybeNotInOpenSSL) ) 159 if (RT_FAILURE(rc)) 162 160 RTTestIFailed("RTCrX509Certificate_VerifySignatureSelfSigned failed for %s (#%u), variation %u: %Rrc", 163 161 g_aFiles[i].pszFile, i, j, rc); 162 else if ( rc != g_aFiles[i].rcSuccessDigestQuality 163 && g_aFiles[i].rcSuccessDigestQuality != -1) 164 RTTestIFailed("RTCrX509Certificate_VerifySignatureSelfSigned returned %Rrc rather than %Rrc for %s (#%u), variation %u", 165 rc, g_aFiles[i].rcSuccessDigestQuality, g_aFiles[i].pszFile, i, j); 164 166 } 165 167 } -
trunk/src/VBox/Runtime/testcase/tstRTDigest-2.cpp
r69111 r73705 31 31 #include <iprt/crypto/digest.h> 32 32 #include <iprt/md2.h> 33 #include <iprt/md4.h> 33 34 #include <iprt/md5.h> 34 35 #include <iprt/sha.h> … … 78 79 * @param iTest The test number (for reporting). 79 80 * @param pTest The test. 81 * @param rcSuccessDigest The digest success informational status code. 80 82 */ 81 static bool testGenericCheckResult(RTCRDIGEST hDigest, uint32_t iTest, TESTRTDIGEST const *pTest )83 static bool testGenericCheckResult(RTCRDIGEST hDigest, uint32_t iTest, TESTRTDIGEST const *pTest, int rcSuccessDigest) 82 84 { 83 RTTESTI_CHECK_RC_RET(RTCrDigestFinal(hDigest, NULL, 0), VINF_SUCCESS, false);85 RTTESTI_CHECK_RC_RET(RTCrDigestFinal(hDigest, NULL, 0), rcSuccessDigest, false); 84 86 85 87 char szDigest[_4K * 2]; … … 106 108 * @param pszDigestName The name of the digest. 107 109 * @param enmDigestType The digest enum type value. 110 * @param rcSuccessDigest The digest success informational status code. 108 111 */ 109 112 static void testGeneric(const char *pszDigestObjId, TESTRTDIGEST const *paTests, size_t cTests, const char *pszDigestName, 110 RTDIGESTTYPE enmDigestType )113 RTDIGESTTYPE enmDigestType, int rcSuccessDigest) 111 114 { 112 115 /* … … 119 122 * The whole thing in one go. 120 123 */ 121 RTTESTI_CHECK_RC_RETV(RTCrDigestCreateByObjIdString(&hDigest, pszDigestObjId), VINF_SUCCESS);124 RTTESTI_CHECK_RC_RETV(RTCrDigestCreateByObjIdString(&hDigest, pszDigestObjId), rcSuccessDigest); 122 125 uint32_t const cbHash = RTCrDigestGetHashSize(hDigest); 123 126 RTTESTI_CHECK_RETV(cbHash > 0); 124 127 RTTESTI_CHECK_RETV(cbHash < _1K); 125 128 RTTESTI_CHECK_RC_RETV(RTCrDigestUpdate(hDigest, paTests[iTest].pvInput, paTests[iTest].cbInput), VINF_SUCCESS); 126 if (!testGenericCheckResult(hDigest, iTest, &paTests[iTest] ))129 if (!testGenericCheckResult(hDigest, iTest, &paTests[iTest], rcSuccessDigest)) 127 130 continue; /* skip the remaining tests if this failed. */ 128 131 … … 147 150 } 148 151 149 if (!testGenericCheckResult(hDigest, iTest, &paTests[iTest] ))152 if (!testGenericCheckResult(hDigest, iTest, &paTests[iTest], rcSuccessDigest)) 150 153 break; /* No need to test the other permutations if this fails. */ 151 154 } … … 157 160 * Do a quick benchmark. 158 161 */ 159 RTTESTI_CHECK_RC_RETV(RTCrDigestCreateByObjIdString(&hDigest, pszDigestObjId), VINF_SUCCESS);162 RTTESTI_CHECK_RC_RETV(RTCrDigestCreateByObjIdString(&hDigest, pszDigestObjId), rcSuccessDigest); 160 163 161 164 /* Warmup. */ … … 384 387 { &g_abRandom72KB[0x20c9], 9991, "bbba194efa81238e5b613e20e937144e", "MD2 8393 bytes @9991" }, 385 388 }; 386 testGeneric("1.2.840.113549.2.2", s_abTests, RT_ELEMENTS(s_abTests), "MD2", RTDIGESTTYPE_MD2); 389 testGeneric("1.2.840.113549.2.2", s_abTests, RT_ELEMENTS(s_abTests), "MD2", RTDIGESTTYPE_MD2, VINF_CR_DIGEST_DEPRECATED); 390 } 391 392 393 /** 394 * Tests MD4. 395 */ 396 static void testMd4(void) 397 { 398 RTTestISub("MD4"); 399 400 /* 401 * Some quick direct API tests. 402 */ 403 uint8_t abHash[RTMD4_HASH_SIZE]; 404 char szDigest[RTMD4_DIGEST_LEN + 1]; 405 const char *pszString; 406 407 pszString = ""; 408 RTMd4(pszString, strlen(pszString), abHash); 409 RTTESTI_CHECK_RC_RETV(RTMd4ToString(abHash, szDigest, sizeof(szDigest)), VINF_SUCCESS); 410 CHECK_STRING(szDigest, "31d6cfe0d16ae931b73c59d7e0c089c0"); 411 412 pszString = "The quick brown fox jumps over the lazy dog"; 413 RTMd4(pszString, strlen(pszString), abHash); 414 RTTESTI_CHECK_RC_RETV(RTMd4ToString(abHash, szDigest, sizeof(szDigest)), VINF_SUCCESS); 415 CHECK_STRING(szDigest, "1bee69a46ba811185c194762abaeae90"); 416 417 pszString = "a"; 418 RTMd4(pszString, strlen(pszString), abHash); 419 RTTESTI_CHECK_RC_RETV(RTMd4ToString(abHash, szDigest, sizeof(szDigest)), VINF_SUCCESS); 420 CHECK_STRING(szDigest, "bde52cb31de33e46245e05fbdbd6fb24"); 421 422 pszString = "abc"; 423 RTMd4(pszString, strlen(pszString), abHash); 424 RTTESTI_CHECK_RC_RETV(RTMd4ToString(abHash, szDigest, sizeof(szDigest)), VINF_SUCCESS); 425 CHECK_STRING(szDigest, "a448017aaf21d8525fc10ae87aa6729d"); 426 427 pszString = "message digest"; 428 RTMd4(pszString, strlen(pszString), abHash); 429 RTTESTI_CHECK_RC_RETV(RTMd4ToString(abHash, szDigest, sizeof(szDigest)), VINF_SUCCESS); 430 CHECK_STRING(szDigest, "d9130a8164549fe818874806e1c7014b"); 431 432 pszString = "abcdefghijklmnopqrstuvwxyz"; 433 RTMd4(pszString, strlen(pszString), abHash); 434 RTTESTI_CHECK_RC_RETV(RTMd4ToString(abHash, szDigest, sizeof(szDigest)), VINF_SUCCESS); 435 CHECK_STRING(szDigest, "d79e1c308aa5bbcdeea8ed63df412da9"); 436 437 pszString = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; 438 RTMd4(pszString, strlen(pszString), abHash); 439 RTTESTI_CHECK_RC_RETV(RTMd4ToString(abHash, szDigest, sizeof(szDigest)), VINF_SUCCESS); 440 CHECK_STRING(szDigest, "043f8582f241db351ce627e153e7f0e4"); 441 442 pszString = "12345678901234567890123456789012345678901234567890123456789012345678901234567890"; 443 RTMd4(pszString, strlen(pszString), abHash); 444 RTTESTI_CHECK_RC_RETV(RTMd4ToString(abHash, szDigest, sizeof(szDigest)), VINF_SUCCESS); 445 CHECK_STRING(szDigest, "e33b4ddc9c38f2199c3e7b164fcc0536"); 446 447 448 /* 449 * Generic API tests. 450 */ 451 static TESTRTDIGEST const s_abTests[] = 452 { 453 { &g_abRandom72KB[0], 0, "31d6cfe0d16ae931b73c59d7e0c089c0", "MD4 0 bytes" }, 454 { &g_abRandom72KB[0], 1, "0014d6b190d365d071ea01701055f180", "MD4 1 byte" }, 455 { &g_abRandom72KB[0], 2, "2be9806c2efb7648dc5c3ec5a502cf10", "MD4 2 bytes" }, 456 { &g_abRandom72KB[0], 3, "4d5268b74418be41d0f2ed6806048897", "MD4 3 bytes" }, 457 { &g_abRandom72KB[0], 4, "62f2e58f059dea40a92eba280f3062b4", "MD4 4 bytes" }, 458 { &g_abRandom72KB[0], 5, "b3f93386d95f56dd3e95b9bd03c6e944", "MD4 5 bytes" }, 459 { &g_abRandom72KB[0], 6, "21faedc10d9ec3943d047518b6fd5238", "MD4 6 bytes" }, 460 { &g_abRandom72KB[0], 7, "fba0c1028ffb0714cc44a9572713a900", "MD4 7 bytes" }, 461 { &g_abRandom72KB[0], 8, "1ba88ad5bc00076e753213a2e5b8ae15", "MD4 8 bytes" }, 462 { &g_abRandom72KB[0], 9, "e86ba9ff9cdd821dedc54fc7e752dda4", "MD4 9 bytes" }, 463 { &g_abRandom72KB[0], 10, "4ca3d69542505eaebd6a55dccb1d7413", "MD4 10 bytes" }, 464 { &g_abRandom72KB[0], 11, "3efc80988668aa176ec0cee9edd8122f", "MD4 11 bytes" }, 465 { &g_abRandom72KB[0], 12, "084cd1ce1d35e8e1908c9700f372790a", "MD4 12 bytes" }, 466 { &g_abRandom72KB[0], 13, "91114dc2de94a27707045f261ce616e0", "MD4 13 bytes" }, 467 { &g_abRandom72KB[0], 14, "637000da1e66c73d400baa653470bdb1", "MD4 14 bytes" }, 468 { &g_abRandom72KB[0], 15, "02af37485efd590a086dac3f30389592", "MD4 15 bytes" }, 469 { &g_abRandom72KB[0], 16, "2a6f6d15a99fc5a467f60bb78733780e", "MD4 16 bytes" }, 470 { &g_abRandom72KB[0], 17, "866b211da26762208316b930dacdeaaa", "MD4 17 bytes" }, 471 { &g_abRandom72KB[0], 18, "15ebc4114d9e5ca0cdff23f84531a64d", "MD4 18 bytes" }, 472 { &g_abRandom72KB[0], 19, "56927e67e2f6a99c8327c6ff14404d61", "MD4 19 bytes" }, 473 { &g_abRandom72KB[0], 20, "70fc8943ee6233e1f7a349a6dc68d0f6", "MD4 20 bytes" }, 474 { &g_abRandom72KB[0], 21, "4927cf2f4ec8ede18328abc0507cb1aa", "MD4 21 bytes" }, 475 { &g_abRandom72KB[0], 22, "dccda1a1c95d36c4ab6f593c3ab81b9e", "MD4 22 bytes" }, 476 { &g_abRandom72KB[0], 23, "9a45e0e9bfee3f362592ccc8aea9207c", "MD4 23 bytes" }, 477 { &g_abRandom72KB[0], 24, "0f4dee14ef3ec085ee80810066095600", "MD4 24 bytes" }, 478 { &g_abRandom72KB[0], 25, "986534cc3fd5c50a8be5c66b170bd67b", "MD4 25 bytes" }, 479 { &g_abRandom72KB[0], 26, "fb84beb50239e80d38631571fc02bd37", "MD4 26 bytes" }, 480 { &g_abRandom72KB[0], 27, "416675187789def281c48d402d3db6d8", "MD4 27 bytes" }, 481 { &g_abRandom72KB[0], 28, "a7e5379e670b33f3d9e3499955561cd8", "MD4 28 bytes" }, 482 { &g_abRandom72KB[0], 29, "5b3b41e2c4d91056c58280468952d755", "MD4 29 bytes" }, 483 { &g_abRandom72KB[0], 30, "8f0389eb6c9a5574341ec707b7496fdb", "MD4 30 bytes" }, 484 { &g_abRandom72KB[0], 31, "8fb16cc1fd5ea43d6ae52b852dbecf3f", "MD4 31 bytes" }, 485 { &g_abRandom72KB[0], 32, "c5ce62339fa63c3eb8386ee024e157ec", "MD4 32 bytes" }, 486 { &g_abRandom72KB[0], 33, "fc03d11586207fa12b505354f6ed8fa0", "MD4 33 bytes" }, 487 { &g_abRandom72KB[0], 34, "41923f367cd620969f1ee087295d0a40", "MD4 34 bytes" }, 488 { &g_abRandom72KB[0], 35, "07dbc9ad8d993e0c7a8febd2c506b87b", "MD4 35 bytes" }, 489 { &g_abRandom72KB[0], 36, "19d8e4f515748b03ad6b000ccce51101", "MD4 36 bytes" }, 490 { &g_abRandom72KB[0], 37, "54d2c85331ca4e7236629620268527c4", "MD4 37 bytes" }, 491 { &g_abRandom72KB[0], 38, "352148c6cc975c6b67704c52be5e280a", "MD4 38 bytes" }, 492 { &g_abRandom72KB[0], 39, "31c52890373437a2041a759fdd782ee2", "MD4 39 bytes" }, 493 { &g_abRandom72KB[0], 40, "1aebb166f3576845dc79b442885ea46c", "MD4 40 bytes" }, 494 { &g_abRandom72KB[0], 41, "0ca6c4388a7faa9304681261bc155676", "MD4 41 bytes" }, 495 { &g_abRandom72KB[0], 42, "69cd5768697348aceac47c2c119efb60", "MD4 42 bytes" }, 496 { &g_abRandom72KB[0], 43, "0912c29c5fd6daa187f4c22426854792", "MD4 43 bytes" }, 497 { &g_abRandom72KB[0], 44, "a7db92786a2703ff4b06cd3be31dabb7", "MD4 44 bytes" }, 498 { &g_abRandom72KB[0], 45, "d6584bb2131258613f779e26e72c6d72", "MD4 45 bytes" }, 499 { &g_abRandom72KB[0], 46, "19c49d89942e737d592618e45c413480", "MD4 46 bytes" }, 500 { &g_abRandom72KB[0], 47, "25034803d9d5b5add9969416147b9db4", "MD4 47 bytes" }, 501 { &g_abRandom72KB[0], 48, "ce20d232be7507c888591db5b3803086", "MD4 48 bytes" }, 502 { &g_abRandom72KB[0], 49, "fba1b3a38e353f06cac6a85d90f17733", "MD4 49 bytes" }, 503 { &g_abRandom72KB[0], 50, "9b72cd65b42e377c3d3660b07474c617", "MD4 50 bytes" }, 504 { &g_abRandom72KB[0], 51, "9c7177c712c4124cf1e7fe153fa2dbcb", "MD4 51 bytes" }, 505 { &g_abRandom72KB[0], 52, "6f3428a83cba0c3ee050ad43441c80ac", "MD4 52 bytes" }, 506 { &g_abRandom72KB[0], 53, "e4fff75da9a2797949101eeccd71cda9", "MD4 53 bytes" }, 507 { &g_abRandom72KB[0], 54, "840d32fc7b779ceb6b8d1b0b2cd0c9fc", "MD4 54 bytes" }, 508 { &g_abRandom72KB[0], 55, "0742c60033fe94ade3a0b1627e2daca1", "MD4 55 bytes" }, 509 { &g_abRandom72KB[0], 56, "6e258014688e63ad1a20ebe81d285141", "MD4 56 bytes" }, 510 { &g_abRandom72KB[0], 57, "f8c6d8879fcc3f99b10c680ca7b96566", "MD4 57 bytes" }, 511 { &g_abRandom72KB[0], 58, "5b0882e886b454247403184daaa5088f", "MD4 58 bytes" }, 512 { &g_abRandom72KB[0], 59, "0a2944704b29793e9b8e86950bc06eb7", "MD4 59 bytes" }, 513 { &g_abRandom72KB[0], 60, "84e03ff08c2fd101b157bb6799339dd8", "MD4 60 bytes" }, 514 { &g_abRandom72KB[0], 61, "66fc3200bd43dc88fbdf2ecfc86210c0", "MD4 61 bytes" }, 515 { &g_abRandom72KB[0], 62, "19ea83da725826d1fa4a2816eca5363d", "MD4 62 bytes" }, 516 { &g_abRandom72KB[0], 63, "a274d6f859c5e2a3aa055e2f25a5f695", "MD4 63 bytes" }, 517 { &g_abRandom72KB[0], 64, "dcd51f9400a8864157ef380eebbef60d", "MD4 64 bytes" }, 518 { &g_abRandom72KB[0], 65, "f8fe3a0be1c9ec0ee1a9f1a8bfe7701c", "MD4 65 bytes" }, 519 { &g_abRandom72KB[0], 66, "e20f96625019092cc70d706bbd113aec", "MD4 66 bytes" }, 520 { &g_abRandom72KB[0], 67, "16dd4f76d2d1845bfb9804516ce1a509", "MD4 67 bytes" }, 521 { &g_abRandom72KB[0], 68, "cc30a7b83a4a54e592435e1185ea4812", "MD4 68 bytes" }, 522 { &g_abRandom72KB[0], 69, "a64b84a86b0bf5b93604e2151d1dab05", "MD4 69 bytes" }, 523 { &g_abRandom72KB[0], 70, "523fb6da8d86b6d21d59e79150ec9749", "MD4 70 bytes" }, 524 { &g_abRandom72KB[0], 71, "ba92cad24dae5ff8b09e078c7b80df1d", "MD4 71 bytes" }, 525 { &g_abRandom72KB[0], 72, "510636391607ac06f1701b6420d90bf6", "MD4 72 bytes" }, 526 { &g_abRandom72KB[0], 73, "642f99a448cfebcb6502a3d51d84561e", "MD4 73 bytes" }, 527 { &g_abRandom72KB[0], 74, "0594cbfff1dcd956168f9780b4bf5fd7", "MD4 74 bytes" }, 528 { &g_abRandom72KB[0], 75, "bcd149fa1824199ce20723c455c6a799", "MD4 75 bytes" }, 529 { &g_abRandom72KB[0], 76, "2b31bf720e1adff2f9b3229ad680eea0", "MD4 76 bytes" }, 530 { &g_abRandom72KB[0], 77, "8498a6b10c06fd14f88fa4fbd957c1ec", "MD4 77 bytes" }, 531 { &g_abRandom72KB[0], 78, "03366c519d243d914e13024803ac6fdb", "MD4 78 bytes" }, 532 { &g_abRandom72KB[0], 79, "4795ab150f194b2e8e5c0f40f26f09eb", "MD4 79 bytes" }, 533 { &g_abRandom72KB[0], 80, "ca2b9808e7083ff0be1c0b5567861123", "MD4 80 bytes" }, 534 { &g_abRandom72KB[0], 81, "002a0aa238fc962ab76313413111fc34", "MD4 81 bytes" }, 535 { &g_abRandom72KB[0], 82, "289fb6a311a5603fe47c65c571ee3938", "MD4 82 bytes" }, 536 { &g_abRandom72KB[0], 83, "cacd59c0bc6fc31849c0f4552e3b253f", "MD4 83 bytes" }, 537 { &g_abRandom72KB[0], 84, "b6ebc1eb2ed472ab95696752aafeab24", "MD4 84 bytes" }, 538 { &g_abRandom72KB[0], 85, "98c289ef93f887fa9eeed86e655f5890", "MD4 85 bytes" }, 539 { &g_abRandom72KB[0], 86, "22c3bf5be2798a9ec04e1c459ff65544", "MD4 86 bytes" }, 540 { &g_abRandom72KB[0], 87, "43cd7e64a8d0b5a2ee4221786876bb0f", "MD4 87 bytes" }, 541 { &g_abRandom72KB[0], 88, "ec95c85bb82c26e17ef7083a6732c1e5", "MD4 88 bytes" }, 542 { &g_abRandom72KB[0], 89, "1b9a6299f80996cd9a01ffd4299d4b2a", "MD4 89 bytes" }, 543 { &g_abRandom72KB[0], 90, "9ad1ec0845c287fa2c3400946f3b74c4", "MD4 90 bytes" }, 544 { &g_abRandom72KB[0], 91, "eff2124cd403f523ddefce349d913d33", "MD4 91 bytes" }, 545 { &g_abRandom72KB[0], 92, "5253b33449b543eadc7de0061c35cdf0", "MD4 92 bytes" }, 546 { &g_abRandom72KB[0], 93, "170f9e4cda211d9e2c48a3636d29120e", "MD4 93 bytes" }, 547 { &g_abRandom72KB[0], 94, "7c738164e285ec838c2736eb1396db34", "MD4 94 bytes" }, 548 { &g_abRandom72KB[0], 95, "cfedfee3e1ac2414d9083a8ffcb1d6c6", "MD4 95 bytes" }, 549 { &g_abRandom72KB[0], 96, "41ff6a9f247ba6ba7cbc16bc19101b0a", "MD4 96 bytes" }, 550 { &g_abRandom72KB[0], 97, "871ba92280eb7a1d838376840bd3eedb", "MD4 97 bytes" }, 551 { &g_abRandom72KB[0], 98, "1663e51bcea3a86fb19ed2753c3234ba", "MD4 98 bytes" }, 552 { &g_abRandom72KB[0], 99, "70d79f6be8da0a5ac1e05f9a3f72385d", "MD4 99 bytes" }, 553 { &g_abRandom72KB[0], 100, "1b2eeec426c1e5d8b2459b9308eec29e", "MD4 100 bytes" }, 554 { &g_abRandom72KB[0], 101, "1d7eac9ef23954d8c2e9115ca8ae43c2", "MD4 101 bytes" }, 555 { &g_abRandom72KB[0], 102, "f1dd48951a67dddecfca3572a6d1e41b", "MD4 102 bytes" }, 556 { &g_abRandom72KB[0], 103, "97c4443adf9896437112a826d3041f08", "MD4 103 bytes" }, 557 { &g_abRandom72KB[0], 104, "8834a131a88b9cf837389cf9cbf00a16", "MD4 104 bytes" }, 558 { &g_abRandom72KB[0], 105, "54c072c5b32150a631d584212be70918", "MD4 105 bytes" }, 559 { &g_abRandom72KB[0], 106, "28312975c6f5eeab493208ae2fd36401", "MD4 106 bytes" }, 560 { &g_abRandom72KB[0], 107, "921f5392f4ebd739647db883067e33a9", "MD4 107 bytes" }, 561 { &g_abRandom72KB[0], 108, "f60480eb631d321f8fba8d6f8b302bd7", "MD4 108 bytes" }, 562 { &g_abRandom72KB[0], 109, "ba9ec7166e3b8764d7110b097b0183a8", "MD4 109 bytes" }, 563 { &g_abRandom72KB[0], 110, "319757aba1d89a4a0e675ab08408956b", "MD4 110 bytes" }, 564 { &g_abRandom72KB[0], 111, "9a85d1eb0fb988c0d83aad8353e7e29e", "MD4 111 bytes" }, 565 { &g_abRandom72KB[0], 112, "fac16e7a4c33a301a0f626c5d291e27e", "MD4 112 bytes" }, 566 { &g_abRandom72KB[0], 113, "654d8ebe888100f4c484d22b68af9185", "MD4 113 bytes" }, 567 { &g_abRandom72KB[0], 114, "766df4a0681e87523146cc2c5084bc5b", "MD4 114 bytes" }, 568 { &g_abRandom72KB[0], 115, "c73d46e4e0039821f29eb595e63a6445", "MD4 115 bytes" }, 569 { &g_abRandom72KB[0], 116, "ed3544002078b116451827c45b8ce782", "MD4 116 bytes" }, 570 { &g_abRandom72KB[0], 117, "0db043d6e4006523679ad807d1b8b25d", "MD4 117 bytes" }, 571 { &g_abRandom72KB[0], 118, "59fd1acab527423854deb0b5cc8aa7fd", "MD4 118 bytes" }, 572 { &g_abRandom72KB[0], 119, "ca5d2aa85a493741e4e6bce6f6d23e1d", "MD4 119 bytes" }, 573 { &g_abRandom72KB[0], 120, "47f646776ef01e3c8e4e38c0beae7333", "MD4 120 bytes" }, 574 { &g_abRandom72KB[0], 121, "1905c60dc8f51c3b7c326b5cad9f6fd2", "MD4 121 bytes" }, 575 { &g_abRandom72KB[0], 122, "ce435994d14df744b26d5dfc80b95398", "MD4 122 bytes" }, 576 { &g_abRandom72KB[0], 123, "e3c102dcf64d29f2c386413c0483c3a6", "MD4 123 bytes" }, 577 { &g_abRandom72KB[0], 124, "aa7ed5d353dc66b7f23639ac5cf18636", "MD4 124 bytes" }, 578 { &g_abRandom72KB[0], 125, "37f30e534f4661a989e9c9367ded7536", "MD4 125 bytes" }, 579 { &g_abRandom72KB[0], 126, "da722a846bcdd3b5b8acf5100b44a9b4", "MD4 126 bytes" }, 580 { &g_abRandom72KB[0], 127, "b93bc385e0c6d2b31213bbec50111359", "MD4 127 bytes" }, 581 { &g_abRandom72KB[0], 128, "762bbb84570d3fb82ea0cd2b468d1ac1", "MD4 128 bytes" }, 582 { &g_abRandom72KB[0], 129, "0f7b751552acc853f88684616d21a737", "MD4 129 bytes" }, 583 { &g_abRandom72KB[0], 1024, "3722350e9c6c7e7ddf39f112cdd6b454", "MD4 1024 bytes" }, 584 { &g_abRandom72KB[0], 73001, "ee4fec16230aff2fd3f9075d781de22d", "MD4 73001 bytes" }, 585 { &g_abRandom72KB[0], 73728, "120c5ba7971af1dcc004c2a54e0afb44", "MD4 73728 bytes" }, 586 { &g_abRandom72KB[0x20c9], 9991, "7d1e0e69dfec5dd0ae84aeecd53516bd", "MD4 8393 bytes @9991" }, 587 }; 588 testGeneric("1.2.840.113549.2.4", s_abTests, RT_ELEMENTS(s_abTests), "MD4", RTDIGESTTYPE_MD4, 589 VINF_CR_DIGEST_SEVERELY_COMPROMISED); 387 590 } 388 591 … … 583 786 { &g_abRandom72KB[0x20c9], 9991, "6461339c6615d23c704298a313e07cf5", "MD5 8393 bytes @9991" }, 584 787 }; 585 testGeneric("1.2.840.113549.2.5", s_abTests, RT_ELEMENTS(s_abTests), "MD5", RTDIGESTTYPE_MD5); 788 testGeneric("1.2.840.113549.2.5", s_abTests, RT_ELEMENTS(s_abTests), "MD5", RTDIGESTTYPE_MD5, 789 VINF_CR_DIGEST_COMPROMISED); 586 790 } 587 791 … … 762 966 { &g_abRandom72KB[0x20c9], 9991, "62001184bacacce3774566d916055d425a85eba5", "SHA-1 8393 bytes @9991" }, 763 967 }; 764 testGeneric("1.3.14.3.2.26", s_abTests, RT_ELEMENTS(s_abTests), "SHA-1", RTDIGESTTYPE_SHA1 );968 testGeneric("1.3.14.3.2.26", s_abTests, RT_ELEMENTS(s_abTests), "SHA-1", RTDIGESTTYPE_SHA1, VINF_CR_DIGEST_DEPRECATED); 765 969 } 766 970 … … 930 1134 { &g_abRandom72KB[0x20c9], 9991, "8bd4c6142e36f15385769ebdeb855dcdf542f72d067315472a52ff626946310e", "SHA-256 8393 bytes @9991" }, 931 1135 }; 932 testGeneric("2.16.840.1.101.3.4.2.1", s_abTests, RT_ELEMENTS(s_abTests), "SHA-256", RTDIGESTTYPE_SHA256 );1136 testGeneric("2.16.840.1.101.3.4.2.1", s_abTests, RT_ELEMENTS(s_abTests), "SHA-256", RTDIGESTTYPE_SHA256, VINF_SUCCESS); 933 1137 } 934 1138 … … 968 1172 "75388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525", "SHA-224 abcdbc..." }, 969 1173 }; 970 testGeneric("2.16.840.1.101.3.4.2.4", s_abTests, RT_ELEMENTS(s_abTests), "SHA-224", RTDIGESTTYPE_SHA224 );1174 testGeneric("2.16.840.1.101.3.4.2.4", s_abTests, RT_ELEMENTS(s_abTests), "SHA-224", RTDIGESTTYPE_SHA224, VINF_SUCCESS); 971 1175 } 972 1176 … … 1136 1340 { &g_abRandom72KB[0x20c9], 9991, "d6ac7c68664df2e34dc6be233b33f8dad196348350b70a4c2c5a78eb54d6e297c819771313d798de7552b7a3cb85370aab25087e189f3be8560d49406ebb6280", "SHA-512 8393 bytes @9991" }, 1137 1341 }; 1138 testGeneric("2.16.840.1.101.3.4.2.3", s_abTests, RT_ELEMENTS(s_abTests), "SHA-512", RTDIGESTTYPE_SHA512 );1342 testGeneric("2.16.840.1.101.3.4.2.3", s_abTests, RT_ELEMENTS(s_abTests), "SHA-512", RTDIGESTTYPE_SHA512, VINF_SUCCESS); 1139 1343 } 1140 1344 … … 1174 1378 "23fec5bb94d60b23308192640b0c453335d664734fe40e7268674af9", "SHA-512/256 abcdef..." }, 1175 1379 }; 1176 testGeneric("2.16.840.1.101.3.4.2.5", s_abTests, RT_ELEMENTS(s_abTests), "SHA-512/224", RTDIGESTTYPE_SHA512T224 );1380 testGeneric("2.16.840.1.101.3.4.2.5", s_abTests, RT_ELEMENTS(s_abTests), "SHA-512/224", RTDIGESTTYPE_SHA512T224, VINF_SUCCESS); 1177 1381 } 1178 1382 #endif /* IPRT_WITHOUT_SHA512T224 */ … … 1212 1416 "3928e184fb8690f840da3988121d31be65cb9d3ef83ee6146feac861e19b563a", "SHA-512/256 abcdef..." }, 1213 1417 }; 1214 testGeneric("2.16.840.1.101.3.4.2.6", s_abTests, RT_ELEMENTS(s_abTests), "SHA-512/256", RTDIGESTTYPE_SHA512T256 );1418 testGeneric("2.16.840.1.101.3.4.2.6", s_abTests, RT_ELEMENTS(s_abTests), "SHA-512/256", RTDIGESTTYPE_SHA512T256, VINF_SUCCESS); 1215 1419 } 1216 1420 #endif /* !IPRT_WITHOUT_SHA512T256 */ … … 1249 1453 "09330c33f71147e83d192fc782cd1b4753111b173b3b05d22fa08086e3b0f712fcc7c71a557e2db966c3e9fa91746039", "SHA-384 abcdef..." }, 1250 1454 }; 1251 testGeneric("2.16.840.1.101.3.4.2.2", s_abTests, RT_ELEMENTS(s_abTests), "SHA-384", RTDIGESTTYPE_SHA384 );1455 testGeneric("2.16.840.1.101.3.4.2.2", s_abTests, RT_ELEMENTS(s_abTests), "SHA-384", RTDIGESTTYPE_SHA384, VINF_SUCCESS); 1252 1456 } 1253 1457 … … 1262 1466 1263 1467 testMd2(); 1468 testMd4(); 1264 1469 testMd5(); 1265 1470 testSha1();
Note:
See TracChangeset
for help on using the changeset viewer.