Skip to content
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

CRYP api upgrade #36

Open
fermentedfly opened this issue May 10, 2023 · 5 comments
Open

CRYP api upgrade #36

fermentedfly opened this issue May 10, 2023 · 5 comments
Assignees
Labels
cryp CRYP-related issue or pull-request. enhancement New feature or request hal HAL-LL driver-related issue or pull-request. internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system

Comments

@fermentedfly
Copy link

As far as I can tell the current HAL_CRYP_Encrypt (decrypt as well) provides an all-in-one solution for encryption.
This is fine but my use case requires an API that can be initialized and then fed with multiple blocks of data, i.e. something like
Init -> Encrypt Block 1 -> Encrypt Block 2 -> ... -> Finalize

Some other HAL implementations, e.g. STM32L4, provide functionality to do this.
I've had a look in stm32h7xx_hal_cryp.c and it seems all the required functions are already present but have internal linkage.
Please consider making those functions public.

Regards,
Manuel

@TOUNSTM
Copy link
Contributor

TOUNSTM commented Jun 2, 2023

Hello @fermentedfly,

Thank you for this report. We will get back to you as soon as we analyze it further. This may take some time. Thank you for your comprehension.

With regards,

@HBOSTM HBOSTM added the question Further information is requested label Aug 4, 2023
@HBOSTM
Copy link
Contributor

HBOSTM commented Aug 4, 2023

Hello @fermentedfly,

Thank you for this contribution.
Could you please give me more details about this issue, I need to know what internally linked functions you are talking about?

Best Regards,

@HBOSTM HBOSTM added the needs clarification Needs clarification or inputs from user. label Aug 4, 2023
@fermentedfly
Copy link
Author

Hello @HBOSTM ,

I had a deeper look in stm32h7xx_hal_cryp.c and my initial estimate was a bit optimistic.
I use AES CBC & GCM.
For CBC, making static void CRYP_AES_ProcessData(CRYP_HandleTypeDef *hcryp, uint32_t Timeout) public is enough although a separate Init() would be very convenient.

For GCM, static HAL_StatusTypeDef CRYP_AESGCM_Process(CRYP_HandleTypeDef *hcryp, uint32_t Timeout) needs refactoring, i.e. the function needs to be split in it's three phases (header, data, finalize) in order to feed data multiple times.

For reference, please have a look in stm32l4xx_hal_cryp.c & stm32l4xx_hal_cryp_ex.c.
It got my use case (both CBC & GCM) to work while using

  • HAL_StatusTypeDef HAL_CRYP_Init(CRYP_HandleTypeDef *hcryp)
  • HAL_StatusTypeDef HAL_CRYPEx_AES(CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint16_t Size, uint8_t *pOutputData, uint32_t Timeout)
  • HAL_StatusTypeDef HAL_CRYPEx_AES_Auth(CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint64_t Size, uint8_t *pOutputData, uint32_t Timeout) (GCM only)

It would be superb if you can provide a similar API for STM32H7.

Regards,
Manuel

@ALABSTM ALABSTM assigned RJMSTM and unassigned HBOSTM Jan 23, 2024
@ALABSTM ALABSTM added hal HAL-LL driver-related issue or pull-request. enhancement New feature or request and removed question Further information is requested needs clarification Needs clarification or inputs from user. labels Jan 23, 2024
@ALABSTM ALABSTM added the cryp CRYP-related issue or pull-request. label Sep 13, 2024
@ALABSTM ALABSTM assigned ALABSTM and unassigned RJMSTM Sep 13, 2024
@ALABSTM
Copy link
Collaborator

ALABSTM commented Sep 13, 2024

ST Internal Reference: 191062

@ALABSTM
Copy link
Collaborator

ALABSTM commented Sep 13, 2024

Hi @fermentedfly,

Your proposal has been forwarded to our development teams. I will get back to you once I have their feedback.

With regards,

@ALABSTM ALABSTM added the internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system label Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cryp CRYP-related issue or pull-request. enhancement New feature or request hal HAL-LL driver-related issue or pull-request. internal bug tracker Issue confirmed and reported into a ticket in the internal bug tracking system
Projects
Status: In progress
Development

No branches or pull requests

5 participants