Coverity reports a spurious potential null pointer dereference in
cms_decrypt(), since the null pointer check takes place after the
pointer has already been dereferenced. The pointer can never be null,
since it is initialised to point to cipher_null at the point that the
containing structure is allocated.
Remove the redundant null pointer check, and for symmetry ensure that
the digest and public-key algorithm pointers are similarly initialised
at the point of allocation.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
if ( ! part )
return -ENOMEM;
list_add ( &part->list, &cms->participants );
+ part->digest = &digest_null;
+ part->pubkey = &pubkey_null;
/* Allocate certificate chain */
part->chain = x509_alloc_chain();
int pad_len;
int rc;
- /* Sanity checks */
- if ( ! cipher ) {
- rc = -ENOTTY;
- goto err_no_cipher;
- }
-
/* Check block size */
if ( ( image->len & ( cipher->blocksize - 1 ) ) != 0 ) {
DBGC ( cms, "CMS %p invalid length %zd\n", cms, image->len );
image->flags = original_flags;
err_cipher:
err_blocksize:
- err_no_cipher:
return rc;
}