CSSM_DATA_PTR contentType, digest;
OSStatus status, status2;
- cinfo = &(sigd->contentInfo);
+ if (sigd == NULL || sigd->signerInfos == NULL || i >= SecCmsSignedDataSignerInfoCount(sigd)) {
+ return errSecParam;
+ }
+ cinfo = &(sigd->contentInfo);
signerinfo = sigd->signerInfos[i];
/* Signature or digest level verificationStatus errors should supercede
/* Find digest and contentType for signerinfo */
algiddata = SecCmsSignerInfoGetDigestAlg(signerinfo);
if (algiddata == NULL) {
- return errSecInternalError; // shouldn't have happened, this is likely due to corrupted data
+ return errSecInvalidDigestAlgorithm;
}
digest = SecCmsSignedDataGetDigestByAlgTag(sigd, algiddata->offset);
- if(digest == NULL) {
- /*
- * No digests; this probably had detached content the caller has to
- * deal with.
- * FIXME: need some error return for this (as well as many
- * other places in this library).
- */
- return errSecDataNotAvailable;
- }
+ if(digest == NULL) {
+ /*
+ * No digests; this probably had detached content the caller has to
+ * deal with.
+ * FIXME: need some error return for this (as well as many
+ * other places in this library).
+ */
+ return errSecDataNotAvailable;
+ }
contentType = SecCmsContentInfoGetContentTypeOID(cinfo);
/* verify signature */