Changeset 62564 in vbox for trunk/src/VBox/Runtime/common/crypto
- Timestamp:
- Jul 26, 2016 2:43:03 PM (8 years ago)
- Location:
- trunk/src/VBox/Runtime/common/crypto
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/crypto/digest-builtin.cpp
r62477 r62564 64 64 static DECLCALLBACK(int) rtCrDigestMd2_Init(void *pvState, void *pvOpaque, bool fReInit) 65 65 { 66 RT_NOREF_PV(fReInit); RT_NOREF_PV(pvOpaque); 66 67 AssertReturn(pvOpaque == NULL, VERR_INVALID_PARAMETER); 67 68 RTMd2Init((PRTMD2CONTEXT)pvState); … … 118 119 static DECLCALLBACK(int) rtCrDigestMd5_Init(void *pvState, void *pvOpaque, bool fReInit) 119 120 { 121 RT_NOREF_PV(pvOpaque); RT_NOREF_PV(fReInit); 120 122 AssertReturn(pvOpaque == NULL, VERR_INVALID_PARAMETER); 121 123 RTMd5Init((PRTMD5CONTEXT)pvState); … … 172 174 static DECLCALLBACK(int) rtCrDigestSha1_Init(void *pvState, void *pvOpaque, bool fReInit) 173 175 { 176 RT_NOREF_PV(pvOpaque); RT_NOREF_PV(fReInit); 174 177 AssertReturn(pvOpaque == NULL, VERR_INVALID_PARAMETER); 175 178 RTSha1Init((PRTSHA1CONTEXT)pvState); … … 226 229 static DECLCALLBACK(int) rtCrDigestSha256_Init(void *pvState, void *pvOpaque, bool fReInit) 227 230 { 231 RT_NOREF_PV(pvOpaque); RT_NOREF_PV(fReInit); 228 232 AssertReturn(pvOpaque == NULL, VERR_INVALID_PARAMETER); 229 233 RTSha256Init((PRTSHA256CONTEXT)pvState); … … 279 283 static DECLCALLBACK(int) rtCrDigestSha512_Init(void *pvState, void *pvOpaque, bool fReInit) 280 284 { 285 RT_NOREF_PV(pvOpaque); RT_NOREF_PV(fReInit); 281 286 AssertReturn(pvOpaque == NULL, VERR_INVALID_PARAMETER); 282 287 RTSha512Init((PRTSHA512CONTEXT)pvState); … … 332 337 static DECLCALLBACK(int) rtCrDigestSha224_Init(void *pvState, void *pvOpaque, bool fReInit) 333 338 { 339 RT_NOREF_PV(pvOpaque); RT_NOREF_PV(fReInit); 334 340 AssertReturn(pvOpaque == NULL, VERR_INVALID_PARAMETER); 335 341 RTSha224Init((PRTSHA224CONTEXT)pvState); … … 385 391 static DECLCALLBACK(int) rtCrDigestSha384_Init(void *pvState, void *pvOpaque, bool fReInit) 386 392 { 393 RT_NOREF_PV(pvOpaque); RT_NOREF_PV(fReInit); 387 394 AssertReturn(pvOpaque == NULL, VERR_INVALID_PARAMETER); 388 395 RTSha384Init((PRTSHA384CONTEXT)pvState); … … 439 446 static DECLCALLBACK(int) rtCrDigestSha512t224_Init(void *pvState, void *pvOpaque, bool fReInit) 440 447 { 448 RT_NOREF_PV(pvOpaque); RT_NOREF_PV(fReInit); 441 449 AssertReturn(pvOpaque == NULL, VERR_INVALID_PARAMETER); 442 450 RTSha512t224Init((PRTSHA512T224CONTEXT)pvState); … … 493 501 static DECLCALLBACK(int) rtCrDigestSha512t256_Init(void *pvState, void *pvOpaque, bool fReInit) 494 502 { 503 RT_NOREF_PV(pvOpaque); RT_NOREF_PV(fReInit); 495 504 AssertReturn(pvOpaque == NULL, VERR_INVALID_PARAMETER); 496 505 RTSha512t256Init((PRTSHA512T256CONTEXT)pvState); … … 639 648 static DECLCALLBACK(RTDIGESTTYPE) rtCrDigestOsslEvp_GetDigestType(void *pvState) 640 649 { 641 //EVP_MD_CTX *pThis = (EVP_MD_CTX *)pvState;650 RT_NOREF_PV(pvState); //EVP_MD_CTX *pThis = (EVP_MD_CTX *)pvState; 642 651 /** @todo figure which digest algorithm it is! */ 643 652 return RTDIGESTTYPE_UNKNOWN; -
trunk/src/VBox/Runtime/common/crypto/pemfile.cpp
r62477 r62564 334 334 PCRTCRPEMSECTION *ppSectionHead, PRTERRINFO pErrInfo) 335 335 { 336 RT_NOREF_PV(pErrInfo); 337 336 338 /* 337 339 * Input validation. -
trunk/src/VBox/Runtime/common/crypto/pkcs7-asn1-decoder.cpp
r62477 r62564 57 57 const char *pszErrorTag) 58 58 { 59 RT_NOREF_PV(fFlags); RT_NOREF_PV(pszErrorTag); 59 60 pThis->u.pCore = NULL; 60 61 -
trunk/src/VBox/Runtime/common/crypto/pkcs7-sanity.cpp
r62477 r62564 44 44 { 45 45 bool const fAuthenticode = RT_BOOL(fFlags & RTCRPKCS7SIGNEDDATA_SANITY_F_AUTHENTICODE); 46 RT_NOREF_PV(fFlags); 46 47 47 48 //RTAsn1Dump(&pSignedData->SeqCore.Asn1Core, 0, 0, RTAsn1DumpStrmPrintfV, g_pStdOut); … … 61 62 if (pSignedData->DigestAlgorithms.cItems != 1 && fAuthenticode) 62 63 return RTErrInfoSetF(pErrInfo, VERR_CR_SPC_NOT_EXACTLY_ONE_DIGEST_ALGO, 63 " SignedData.DigestAlgorithms has more than one algorithm (%u)",64 p SignedData->DigestAlgorithms.cItems);64 "%s: SignedData.DigestAlgorithms has more than one algorithm (%u)", 65 pszErrorTag, pSignedData->DigestAlgorithms.cItems); 65 66 66 67 if (fFlags & RTCRPKCS7SIGNEDDATA_SANITY_F_ONLY_KNOWN_HASH) … … 69 70 if (RTCrX509AlgorithmIdentifier_QueryDigestType(&pSignedData->DigestAlgorithms.paItems[i]) == RTDIGESTTYPE_INVALID) 70 71 return RTErrInfoSetF(pErrInfo, VERR_CR_PKCS7_UNKNOWN_DIGEST_ALGORITHM, 71 " SignedData.DigestAlgorithms[%i] is not known: %s",72 i, pSignedData->DigestAlgorithms.paItems[i].Algorithm.szObjId);72 "%s: SignedData.DigestAlgorithms[%i] is not known: %s", 73 pszErrorTag, i, pSignedData->DigestAlgorithms.paItems[i].Algorithm.szObjId); 73 74 if (pSignedData->DigestAlgorithms.paItems[i].Parameters.enmType != RTASN1TYPE_NULL) 74 75 return RTErrInfoSetF(pErrInfo, VERR_CR_PKCS7_DIGEST_PARAMS_NOT_IMPL, 75 " SignedData.DigestAlgorithms[%i] has parameters: tag=%u",76 i, pSignedData->DigestAlgorithms.paItems[i].Parameters.u.Core.uTag);76 "%s: SignedData.DigestAlgorithms[%i] has parameters: tag=%u", 77 pszErrorTag, i, pSignedData->DigestAlgorithms.paItems[i].Parameters.u.Core.uTag); 77 78 } 78 79 … … 82 83 if ( (fFlags & RTCRPKCS7SIGNEDDATA_SANITY_F_SIGNING_CERT_PRESENT) 83 84 && pSignedData->Certificates.cItems == 0) 84 return RTErrInfoSet (pErrInfo, VERR_CR_PKCS7_NO_CERTIFICATES,85 "SignedData.Certifcates is empty, expected at least one certificate");85 return RTErrInfoSetF(pErrInfo, VERR_CR_PKCS7_NO_CERTIFICATES, 86 "%s: SignedData.Certifcates is empty, expected at least one certificate", pszErrorTag); 86 87 87 88 /* … … 89 90 */ 90 91 if (fAuthenticode && RTAsn1Core_IsPresent(&pSignedData->Crls)) 91 return RTErrInfoSet (pErrInfo, VERR_CR_PKCS7_EXPECTED_NO_CRLS,92 "SignedData.Crls is not empty as expected for authenticode.");92 return RTErrInfoSetF(pErrInfo, VERR_CR_PKCS7_EXPECTED_NO_CRLS, 93 "%s: SignedData.Crls is not empty as expected for authenticode.", pszErrorTag); 93 94 /** @todo check Crls when they become important. */ 94 95 … … 97 98 */ 98 99 if (pSignedData->SignerInfos.cItems == 0) 99 return RTErrInfoSet (pErrInfo, VERR_CR_PKCS7_NO_SIGNER_INFOS, "SignedData.SignerInfos is empty?");100 return RTErrInfoSetF(pErrInfo, VERR_CR_PKCS7_NO_SIGNER_INFOS, "%s: SignedData.SignerInfos is empty?", pszErrorTag); 100 101 if (fAuthenticode && pSignedData->SignerInfos.cItems != 1) 101 102 return RTErrInfoSetF(pErrInfo, VERR_CR_PKCS7_EXPECTED_ONE_SIGNER_INFO, 102 " SignedData.SignerInfos should have one entry for authenticode: %u",103 p SignedData->SignerInfos.cItems);103 "%s: SignedData.SignerInfos should have one entry for authenticode: %u", 104 pszErrorTag, pSignedData->SignerInfos.cItems); 104 105 105 106 for (uint32_t i = 0; i < pSignedData->SignerInfos.cItems; i++) … … 109 110 if (RTAsn1Integer_UnsignedCompareWithU32(&pSignerInfo->Version, RTCRPKCS7SIGNERINFO_V1) != 0) 110 111 return RTErrInfoSetF(pErrInfo, VERR_CR_PKCS7_SIGNER_INFO_VERSION, 111 " SignedData.SignerInfos[%u] version is %llu, expected %u",112 i, pSignerInfo->Version.uValue.u, RTCRPKCS7SIGNERINFO_V1);112 "%s: SignedData.SignerInfos[%u] version is %llu, expected %u", 113 pszErrorTag, i, pSignerInfo->Version.uValue.u, RTCRPKCS7SIGNERINFO_V1); 113 114 114 115 /* IssuerAndSerialNumber. */ … … 120 121 if (pSignerInfo->IssuerAndSerialNumber.SerialNumber.Asn1Core.cb == 0) 121 122 return RTErrInfoSetF(pErrInfo, VERR_CR_PKCS7_SIGNER_INFO_NO_ISSUER_SERIAL_NO, 122 "SignedData.SignerInfos[%u].IssuerAndSerialNumber.SerialNumber is missing (zero length)", i); 123 "%s: SignedData.SignerInfos[%u].IssuerAndSerialNumber.SerialNumber is missing (zero length)", 124 pszErrorTag, i); 123 125 124 126 PCRTCRX509CERTIFICATE pCert; … … 128 130 if (!pCert && (fFlags & RTCRPKCS7SIGNEDDATA_SANITY_F_SIGNING_CERT_PRESENT)) 129 131 return RTErrInfoSetF(pErrInfo, VERR_CR_PKCS7_SIGNER_CERT_NOT_SHIPPED, 130 "SignedData.SignerInfos[%u].IssuerAndSerialNumber not found in T0.Certificates", i); 132 "%s: SignedData.SignerInfos[%u].IssuerAndSerialNumber not found in T0.Certificates", 133 pszErrorTag, i); 131 134 132 135 /* DigestAlgorithm */ … … 138 141 if (j >= pSignedData->DigestAlgorithms.cItems) 139 142 return RTErrInfoSetF(pErrInfo, VERR_CR_PKCS7_DIGEST_ALGO_NOT_FOUND_IN_LIST, 140 " SignedData.SignerInfos[%u].DigestAlgorithm (%s) not found in SignedData.DigestAlgorithms",141 i, pSignerInfo->DigestAlgorithm.Algorithm.szObjId);143 "%s: SignedData.SignerInfos[%u].DigestAlgorithm (%s) not found in SignedData.DigestAlgorithms", 144 pszErrorTag, i, pSignerInfo->DigestAlgorithm.Algorithm.szObjId); 142 145 143 146 /* Digest encryption algorithm. */ … … 163 166 { 164 167 if (fFoundContentInfo) 165 return RTErrInfoSet (pErrInfo, VERR_CR_PKCS7_MISSING_CONTENT_TYPE_ATTRIB,166 "Multiple authenticated content-type attributes.");168 return RTErrInfoSetF(pErrInfo, VERR_CR_PKCS7_MISSING_CONTENT_TYPE_ATTRIB, 169 "%s: Multiple authenticated content-type attributes.", pszErrorTag); 167 170 fFoundContentInfo = true; 168 171 AssertReturn(pAttrib->enmType == RTCRPKCS7ATTRIBUTETYPE_OBJ_IDS, VERR_INTERNAL_ERROR_3); 169 172 if (pAttrib->uValues.pObjIds->cItems != 1) 170 173 return RTErrInfoSetF(pErrInfo, VERR_CR_PKCS7_BAD_CONTENT_TYPE_ATTRIB, 171 " Expected exactly one value for content-type attrib, found: %u",172 p Attrib->uValues.pObjIds->cItems);174 "%s: Expected exactly one value for content-type attrib, found: %u", 175 pszErrorTag, pAttrib->uValues.pObjIds->cItems); 173 176 } 174 177 else if (RTAsn1ObjId_CompareWithString(&pAttrib->Type, RTCR_PKCS9_ID_MESSAGE_DIGEST_OID) == 0) 175 178 { 176 179 if (fFoundMessageDigest) 177 return RTErrInfoSet (pErrInfo, VERR_CR_PKCS7_MISSING_MESSAGE_DIGEST_ATTRIB,178 "Multiple authenticated message-digest attributes.");180 return RTErrInfoSetF(pErrInfo, VERR_CR_PKCS7_MISSING_MESSAGE_DIGEST_ATTRIB, 181 "%s: Multiple authenticated message-digest attributes.", pszErrorTag); 179 182 fFoundMessageDigest = true; 180 183 AssertReturn(pAttrib->enmType == RTCRPKCS7ATTRIBUTETYPE_OCTET_STRINGS, VERR_INTERNAL_ERROR_3); 181 184 if (pAttrib->uValues.pOctetStrings->cItems != 1) 182 185 return RTErrInfoSetF(pErrInfo, VERR_CR_PKCS7_BAD_CONTENT_TYPE_ATTRIB, 183 " Expected exactly one value for message-digest attrib, found: %u",184 p Attrib->uValues.pOctetStrings->cItems);186 "%s: Expected exactly one value for message-digest attrib, found: %u", 187 pszErrorTag, pAttrib->uValues.pOctetStrings->cItems); 185 188 } 186 189 } 187 190 188 191 if (!fFoundContentInfo) 189 return RTErrInfoSet (pErrInfo, VERR_CR_PKCS7_MISSING_CONTENT_TYPE_ATTRIB,190 "Missing authenticated content-type attribute.");192 return RTErrInfoSetF(pErrInfo, VERR_CR_PKCS7_MISSING_CONTENT_TYPE_ATTRIB, 193 "%s: Missing authenticated content-type attribute.", pszErrorTag); 191 194 if (!fFoundMessageDigest) 192 return RTErrInfoSet (pErrInfo, VERR_CR_PKCS7_MISSING_MESSAGE_DIGEST_ATTRIB,193 "Missing authenticated message-digest attribute.");195 return RTErrInfoSetF(pErrInfo, VERR_CR_PKCS7_MISSING_MESSAGE_DIGEST_ATTRIB, 196 "%s: Missing authenticated message-digest attribute.", pszErrorTag); 194 197 } 195 198 } -
trunk/src/VBox/Runtime/common/crypto/pkcs7-verify.cpp
r62477 r62564 53 53 void const *pvContent, uint32_t cbContent, PRTERRINFO pErrInfo) 54 54 { 55 RT_NOREF_PV(fFlags); 56 55 57 /* 56 58 * Verify using OpenSSL. … … 149 151 void *pvUser, PRTERRINFO pErrInfo) 150 152 { 153 RT_NOREF_PV(hCertPaths); RT_NOREF_PV(pvUser); 151 154 int rc = VINF_SUCCESS; 152 155 … … 169 172 void *pvUser, PRTERRINFO pErrInfo) 170 173 { 174 RT_NOREF_PV(hCertPaths); RT_NOREF_PV(pvUser); 171 175 int rc = VINF_SUCCESS; 172 176 if (fFlags & RTCRPKCS7VCC_F_SIGNED_DATA) -
trunk/src/VBox/Runtime/common/crypto/pkix-signature-rsa.cpp
r62477 r62564 140 140 bool fSigning, PCRTASN1BITSTRING pKey, PCRTASN1DYNTYPE pParams) 141 141 { 142 RT_NOREF_PV(pDesc); RT_NOREF_PV(pvState); RT_NOREF_PV(pvOpaque); 143 142 144 if (pParams) 143 145 return VERR_CR_PKIX_SIGNATURE_TAKES_NO_PARAMETERS; … … 199 201 { 200 202 PRTCRPKIXSIGNATURERSA pThis = (PRTCRPKIXSIGNATURERSA)pvState; 203 RT_NOREF_PV(fSigning); RT_NOREF_PV(pDesc); 201 204 Assert(pThis->fSigning == fSigning); NOREF(pThis); 202 205 return VINF_SUCCESS; … … 208 211 { 209 212 PRTCRPKIXSIGNATURERSA pThis = (PRTCRPKIXSIGNATURERSA)pvState; 210 Assert(pThis->fSigning == fSigning); NOREF(pThis); 213 RT_NOREF_PV(fSigning); RT_NOREF_PV(pDesc); 214 Assert(pThis->fSigning == fSigning); 211 215 212 216 RTBigNumDestroy(&pThis->Modulus); … … 297 301 { 298 302 PRTCRPKIXSIGNATURERSA pThis = (PRTCRPKIXSIGNATURERSA)pvState; 303 RT_NOREF_PV(pDesc); 299 304 Assert(!pThis->fSigning); 300 305 if (cbSignature > sizeof(pThis->Scratch) / 2) … … 386 391 { 387 392 PRTCRPKIXSIGNATURERSA pThis = (PRTCRPKIXSIGNATURERSA)pvState; 393 RT_NOREF_PV(pDesc); RT_NOREF_PV(hDigest); RT_NOREF_PV(pvSignature); RT_NOREF_PV(pcbSignature); 388 394 Assert(pThis->fSigning); NOREF(pThis); 389 395 return VERR_NOT_IMPLEMENTED; -
trunk/src/VBox/Runtime/common/crypto/spc-asn1-decoder.cpp
r62477 r62564 48 48 49 49 { 50 RT_NOREF_PV(fFlags); RT_NOREF_PV(pszErrorTag); 51 50 52 int rc; 51 53 RTASN1CURSOR SubCursor; -
trunk/src/VBox/Runtime/common/crypto/store-inmem.cpp
r62477 r62564 228 228 uint8_t *pbKey, size_t cbKey, size_t *pcbKeyRet) 229 229 { 230 RT_NOREF_PV(pvProvider); RT_NOREF_PV(pCertCtx); RT_NOREF_PV(pbKey); RT_NOREF_PV(cbKey); RT_NOREF_PV(pcbKeyRet); 230 231 //PRTCRSTOREINMEM pThis = (PRTCRSTOREINMEM)pvProvider; 231 232 return VERR_NOT_FOUND; -
trunk/src/VBox/Runtime/common/crypto/store.cpp
r62477 r62564 323 323 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 324 324 AssertReturn(pThis->u32Magic == RTCRSTOREINT_MAGIC, VERR_INVALID_HANDLE); 325 RT_NOREF_PV(fFlags); 325 326 326 327 /* … … 376 377 AssertPtrReturn(pThis, VERR_INVALID_HANDLE); 377 378 AssertReturn(pThis->u32Magic == RTCRSTOREINT_MAGIC, VERR_INVALID_HANDLE); 379 RT_NOREF_PV(fFlags); 378 380 379 381 /* -
trunk/src/VBox/Runtime/common/crypto/x509-asn1-decoder.cpp
r62477 r62564 44 44 PRTCRX509EXTENSION pThis, const char *pszErrorTag) 45 45 { 46 RT_NOREF_PV(fFlags); RT_NOREF_PV(pszErrorTag); 47 46 48 pThis->enmValue = RTCRX509EXTENSIONVALUE_UNKNOWN; 47 49 -
trunk/src/VBox/Runtime/common/crypto/x509-certpaths.cpp
r62477 r62564 750 750 pNode = pParent; 751 751 } 752 753 RT_NOREF_PV(pThis); 752 754 } 753 755 … … 1137 1139 uint32_t uVerbosity, PFNRTDUMPPRINTFV pfnPrintfV, void *pvUser) 1138 1140 { 1141 RT_NOREF_PV(pThis); 1139 1142 rtDumpPrintf(pfnPrintfV, pvUser, "Path #%u: %s, %u deep, rcVerify=%Rrc\n", 1140 1143 iPath, RTCRX509CERTPATHNODE_SRC_IS_TRUSTED(pCurLeaf->uSrc) ? "trusted" : "untrusted", pCurLeaf->uDepth, -
trunk/src/VBox/Runtime/common/crypto/x509-sanity.cpp
r62477 r62564 41 41 static int rtCrX509Validity_CheckSanityExtra(PCRTCRX509VALIDITY pThis, uint32_t fFlags, PRTERRINFO pErrInfo, const char *pszErrorTag) 42 42 { 43 RT_NOREF_PV(fFlags); 44 43 45 if (RTAsn1Time_Compare(&pThis->NotBefore, &pThis->NotAfter) > 0) 44 46 return RTErrInfoSetF(pErrInfo, VERR_CR_X509_VALIDITY_SWAPPED, "%s: NotBefore is after NotAfter", pszErrorTag); … … 50 52 static int rtCrX509Name_CheckSanityExtra(PCRTCRX509NAME pThis, uint32_t fFlags, PRTERRINFO pErrInfo, const char *pszErrorTag) 51 53 { 54 RT_NOREF_PV(fFlags); 55 52 56 if (pThis->cItems == 0) 53 57 return RTErrInfoSetF(pErrInfo, VERR_CR_X509_NAME_EMPTY_SET, "%s: Has no components.", pszErrorTag); … … 94 98 PRTERRINFO pErrInfo, const char *pszErrorTag) 95 99 { 100 RT_NOREF_PV(fFlags); 96 101 if (pThis->SubjectPublicKey.cBits <= 32) 97 102 return RTErrInfoSetF(pErrInfo, VERR_CR_X509_PUBLIC_KEY_TOO_SMALL, … … 104 109 PRTERRINFO pErrInfo, const char *pszErrorTag) 105 110 { 111 RT_NOREF_PV(fFlags); 112 106 113 if ( RTAsn1Integer_IsPresent(&pThis->T0.Version) 107 114 && RTAsn1Integer_UnsignedCompareWithU32(&pThis->T0.Version, RTCRX509TBSCERTIFICATE_V1) != 0 … … 134 141 PRTERRINFO pErrInfo, const char *pszErrorTag) 135 142 { 143 RT_NOREF_PV(fFlags); 144 136 145 if (RTCrX509AlgorithmIdentifier_Compare(&pThis->SignatureAlgorithm, &pThis->TbsCertificate.Signature) != 0) 137 146 return RTErrInfoSetF(pErrInfo, VERR_CR_X509_CERT_TBS_SIGN_ALGO_MISMATCH,
Note:
See TracChangeset
for help on using the changeset viewer.