libtom / libtomcrypt

LibTomCrypt is a fairly comprehensive, modular and portable cryptographic toolkit that provides developers with a vast array of well known published block ciphers, one-way hash functions, chaining modes, pseudo-random number generators, public key cryptography and a plethora of other routines.
https://www.libtom.net
Other
1.55k stars 457 forks source link

An improper locking bug(e.g., deadlock) on the lock ltc_ecc_fp_lock #571

Closed ycaibb closed 1 year ago

ycaibb commented 3 years ago

Hi, developers, thank you for your checking. It seems the lock ltc_ecc_fp_lock is not released correctly when cache_entry == NULL in the function ltc_ecc_fp_save_state?

https://github.com/libtom/libtomcrypt/blob/673f5ce29015a9bba3c96792920a10601b5b0718/src/math/fp/ltc_ecc_fp_mulmod.c#L1412-L1433

ycaibb commented 3 years ago

Hi, developers @sjaeckel @fperrad @karel-m

Any comments would be highly appreciated. Thank you.

Best Regards,

sjaeckel commented 3 years ago

btw. referring to https://github.com/OP-TEE/optee_os/pull/4842 would have been nice :)

looks fine, I'll apply the patch you posted to optee

ycaibb commented 3 years ago

@sjaeckel Thanks~

sjaeckel commented 1 year ago

Can you please check whether #626 correctly fixes this?

ycaibb commented 1 year ago

It looks good to me.