summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2022-09-29 13:57:34 +0200
committerRichard Levitte <levitte@openssl.org>2022-10-05 14:02:03 +0200
commite077455e9e57ed4ee4676996b4a9aa11df6327a6 (patch)
treeedcb7412024f95fbc97c2c7a780f78ad05d586e3
parent9167a47f78159b0578bc032401ab1d66e14eecdb (diff)
Stop raising ERR_R_MALLOC_FAILURE in most places
Since OPENSSL_malloc() and friends report ERR_R_MALLOC_FAILURE, and at least handle the file name and line number they are called from, there's no need to report ERR_R_MALLOC_FAILURE where they are called directly, or when SSLfatal() and RLAYERfatal() is used, the reason `ERR_R_MALLOC_FAILURE` is changed to `ERR_R_CRYPTO_LIB`. There were a number of places where `ERR_R_MALLOC_FAILURE` was reported even though it was a function from a different sub-system that was called. Those places are changed to report ERR_R_{lib}_LIB, where {lib} is the name of that sub-system. Some of them are tricky to get right, as we have a lot of functions that belong in the ASN1 sub-system, and all the `sk_` calls or from the CRYPTO sub-system. Some extra adaptation was necessary where there were custom OPENSSL_malloc() wrappers, and some bugs are fixed alongside these changes. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/19301)
-rw-r--r--crypto/asn1/a_bitstr.c10
-rw-r--r--crypto/asn1/a_d2i_fp.c6
-rw-r--r--crypto/asn1/a_digest.c4
-rw-r--r--crypto/asn1/a_dup.c6
-rw-r--r--crypto/asn1/a_i2d_fp.c6
-rw-r--r--crypto/asn1/a_int.c16
-rw-r--r--crypto/asn1/a_mbstr.c5
-rw-r--r--crypto/asn1/a_object.c20
-rw-r--r--crypto/asn1/a_sign.c6
-rw-r--r--crypto/asn1/a_strex.c4
-rw-r--r--crypto/asn1/a_strnid.c6
-rw-r--r--crypto/asn1/a_time.c4
-rw-r--r--crypto/asn1/a_verify.c8
-rw-r--r--crypto/asn1/ameth_lib.c5
-rw-r--r--crypto/asn1/asn1_gen.c12
-rw-r--r--crypto/asn1/asn1_lib.c5
-rw-r--r--crypto/asn1/asn_mime.c8
-rw-r--r--crypto/asn1/asn_moid.c4
-rw-r--r--crypto/asn1/asn_mstbl.c2
-rw-r--r--crypto/asn1/asn_pack.c4
-rw-r--r--crypto/asn1/bio_asn1.c10
-rw-r--r--crypto/asn1/bio_ndef.c8
-rw-r--r--crypto/asn1/f_int.c1
-rw-r--r--crypto/asn1/f_string.c1
-rw-r--r--crypto/asn1/p5_pbe.c13
-rw-r--r--crypto/asn1/p5_pbev2.c107
-rw-r--r--crypto/asn1/p5_scrypt.c95
-rw-r--r--crypto/asn1/tasn_dec.c12
-rw-r--r--crypto/asn1/tasn_enc.c12
-rw-r--r--crypto/asn1/tasn_new.c30
-rw-r--r--crypto/asn1/tasn_prn.c4
-rw-r--r--crypto/asn1/tasn_scn.c4
-rw-r--r--crypto/asn1/tasn_utl.c6
-rw-r--r--crypto/asn1/x_info.c4
-rw-r--r--crypto/asn1/x_int64.c8
-rw-r--r--crypto/asn1/x_pkey.c13
-rw-r--r--crypto/async/arch/async_posix.c1
-rw-r--r--crypto/async/async.c15
-rw-r--r--crypto/async/async_wait.c4
-rw-r--r--crypto/bio/bf_buff.c9
-rw-r--r--crypto/bio/bf_lbuf.c10
-rw-r--r--crypto/bio/bf_nbio.c4
-rw-r--r--crypto/bio/bio_addr.c30
-rw-r--r--crypto/bio/bio_lib.c6
-rw-r--r--crypto/bio/bio_meth.c4
-rw-r--r--crypto/bio/bio_print.c8
-rw-r--r--crypto/bio/bio_sock.c7
-rw-r--r--crypto/bio/bss_acpt.c4
-rw-r--r--crypto/bio/bss_bio.c8
-rw-r--r--crypto/bio/bss_conn.c4
-rw-r--r--crypto/bio/bss_dgram.c8
-rw-r--r--crypto/bio/bss_dgram_pair.c4
-rw-r--r--crypto/bio/bss_log.c4
-rw-r--r--crypto/bio/bss_mem.c4
-rw-r--r--crypto/bn/bn_blind.c6
-rw-r--r--crypto/bn/bn_conv.c8
-rw-r--r--crypto/bn/bn_ctx.c12
-rw-r--r--crypto/bn/bn_gcd.c2
-rw-r--r--crypto/bn/bn_gf2m.c20
-rw-r--r--crypto/bn/bn_intern.c10
-rw-r--r--crypto/bn/bn_lib.c12
-rw-r--r--crypto/bn/bn_mod.c4
-rw-r--r--crypto/bn/bn_mont.c4
-rw-r--r--crypto/bn/bn_prime.c4
-rw-r--r--crypto/bn/bn_rand.c4
-rw-r--r--crypto/bn/bn_recp.c4
-rw-r--r--crypto/buffer/buffer.c10
-rw-r--r--crypto/cmac/cmac.c4
-rw-r--r--crypto/cmp/cmp_ctx.c10
-rw-r--r--crypto/cmp/cmp_msg.c2
-rw-r--r--crypto/cms/cms_dd.c2
-rw-r--r--crypto/cms/cms_enc.c14
-rw-r--r--crypto/cms/cms_env.c79
-rw-r--r--crypto/cms/cms_ess.c34
-rw-r--r--crypto/cms/cms_io.c3
-rw-r--r--crypto/cms/cms_lib.c18
-rw-r--r--crypto/cms/cms_pwri.c56
-rw-r--r--crypto/cms/cms_sd.c78
-rw-r--r--crypto/cms/cms_smime.c41
-rw-r--r--crypto/comp/c_zlib.c12
-rw-r--r--crypto/comp/comp_lib.c4
-rw-r--r--crypto/conf/conf_def.c31
-rw-r--r--crypto/conf/conf_lib.c2
-rw-r--r--crypto/conf/conf_mod.c10
-rw-r--r--crypto/core_algorithm.c2
-rw-r--r--crypto/ct/ct_b64.c6
-rw-r--r--crypto/ct/ct_log.c36
-rw-r--r--crypto/ct/ct_oct.c12
-rw-r--r--crypto/ct/ct_policy.c5
-rw-r--r--crypto/ct/ct_sct.c16
-rw-r--r--crypto/ct/ct_sct_ctx.c5
-rw-r--r--crypto/dh/dh_ameth.c12
-rw-r--r--crypto/dh/dh_err.c3
-rw-r--r--crypto/dh/dh_key.c7
-rw-r--r--crypto/dh/dh_lib.c6
-rw-r--r--crypto/dh/dh_meth.c6
-rw-r--r--crypto/dh/dh_pmeth.c8
-rw-r--r--crypto/dsa/dsa_ameth.c16
-rw-r--r--crypto/dsa/dsa_backend.c4
-rw-r--r--crypto/dsa/dsa_lib.c6
-rw-r--r--crypto/dsa/dsa_meth.c6
-rw-r--r--crypto/dsa/dsa_sign.c3
-rw-r--r--crypto/dso/dso_dl.c12
-rw-r--r--crypto/dso/dso_dlfcn.c12
-rw-r--r--crypto/dso/dso_lib.c18
-rw-r--r--crypto/dso/dso_vms.c43
-rw-r--r--crypto/dso/dso_win32.c24
-rw-r--r--crypto/ec/ec2_smpl.c6
-rw-r--r--crypto/ec/ec_ameth.c2
-rw-r--r--crypto/ec/ec_asn1.c45
-rw-r--r--crypto/ec/ec_backend.c16
-rw-r--r--crypto/ec/ec_check.c4
-rw-r--r--crypto/ec/ec_curve.c2
-rw-r--r--crypto/ec/ec_deprecated.c4
-rw-r--r--crypto/ec/ec_key.c6
-rw-r--r--crypto/ec/ec_kmeth.c11
-rw-r--r--crypto/ec/ec_lib.c24
-rw-r--r--crypto/ec/ec_mult.c27
-rw-r--r--crypto/ec/ec_oct.c4
-rw-r--r--crypto/ec/ec_pmeth.c8
-rw-r--r--crypto/ec/ecdh_ossl.c17
-rw-r--r--crypto/ec/ecdsa_ossl.c16
-rw-r--r--crypto/ec/eck_prn.c4
-rw-r--r--crypto/ec/ecp_nistp224.c10
-rw-r--r--crypto/ec/ecp_nistp256.c10
-rw-r--r--crypto/ec/ecp_nistp521.c10
-rw-r--r--crypto/ec/ecp_nistz256.c24
-rw-r--r--crypto/ec/ecp_s390x_nistp.c8
-rw-r--r--crypto/ec/ecp_smpl.c4
-rw-r--r--crypto/ec/ecx_backend.c13
-rw-r--r--crypto/ec/ecx_key.c9
-rw-r--r--crypto/ec/ecx_meth.c28
-rw-r--r--crypto/encode_decode/decoder_lib.c10
-rw-r--r--crypto/encode_decode/decoder_meth.c11
-rw-r--r--crypto/encode_decode/decoder_pkey.c13
-rw-r--r--crypto/encode_decode/encoder_lib.c6
-rw-r--r--crypto/encode_decode/encoder_meth.c11
-rw-r--r--crypto/encode_decode/encoder_pkey.c10
-rw-r--r--crypto/engine/eng_dyn.c12
-rw-r--r--crypto/engine/eng_init.c3
-rw-r--r--crypto/engine/eng_lib.c14
-rw-r--r--crypto/engine/eng_list.c9
-rw-r--r--crypto/engine/eng_openssl.c4