Skip to content

Commit 4ca7325

Browse files
authored
Enhance checks for OpenSSL (project-chip#40579)
1 parent bf6da6f commit 4ca7325

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/crypto/CHIPCryptoPALOpenSSL.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,16 +1685,20 @@ CHIP_ERROR VerifyAttestationCertificateFormat(const ByteSpan & cert, Attestation
16851685
}
16861686
}
16871687
break;
1688-
case NID_subject_key_identifier:
1688+
case NID_subject_key_identifier: {
16891689
VerifyOrExit(!isCritical && !extSKIDPresent, err = CHIP_ERROR_INTERNAL);
1690-
VerifyOrExit(X509_get0_subject_key_id(x509Cert)->length == kSubjectKeyIdentifierLength, err = CHIP_ERROR_INTERNAL);
1690+
const ASN1_OCTET_STRING * pSKID = X509_get0_subject_key_id(x509Cert);
1691+
VerifyOrExit(pSKID != nullptr && pSKID->length == kSubjectKeyIdentifierLength, err = CHIP_ERROR_INTERNAL);
16911692
extSKIDPresent = true;
16921693
break;
1693-
case NID_authority_key_identifier:
1694+
}
1695+
case NID_authority_key_identifier: {
16941696
VerifyOrExit(!isCritical && !extAKIDPresent, err = CHIP_ERROR_INTERNAL);
1695-
VerifyOrExit(X509_get0_authority_key_id(x509Cert)->length == kAuthorityKeyIdentifierLength, err = CHIP_ERROR_INTERNAL);
1697+
const ASN1_OCTET_STRING * pAKID = X509_get0_authority_key_id(x509Cert);
1698+
VerifyOrExit(pAKID != nullptr && pAKID->length == kAuthorityKeyIdentifierLength, err = CHIP_ERROR_INTERNAL);
16961699
extAKIDPresent = true;
16971700
break;
1701+
}
16981702
default:
16991703
break;
17001704
}

0 commit comments

Comments
 (0)