mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-08-12 22:41:33 +02:00
wc_Chacha_Process validated only its pointer arguments and then produced keystream directly from the context state. A zero-initialized ChaCha context, common for static or global storage, that received a nonce via wc_Chacha_SetIV but never had wc_Chacha_SetKey called would encrypt with an all-zero, attacker-predictable key and still return success. This is the same fail-open class already guarded against in wc_Arc4Process. Add a keySet flag to the ChaCha struct, set it in wc_Chacha_SetKey, and return MISSING_KEY from wc_Chacha_Process when the key was never set. Fixes F-6893.