openssl: [REGRESSION] CMS_Final() fails when modifying CMS
Root cause: #19919 “Fix SMIME_crlf_copy() to properly report an error”
master 9e5bd8923bff3e4f0cbba05c7dadfe289c66eb6f
>=openssl-3.0.8 6259cf34eab1abdcfde12b7b3892b4780844091b
Previous behavior required CMS_final() to be called when CMS is modified (for example add recepient).
Currently, the CMS_final() fails with:
802BF10400000000:error:100C0102:BIO routines:bio_read_intern:passed a null parameter:crypto/bio/bio_lib.c:274:
802BF10400000000:error:1C80006B:Provider routines:ossl_cipher_generic_block_final:wrong final block length:providers/implementations/ciphers/ciphercommon.c:429:
Interestingly, if the CMS_final() is removed, the CMS is created correctly, however, it leaks memory.
Reproduction project is available here[1].
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 1
- Comments: 15 (15 by maintainers)
Commits related to this issue
- CMS_ContentInfo_free(): fix mem leak on encrypted content key Fixes #21026 — committed to siemens/openssl by DDvO a year ago
- CMS_ContentInfo_free(): fix mem leak on encrypted content key Fixes #21026 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: David von Oheimb <david... — committed to openssl/openssl by DDvO a year ago
- CMS_ContentInfo_free(): fix mem leak on encrypted content key Fixes #21026 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: David von Oheimb <david... — committed to openssl/openssl by DDvO a year ago
- CMS_ContentInfo_free(): fix mem leak on encrypted content key Fixes #21026 Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: David von Oheimb <david... — committed to boris-fx/mocha-openssl by DDvO a year ago
Hi,
Thanks great!
I can confirm that removing the
CMS_final()and replacing thei2d_CMS_bio()withi2d_CMS_bio_stream()and adding theBIO_free_all(CMS_dataInit(cms, NULL))works in all branches.Look at this branch: https://github.com/alonbl/openssl-regression-cms/tree/no-final
Alon