| 2d7740f6 | 03-Jun-2022 |
Sohaib ul Hassan <sohaib.ul.hassan@unikie.com> |
core: libtomcrypt: Remove prng_state* NULL pointer check from x25519_make_key()
Calling x25519_make_key(prng_state *prng, int wprng, curve25519_key *key) checks if prng_state is NULL. This would req
core: libtomcrypt: Remove prng_state* NULL pointer check from x25519_make_key()
Calling x25519_make_key(prng_state *prng, int wprng, curve25519_key *key) checks if prng_state is NULL. This would require the caller to pass a valid pointer. Initializing prng_state in some configurations can get very large. For instance, xtest for X25519 key generation causes the TA to panic due to stack overrun
F/TC:? 0 trace_syscall:151 syscall #54 (syscall_obj_generate_key) E/TC:1 Dead canary at end of 'stack_abt[3]' (0xe1a01fc) E/TC:1 Panic at core/kernel/thread.c:124 <thread_check_canaries> E/TC:1 TEE load address @ 0xe100000 E/TC:1 Call stack: E/TC:1 0x0e108934 print_kernel_stack at optee_os/core/arch/arm/kernel/unwind_arm64.c:80 E/TC:1 0x0e113f24 __do_panic at optee_os/core/kernel/panic.c:24 E/TC:1 0x0e116eb4 thread_check_canaries at optee_os/core/kernel/thread.c:115 E/TC:1 0x0e106a60 thread_handle_std_smc at optee_os/core/arch/arm/kernel/thread_optee_smc.c:56
OP-TEE registers a custom prng descriptor (prng_crypto_desc) used for LTC asymmetric crypto operations and prng_state is not used.
The LTC_ARGCHK(prng != NULL) check is not present in the LTC key generation functions for ECC, RSA, DH and DSA implementations.
Acked-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Signed-off-by: Sohaib ul Hassan <sohaib.ul.hassan@unikie.com>
show more ...
|