AnsweredAssumed Answered

CRYP unit not working on ST32F407

Question asked by bauer.johannes on Aug 29, 2012
Latest reply on Aug 23, 2013 by Clive One
Hi forum,

I'm having trouble getting the CRYP unit working on a ST32F407. First I've tried manually (failed) and -- thinking that I did something wrong -- tried with the ST provided libraries (which also don't work). I'm doing something wrong, I'm very sure, but I can't figure out what. First off: Yes, I have the device properly enabled:

RCC_AHB2PeriphClockCmd(RCC_AHB2Periph_CRYP, ENABLE);

then, I use this:

        CRYP_InitTypeDef x;
        memset(&x, 0, sizeof(x));
        x.CRYP_AlgoDir = CRYP_AlgoDir_Encrypt;
        x.CRYP_AlgoMode = CRYP_AlgoMode_AES_ECB;
        x.CRYP_DataType = CRYP_DataType_32b;
        x.CRYP_KeySize = CRYP_KeySize_128b;
        CRYP_KeyInitTypeDef x;
        memset(&x, 0, sizeof(x));



    /* Write input data */
    for (int i = 0; i < 4; i++) {

    /* Wait until finished */
    while (!CRYP_GetFlagStatus(CRYP_FLAG_OFNE));

(this never finishes, i.e. it's not yielding any data). Then I tried the "high level" function, which should do everything for me

printf("Result: %d\r\n", CRYP_AES_ECB(MODE_ENCRYPT, (unsigned char*)aKey, 128, (unsigned char*)aSource, 16, aDestination));

...which fails with error 1.

Any ideas?
Best regards,