cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L476G-EVAL CRYP Examples Problem

TZeig.1
Associate II

The code from the 1.16 example builds fine in the EWARM. It writes the source blocks to the terminal, but as I see in the debugger, it fails to encrypt the input block. That times out as it fails to return a HAL_OK status.

 /* Start decrypting aCyphertext, the decrypted data is available in aDecryptedtext */

  if (HAL_CRYPEx_AES(&CrypHandle, aCyphertext, AES_TEXT_SIZE, aDecryptedtext, TIMEOUT_VALUE) == HAL_OK)

  {

   /* Display decrypted Data */

   Display_DecryptedData(CBC, 128, AES_TEXT_SIZE);

  }

  else  

  {

   /* Processing Error */

   Error_Handler();

  }

I have read all the how-to info in the examples.

Has anyone else run into this issue and found a solution?

1 ACCEPTED SOLUTION

Accepted Solutions

@par Hardware and Software environment

  - This example runs on STM32L486xx devices.

  - This example has been tested with a STM32L486ZG embedded on an

  STM32L476G-EVAL board and can be easily tailored to any other supported

  device and development board.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

5 REPLIES 5

@par Hardware and Software environment

  - This example runs on STM32L486xx devices.

  - This example has been tested with a STM32L486ZG embedded on an

  STM32L476G-EVAL board and can be easily tailored to any other supported

  device and development board.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
TZeig.1
Associate II

I have the STM32L476xx on my  STM32L476G-EVAL board. That does not have the crypto processor, is that correct?

It doesn't have the cryp/hash unit enabled, it is probably the same die with either it fused off at the die test stage, or with a different mask in the set lacking metalization, etc related to the unit. ST doesn't disclose the exact methodology, but the parts coming in a without/with pairing ie L476/L486 or F767/F777

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
TZeig.1
Associate II

okay thank you!

It looks like twin models with and without crypto can be distinguished by checking that config register of a crypto thingy holds written value.

For example, below is a code we use to distinguish STM32H753 from 743.

Maybe the same will work for L486 vs 476.

-- pa

#ifndef STM32H753xx
#define STM32H753xx /* override! */
#undef STM32H743xx
#endif
 
#include "stm32h7xx_hal.h"
#include <stdint.h>
#include <stdbool.h>
 
// Return true if the MCU has crypto 
// so this is H7 variant with crypto (ex. H753 vs H743)
bool H7_hw_crypto_test()
{
    // Test if HASH->CR is writable
    __HAL_RCC_HASH_CLK_ENABLE();
    HAL_Delay(5);
    HASH->CR = 0;
    __DSB();
    HASH->CR = 0x20; // set HASH_CR_DATATYPE=HASH_DATATYPE_8B
    __DSB();
    uint32_t u = HASH->CR;
    bool y = ((u & 0x30) == 0x20);
    __HAL_RCC_HASH_CLK_DISABLE();
    return y;
}