зеркало из https://github.com/mozilla/pjs.git
399326 - libpkix is unable to validate cert for certUsageStatusResponder. r=nelson
This commit is contained in:
Родитель
0d434e89d6
Коммит
fd811fe503
|
@ -492,7 +492,6 @@ cert_VerifyCertChainOld(CERTCertDBHandle *handle, CERTCertificate *cert,
|
||||||
int count;
|
int count;
|
||||||
int currentPathLen = 0;
|
int currentPathLen = 0;
|
||||||
int pathLengthLimit = CERT_UNLIMITED_PATH_CONSTRAINT;
|
int pathLengthLimit = CERT_UNLIMITED_PATH_CONSTRAINT;
|
||||||
int flags;
|
|
||||||
unsigned int caCertType;
|
unsigned int caCertType;
|
||||||
unsigned int requiredCAKeyUsage;
|
unsigned int requiredCAKeyUsage;
|
||||||
unsigned int requiredFlags;
|
unsigned int requiredFlags;
|
||||||
|
@ -730,36 +729,49 @@ cert_VerifyCertChainOld(CERTCertDBHandle *handle, CERTCertificate *cert,
|
||||||
* explicitly UNtrusted. We won't know until we examine the
|
* explicitly UNtrusted. We won't know until we examine the
|
||||||
* trust bits.
|
* trust bits.
|
||||||
*/
|
*/
|
||||||
if (certUsage == certUsageStatusResponder) {
|
unsigned int flags;
|
||||||
/* XXX NSS has done this for years, but it seems incorrect. */
|
|
||||||
rv = rvFinal;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
if (certUsage != certUsageAnyCA &&
|
||||||
* check the trust parms of the issuer
|
certUsage != certUsageStatusResponder) {
|
||||||
*/
|
|
||||||
if ( certUsage == certUsageVerifyCA ) {
|
/*
|
||||||
if ( subjectCert->nsCertType & NS_CERT_TYPE_EMAIL_CA ) {
|
* check the trust parms of the issuer
|
||||||
trustType = trustEmail;
|
*/
|
||||||
} else if ( subjectCert->nsCertType & NS_CERT_TYPE_SSL_CA ) {
|
if ( certUsage == certUsageVerifyCA ) {
|
||||||
trustType = trustSSL;
|
if ( subjectCert->nsCertType & NS_CERT_TYPE_EMAIL_CA ) {
|
||||||
} else {
|
trustType = trustEmail;
|
||||||
trustType = trustObjectSigning;
|
} else if ( subjectCert->nsCertType & NS_CERT_TYPE_SSL_CA ) {
|
||||||
}
|
trustType = trustSSL;
|
||||||
}
|
} else {
|
||||||
|
trustType = trustObjectSigning;
|
||||||
flags = SEC_GET_TRUST_FLAGS(issuerCert->trust, trustType);
|
}
|
||||||
|
}
|
||||||
if (flags & CERTDB_VALID_CA) {
|
|
||||||
if ( ( flags & requiredFlags ) == requiredFlags) {
|
flags = SEC_GET_TRUST_FLAGS(issuerCert->trust, trustType);
|
||||||
/* we found a trusted one, so return */
|
|
||||||
rv = rvFinal;
|
if (flags & CERTDB_VALID_CA) {
|
||||||
goto done;
|
if ( ( flags & requiredFlags ) == requiredFlags) {
|
||||||
}
|
/* we found a trusted one, so return */
|
||||||
validCAOverride = PR_TRUE;
|
rv = rvFinal;
|
||||||
}
|
goto done;
|
||||||
}
|
}
|
||||||
|
validCAOverride = PR_TRUE;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* Check if we have any valid trust when cheching for
|
||||||
|
* certUsageAnyCA or certUsageStatusResponder. */
|
||||||
|
for (trustType = trustSSL; trustType < trustTypeNone;
|
||||||
|
trustType++) {
|
||||||
|
flags = SEC_GET_TRUST_FLAGS(issuerCert->trust, trustType);
|
||||||
|
if ((flags & requiredFlags) == requiredFlags) {
|
||||||
|
rv = rvFinal;
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
if (flags & CERTDB_VALID_CA)
|
||||||
|
validCAOverride = PR_TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!validCAOverride) {
|
if (!validCAOverride) {
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -101,11 +101,37 @@ pkix_pl_Pk11CertStore_CheckTrust(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rv == SECSuccess) {
|
if (rv == SECSuccess) {
|
||||||
unsigned int certFlags;
|
unsigned int certFlags;
|
||||||
|
|
||||||
|
if (certUsage != certUsageAnyCA &&
|
||||||
|
certUsage != certUsageStatusResponder) {
|
||||||
|
CERTCertificate *nssCert = cert->nssCert;
|
||||||
|
|
||||||
|
if (certUsage == certUsageVerifyCA) {
|
||||||
|
if (nssCert->nsCertType & NS_CERT_TYPE_EMAIL_CA) {
|
||||||
|
trustType = trustEmail;
|
||||||
|
} else if (nssCert->nsCertType & NS_CERT_TYPE_SSL_CA) {
|
||||||
|
trustType = trustSSL;
|
||||||
|
} else {
|
||||||
|
trustType = trustObjectSigning;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
certFlags = SEC_GET_TRUST_FLAGS((&trust), trustType);
|
certFlags = SEC_GET_TRUST_FLAGS((&trust), trustType);
|
||||||
if ((certFlags & requiredFlags) == requiredFlags) {
|
if ((certFlags & requiredFlags) == requiredFlags) {
|
||||||
trusted = PKIX_TRUE;
|
trusted = PKIX_TRUE;
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
for (trustType = trustSSL; trustType < trustTypeNone;
|
||||||
|
trustType++) {
|
||||||
|
certFlags =
|
||||||
|
SEC_GET_TRUST_FLAGS((&trust), trustType);
|
||||||
|
if ((certFlags & requiredFlags) == requiredFlags) {
|
||||||
|
trusted = PKIX_TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*pTrusted = trusted;
|
*pTrusted = trusted;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче