cancel
Showing results for 
Search instead for 
Did you mean: 

Crypto peripheral on STM32H745

srinath mallikarjunan
Associate II

Hi

I want to use the Cryptographic peripheral on the above nucleo board, in the following way.

Serial message from embedded board-->H745 crypto engine-->wireless transmission-->Decrypt packet on remote x86 laptop

And the reverse direction too

So clearly i will need a way to duplicate the AES/DES flavor implemented on the H745 on an X86.

Is there a reference C code that would give the same output on x86 (assuming the symmetric keys are exchanged during a binding process)

5 REPLIES 5

The HW performs to established standards, use certified test patterns to prove. The interwebs are full of source, and it generally has less restrictions on availability.

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

STM32H745 does not contain a crypto peripheral. For that you need a STM32H755.

Use the ST's software library.

Update:

Even on STM32H7 variants that do not have functional CRYP accelerator, the HAL API HAL_CRYP_Init can succeed, creating false sense that it "works".

For example the following snippet runs on STM32H743 without error or exception. But the CRYP actually works only on H75x.

#include <stm32h7xx_hal_cryp.h>
 
CRYP_HandleTypeDef hcryp;
 
void CRYP_Init()
{
  __HAL_RCC_CRYP_CLK_ENABLE();
  hcryp.Instance = CRYP;
 ............
  hcryp.Init.Algorithm = CRYP_AES_CBC;
  if (HAL_CRYP_Init(&hcryp) == HAL_OK) {
      if ((hcryp.Instance->CR & CRYP_CR_ALGOMODE) != hcryp.Init.Algorithm) {
         //ERROR - CRYP will not work!
     }
  } else {
    // ERROR
  }
}

-- pa

zbigelpl
Associate II

The reference manual says the following

The cryptographic processor (CRYP) can be used both to encrypt and decrypt data using the DES, Triple-DES or AES algorithms. It is a fully compliant implementation of the following standards:

The data encryption standard (DES) and Triple-DES (TDES) as defined by Federal Information Processing Standards Publication (FIPS PUB 46-3, Oct 1999), and the American National Standards Institute (ANSI X9.52)

• The advanced encryption standard (AES) as defined by Federal Information Processing Standards Publication (FIPS PUB 197, Nov 2001)

My problem is in finding standard implementations of the above along with test cases.

For example a search yields something like this implementation...

https://github.com/tarequeh/DES

But how do i know if it is right and for all cases ? Is there a standard reference implementation code ?

Please see page 1431 of the Reference manual

https://www.st.com/resource/en/reference_manual/dm00176879-stm32h745-755-and-stm32h747-757-advanced-arm-based-32-bit-mcus-stmicroelectronics.pdf

It seems to state pretty clearly that 745 supports a Crypto peripheral.