Skip to content

Commit f93083b

Browse files
committed
OCSP: improve handling of OCSP no check extension
1 parent f82fd01 commit f93083b

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

wolfcrypt/src/asn.c

+8-4
Original file line numberDiff line numberDiff line change
@@ -10212,9 +10212,13 @@ int ParseCertRelative(DecodedCert* cert, int type, int verify, void* cm)
1021210212
}
1021310213

1021410214
#ifdef HAVE_OCSP
10215-
/* trust for the lifetime of the responder's cert*/
10216-
if (cert->ocspNoCheckSet && verify == VERIFY_OCSP)
10217-
verify = NO_VERIFY;
10215+
if (verify == VERIFY_OCSP_CERT) {
10216+
/* trust for the lifetime of the responder's cert*/
10217+
if (cert->ocspNoCheckSet)
10218+
verify = VERIFY;
10219+
else
10220+
verify = VERIFY_OCSP;
10221+
}
1021810222
#endif
1021910223
/* advance past extensions */
1022010224
cert->srcIdx = cert->sigIndex;
@@ -17957,7 +17961,7 @@ static int DecodeBasicOcspResponse(byte* source, word32* ioIndex,
1795717961

1795817962
/* Don't verify if we don't have access to Cert Manager. */
1795917963
ret = ParseCertRelative(&cert, CERT_TYPE,
17960-
noVerify ? NO_VERIFY : VERIFY_OCSP, cm);
17964+
noVerify ? NO_VERIFY : VERIFY_OCSP_CERT, cm);
1796117965
if (ret < 0) {
1796217966
WOLFSSL_MSG("\tOCSP Responder certificate parsing failed");
1796317967
FreeDecodedCert(&cert);

wolfssl/wolfcrypt/asn.h

+1
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ enum VerifyType {
599599
VERIFY_OCSP = 3,
600600
VERIFY_NAME = 4,
601601
VERIFY_SKIP_DATE = 5,
602+
VERIFY_OCSP_CERT = 6,
602603
};
603604

604605
#ifdef WOLFSSL_CERT_EXT

0 commit comments

Comments
 (0)