Skip to content

Commit fea3a88

Browse files
authored
Enhance checks for OpenSSL (project-chip#40582)
1 parent 9bceea9 commit fea3a88

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
@@ -1677,16 +1677,20 @@ CHIP_ERROR VerifyAttestationCertificateFormat(const ByteSpan & cert, Attestation
16771677
}
16781678
}
16791679
break;
1680-
case NID_subject_key_identifier:
1680+
case NID_subject_key_identifier: {
16811681
VerifyOrExit(!isCritical && !extSKIDPresent, err = CHIP_ERROR_INTERNAL);
1682-
VerifyOrExit(X509_get0_subject_key_id(x509Cert)->length == kSubjectKeyIdentifierLength, err = CHIP_ERROR_INTERNAL);
1682+
const ASN1_OCTET_STRING * pSKID = X509_get0_subject_key_id(x509Cert);
1683+
VerifyOrExit(pSKID != nullptr && pSKID->length == kSubjectKeyIdentifierLength, err = CHIP_ERROR_INTERNAL);
16831684
extSKIDPresent = true;
16841685
break;
1685-
case NID_authority_key_identifier:
1686+
}
1687+
case NID_authority_key_identifier: {
16861688
VerifyOrExit(!isCritical && !extAKIDPresent, err = CHIP_ERROR_INTERNAL);
1687-
VerifyOrExit(X509_get0_authority_key_id(x509Cert)->length == kAuthorityKeyIdentifierLength, err = CHIP_ERROR_INTERNAL);
1689+
const ASN1_OCTET_STRING * pAKID = X509_get0_authority_key_id(x509Cert);
1690+
VerifyOrExit(pAKID != nullptr && pAKID->length == kAuthorityKeyIdentifierLength, err = CHIP_ERROR_INTERNAL);
16881691
extAKIDPresent = true;
16891692
break;
1693+
}
16901694
default:
16911695
break;
16921696
}

0 commit comments

Comments
 (0)