Closed mariuszste closed 4 months ago
ST Internal Reference: 184776
Hello @mariuszste,
Thank you for your contribution. It appears that the issue is indeed related to the buffer size parameter used in your HASH_Start_IT
function call.
The function HASH_Start_IT(&hhash, buf, 2, out, HASH_ALGOSELECTION_SHA256);
is currently configured to process only the first 2 bytes of the buffer buf, as indicated by the size parameter. This means that it does not consider the remaining bytes.
To resolve this, you'll need to adjust the buffer pointer to point to the correct location where the remaining bytes start. In your case, if you have already processed 64 bytes, the API call should be adjusted as follows: HASH_Start_IT(&hhash, buf + 64, 2, out, HASH_ALGOSELECTION_SHA256);
With Regards,
To resolve this, you'll need to adjust the buffer pointer to point to the correct location where the remaining bytes start. In your case, if you have already processed 64 bytes, the API call should be adjusted as follows:
HASH_Start_IT(&hhash, buf + 64, 2, out, HASH_ALGOSELECTION_SHA256);
No, the code is written this way just to demonstrate it. That's not the issue, it will break either way. I have data coming in chunks and the chunks are read into the same buffer one at a time and then hashed before reading the next one.
This means that it does not consider the remaining bytes.
well, that's the expected behaviour on the lust chunk since it can be smaller. The issue is that this doesn't actually happen when size is <4, no bytes are processed and the interrupt is never fired.
if need be, I can provide a better example showing that this works perfectly with the blocking and DMA variants but not the interrupt one.
Hello @mariuszste,
To assist you more effectively, could you please provide us with an example of your use case?
With Regards,
Fixed in : 913697ca128abb608114f4d7b86ecb7a03a8f5be
Sorry for forgetting to make the POC :sweat_smile: Guess someone finally understood what I meant. Thanks
Describe the set-up
STM32H757I-EVAL
arm-none-eabi-gcc (Arch Repository) 14.1.0
+ CMakeDescribe the bug
HASH_Start_IT
silently fails when called withSize
< 4 while inHAL_HASH_PHASE_PROCESS
phase. The interrupt handler is never called, no error returnedHow To Reproduce
Indicate the global behavior of your application project Hashing data of arbitrary length
The modules that you suspect to be the cause of the problem (Driver, BSP, MW ...)
stm32h7xx_hal_hash.c
HASH_Start_IT
The use case that generates the problem I'm reading and hashing data in chunks, the last chunk can be any size. Let's say the chunk size is 64 bytes and I want to hash 66 bytes of data. That is 64 + 2
How we can reproduce the problem
this should give a general idea of what I'm trying to do.
Additional context
polling_step
will never be1
ifSize
is < 4 so the entireif (polling_step == 1U) {}
block is skipped and sincehhash->Phase
is notHAL_HASH_PHASE_READY
there is basically no code left in the function. Something here is seriously wrong.I assume this is a supported use case based on the comments from
HAL_HASHEx_SHA256_Accmlt_IT
andHAL_HASHEx_SHA256_Accmlt_End_IT
since they are just aliases forHASH_Accumulate_IT
andHASH_Start_IT
respectively.As far as I can tell this works just fine with the blocking variants, as well as DMA, only the interrupt variant is broken.
Screenshots N/A