An error occurred while fetching folder content.
crypto: sm2 - fix a memory leak in sm2
Hongbo Li authored
[ Upstream commit 5cd259ca ]

SM2 module alloc ec->Q in sm2_set_pub_key(), when doing alg test in
test_akcipher_one(), it will set public key for every test vector,
and don't free ec->Q. This will cause a memory leak.

This patch alloc ec->Q in sm2_ec_ctx_init().

Fixes: ea7ecb66

 ("crypto: sm2 - introduce OSCCA SM2 asymmetric cipher algorithm")
Signed-off-by: default avatarHongbo Li <herberthbli@tencent.com>
Reviewed-by: default avatarTianjia Zhang <tianjia.zhang@linux.alibaba.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
1f8d5a57
Name Last commit Last update
..
asymmetric_keys x509: Add OID for NIST P384 and extend parser for it
async_tx async_xor: check src_offs is not NULL before updating it
842.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157
Kconfig Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Makefile crypto: ecdsa - Add support for ECDSA signature verification
acompress.c crypto: api - permit users to specify numa node of acomp hardware
adiantum.c crypto: remove cipher routines from public crypto API
aead.c crypto: algapi - enforce that all instances have a ->free() method
aegis.h crypto: aegis128 - Move simd prototypes into aegis.h
aegis128-core.c crypto: aegis128 - Move simd prototypes into aegis.h
aegis128-neon-inner.c crypto: aegis128/neon - move final tag check to SIMD domain
aegis128-neon.c crypto: aegis128 - Move simd prototypes into aegis.h
aes_generic.c crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN
aes_ti.c crypto: aes - create AES library based on the fixed time AES code
af_alg.c crypto: doc - fix kernel-doc notation in chacha.c and af_alg.c
ahash.c crypto: ahash - Add init_tfm/exit_tfm
akcipher.c crypto: algapi - enforce that all instances have a ->free() method
algapi.c crypto: algapi - use common mechanism for inheriting flags
algboss.c crypto: algboss - don't wait during notifier callback
algif_aead.c crypto: algif_aead - Do not set MAY_BACKLOG on the async path
algif_hash.c net: make ->{get,set}sockopt in proto_ops optional
algif_rng.c crypto: af_alg - add extra parameters for DRBG interface
algif_skcipher.c crypto: algif_skcipher - EBUSY on aio should be an error
ansi_cprng.c crypto: remove cipher routines from public crypto API
anubis.c crypto: remove CRYPTO_TFM_RES_BAD_KEY_LEN
api.c crypto: api - check for ERR pointers in crypto_destroy_tfm()
arc4.c crypto: arc4 - mark ecb(arc4) skcipher as obsolete
authenc.c crypto: algapi - use common mechanism for inheriting flags
authencesn.c crypto: algapi - use common mechanism for inheriting flags
blake2b_generic.c crypto: blake2b - update file comment
blake2s_generic.c crypto: blake2s - share the "shash" API boilerplate code
blowfish_common.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152
blowfish_generic.c crypto: blowfish - use unaligned accessors instead of alignmask
camellia_generic.c crypto: camellia - use unaligned accessors instead of alignmask
cast5_generic.c crypto: cast5 - use unaligned accessors instead of alignmask
cast6_generic.c crypto: cast6 - use unaligned accessors instead of alignmask
cast_common.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 44
cbc.c crypto: remove cipher routines from public crypto API
ccm.c crypto: remove cipher routines from public crypto API
cfb.c crypto: remove cipher routines from public crypto API
chacha20poly1305.c crypto: algapi - use common mechanism for inheriting flags
chacha_generic.c crypto: chacha_generic - remove unnecessary setkey() functions
cipher.c crypto: remove cipher routines from public crypto API
cmac.c crypto: remove cipher routines from public crypto API
compress.c crypto: compress - remove crt_u.compress (struct compress_tfm)
crc32_generic.c crypto: crc32-generic - Use SPDX-License-Identifier
crc32c_generic.c crypto: crc32c_generic - delete and fix duplicated words
crct10dif_common.c crypto: crct10dif - Add fallback for broken initrds
crct10dif_generic.c crypto: crct10dif_generic - fix duplicated words
cryptd.c crypto: algapi - use common mechanism for inheriting flags
crypto_engine.c
crypto_null.c
crypto_user_base.c
crypto_user_stat.c
ctr.c
cts.c
curve25519-generic.c
deflate.c
des_generic.c
dh.c
dh_helper.c
drbg.c
ecb.c
ecc.c
ecc.h
ecc_curve_defs.h
ecdh.c
ecdh_helper.c
ecdsa.c
ecdsasignature.asn1
echainiv.c
ecrdsa.c
ecrdsa_defs.h
ecrdsa_params.asn1
ecrdsa_pub_key.asn1
essiv.c
fcrypt.c
fips.c
gcm.c
geniv.c
gf128mul.c
ghash-generic.c
hash_info.c
hmac.c
internal.h
jitterentropy-kcapi.c
jitterentropy.c
jitterentropy.h
keywrap.c
khazad.c
kpp.c
lrw.c
lz4.c
lz4hc.c
lzo-rle.c
lzo.c
md4.c
md5.c
memneq.c
michael_mic.c