2024-04-19 12:26 AM
In the X-CUBE-CRYPTOLIB v4.1.0, the documentation say that cmox_cipher_decrypt() accept the CMOX_AESFAST_CFB_DEC_ALGO as algo. But CMOX_AESFAST_CFB_DEC_ALGO is not defined, instead there is a CMOX_AESFAST_CFB_DEC_ALG in cmox_cfb.h.
Solved! Go to Solution.
2024-04-25 08:43 AM - edited 2024-04-25 08:48 AM
Hi @nicolas
Thank you, sorry I didn't catch your first request. I created a defect ticket to correct the file description or the cryptolib implementation (Ticket 180042 Submitted, this is internal ticket not accessible for you, used for tracking purpose ).
Just to give more analysis, yes I confirm the first @arg name (CMOX_AESFAST_CFB_DEC_ALGO) was incorrect. The correct @arg name is (CMOX_AESFAST_CFB_DEC_ALG).
There will be compilation error when passing CMOX_AESFAST_CFB_DEC_ALGO as first parameter to cmox_cipher_decrypt.
As workaround, we can use either CMOX_AES_CFB_DEC_ALGO or CMOX_AESFAST_CFB_DEC_ALG according to line 151 of cmox_cfb.h file.
Best regards,
Younes
2024-04-25 01:33 AM - edited 2024-04-25 08:46 AM
Hello @nicolas
The CMOX_AESFAST_CFB_DEC_ALGO is supported by the cryptolib V4.1.0. In main.c, you need to include first
"~\Cryptolib_V1.4\STM32CubeExpansion_Crypto_V4.1.0\Middlewares\ST\STM32_Cryptographic\include\cipher\cmox_crypto.h" file, then call the cmox_cipher_decrypt API with P_algo parmeter equal to CMOX_AESFAST_CFB_DEC_ALGO.
You can see the description of the cmox_cipher_decrypt API in the cmox_cipher.h file line 344-380 for the rest of parameters. Also, you can follow the provided examples in project directory for the CBC and mimic it for CFB.
In cmox_cfb.h no definition of CMOX_AESFAST_CFB_DEC_ALGO or CMOX_AESFAST_CFB_DEC_ALG definition. There is only CMOX_AESFAST_CFB_DEC .
/**
* @brief Implementation of CFB decryption using AES (fast implementation)
* (Defined internally)
*/
extern const cmox_cfb_impl_t CMOX_AESFAST_CFB_DEC;
best regards,
Younes
2024-04-25 02:36 AM
I know how to use it, it's just the description of the function cmox_cipher_decrypt() (@arg CMOX_AESFAST_CFB_DEC_ALGO) doesn't correspond to the value in cmox_cfb.h (CMOX_AESFAST_CFB_DEC_ALG).
CMOX_AESFAST_CFB_DEC is of type cmox_cfb_impl_t instead of cmox_cipher_algo_t.
The CMOX_AESFAST_CFB_DEC_ALG can be found at line 151 of cmox_cfb.h.
2024-04-25 08:43 AM - edited 2024-04-25 08:48 AM
Hi @nicolas
Thank you, sorry I didn't catch your first request. I created a defect ticket to correct the file description or the cryptolib implementation (Ticket 180042 Submitted, this is internal ticket not accessible for you, used for tracking purpose ).
Just to give more analysis, yes I confirm the first @arg name (CMOX_AESFAST_CFB_DEC_ALGO) was incorrect. The correct @arg name is (CMOX_AESFAST_CFB_DEC_ALG).
There will be compilation error when passing CMOX_AESFAST_CFB_DEC_ALGO as first parameter to cmox_cipher_decrypt.
As workaround, we can use either CMOX_AES_CFB_DEC_ALGO or CMOX_AESFAST_CFB_DEC_ALG according to line 151 of cmox_cfb.h file.
Best regards,
Younes