STM32U5 HASH
Post edited by a ST moderator to be inline with the community rules especially on the code sharing. In next time please use </> button to paste your code.
Hi
I am struggling getting context save restore working correctly, when operating the HASH hardware block using polling mode.
Basicly the flow is like this:
/* --- STEP 1: Start hashing first chunk --- */
HAL_HASHEx_SHA256_Start(&hhash, input1,strlen((char*)input1), digest,HAL_MAX_DELAY);
/* --- STEP 2: Save context --- */
HAL_HASH_ContextSaving(&hhash, context);
/* --- STEP 3: Restore context --- */
HAL_HASH_ContextRestoring(&hhash, context);
/* --- STEP 4: Continue hashing --- */
HAL_HASHEx_SHA256_Accumulate(&hhash, input2, strlen((char*)input2));
/* --- STEP 5: Finalize hash --- */
status = HAL_HASHEx_SHA256_Finish(&hhash, digest, HAL_MAX_DELAY);
However when calling HAL_HASH_ContextSaving the DINIS is not equal to 1 and CSRx registers return zeros as stated in the reference manual
How do it get the HW block in a state where i can do context swap when using polling mode.
Does any working example code for this use case exist ?
Best regards
Anders
