-
Notifications
You must be signed in to change notification settings - Fork 3k
STM32L486RG/mbedtls: add aes hw acceleration #3962
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@sbutcher-arm Please review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adustm I reviewed your changes, two major comments:
- mbedtls_device.h should have only the mbed TLS configuration defintions, specifically, the target specific mbed TLS definitions.
- The alternative implementation should support all the API supported by the SW one. For example, if AES192 is not supported by your HW, you should use the SW implementation for AES192
//the following defines are provided to maintain compatibility between STM32 families | ||
#define __HAL_RCC_CRYP_CLK_ENABLE __HAL_RCC_AES_CLK_ENABLE | ||
#define __HAL_RCC_CRYP_FORCE_RESET __HAL_RCC_AES_FORCE_RESET | ||
#define __HAL_RCC_CRYP_RELEASE_RESET __HAL_RCC_AES_RELEASE_RESET |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't these implementation specific definitions?
Shouldn't these be in some STM common header file, or in the aes_alt.c file?
mbedtls_device.h should be included only from mbedtls files(specifically platform_mbed.h), so I think these definitions will not be used anywhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, I'll move them
#define __HAL_RCC_CRYP_CLK_ENABLE __HAL_RCC_AES_CLK_ENABLE | ||
#define __HAL_RCC_CRYP_FORCE_RESET __HAL_RCC_AES_FORCE_RESET | ||
#define __HAL_RCC_CRYP_RELEASE_RESET __HAL_RCC_AES_RELEASE_RESET | ||
#define CRYP AES |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is this definition called form?
memcpy(ctx->aes_key, key, 24); | ||
break; | ||
#if defined (TARGET_STM32L486xG) | ||
return(MBEDTLS_ERR_AES_INVALID_KEY_LENGTH); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The alternative implementation should support the full API. If HW doesn't support, then the SW implementation should be used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like to increase the SW size for this feature, but I understand the need.
I'll have to rework the pull request to use SW in case of 192bits key size. @0xc0170 I guess you can add 'do not merge' label at the moment.
@adustm Please review the comments above |
@adustm Should this be moved against the workshop branch? |
Description
Add hw acceleration for mbedTLS/aes on NUCLEO_L486RG
Please be aware that this device does not support 192bit key size.
The aes selftest and gcm selftest shall be modified not to run this key size. As it is located in the official mbedtls stack, I did not touch it.
Status
READY
Steps to test or reproduce
Run aes seltest from TESTS/mbedtls/selftest/main.cpp