STM32F4 Discovery AES Encryption Problem
The STM32f407 as used on the disco board doesn't have the crypto hardware, the STM32f417 is the pin and code compatible part with cryptographic hardware.

This Page provides details, see bullet point #8 


  The STM32F417 also integrates a crypto/hash processor providing hardware acceleration for AES 128, 192, 256, Triple DES, and hash (MD5, SHA-1)