-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
I'm trying to implement example 03_ECDH
As middleware we use wolfcrypt.
I get error 0x0205 after stse_ecc_establish_shared_secret(). I digged it down to this location:
https://github.com/STMicroelectronics/STSELib/blob/main/services/stsafea/stsafea_sessions.c#L163
/* - Perform first AES ECB round on IV */
ret = stse_platform_aes_ecb_enc(initial_value,
STSAFEA_HOST_AES_BLOCK_SIZE,
pSession->context.host.pHost_cypher_key,
(pSession->context.host.key_type == STSE_AES_128_KT) ? STSE_AES_128_KEY_SIZE : STSE_AES_256_KEY_SIZE,
initial_value,
NULL);
Last parameter pEncryptedtext_length is NULL which can't work, so I assume this is a STSELib issue and not a platfrom implementation issue.
For example when cmox is used as middleware, this code would crash (link):
stse_ReturnCode_t stse_platform_aes_ecb_enc(const PLAT_UI8 *pPlaintext,
PLAT_UI16 plaintext_length,
const PLAT_UI8 *pKey,
PLAT_UI16 key_length,
PLAT_UI8 *pEncryptedtext,
PLAT_UI16 *pEncryptedtext_length) {
cmox_cipher_retval_t retval;
PLAT_UI8 IV[16] = {0};
size_t cmox_encryptedtext_len = *pEncryptedtext_length;
For the wolfcrypt middleware there is a sanity check which will return and finally trigger error code 0x0205.
To me this looks like a bug. I'm not sure where to store the length. Maybe just &pCmdFrame->length?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels