Skip to content

stse_ecc_establish_shared_secret 0x0205 (STSE_CORE_SESSION_ERROR) #59

@simeonfelis

Description

@simeonfelis

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions