This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LAUNCHCC3235MOD: Assignment question to CryptoCC32XX_EncryptParams

Part Number: LAUNCHCC3235MOD

I've tried various ways of assigning the fields of a CryptoCC32XX_AesParams to a CryptoCC32XX_EncryptParams.aes and failing. How to do so?

From CryptoCC32XX.h:

typedef struct
{
    const uint8_t *pKey;             /*!< pointer to AES key */
    CryptoCC32XX_AesKeySize keySize; /*!< AES Key size type */
    void *pIV;                       /*!< Pointer to AES Initialization Vector */
    CryptoCC32XX_AesAadParams aadParams;
} CryptoCC32XX_AesParams;

/*!
 *  @brief  DES Parameters
 *
 *  This structure defines the DES parameters used in CryptoCC32XX_encrypt and CryptoCC32XX_decrypt functions.
 */
typedef struct
{
    const uint8_t *pKey;             /*!< pointer to DES key */
    CryptoCC32XX_DesKeySize keySize; /*!< DES Key size type */
    void *pIV;                       /*!< Pointer to DES Initialization Vector */
} CryptoCC32XX_DesParams;

typedef union
{
    CryptoCC32XX_AesParams aes;
    CryptoCC32XX_DesParams des;
} CryptoCC32XX_EncryptParams;
//
// my mess
// Also not sure keys order below
CryptoCC32XX_AesParams g_aes={(const uint8_t*) AES192Key1, CryptoCC32XX_AES_KEY_SIZE_192BIT, (void*)&(g_aubIV[0])};
// but below always fails with 

// CryptoCC32XX_EncryptParams g_params.aes= g_aes; //fails too
CryptoCC32XX_EncryptParams g_params;
g_params.aes.pKey = g_aes.pKey; // fails with unknown typename

  • Well such compiles:

    CryptoCC32XX_AesParams g_aes={(const uint8_t*) AES192Key1, CryptoCC32XX_AES_KEY_SIZE_192BIT, (void*)&(g_aubIV[0])};
    CryptoCC32XX_EncryptParams g_params={(const uint8_t*) AES192Key1, CryptoCC32XX_AES_KEY_SIZE_192BIT, (void*)&(g_aubIV[0])};