I managed to enable the HSM but now the board is stuck in a reset loop and after 2 resets S32 asks for jtagpassword, which i dont know.
I didnt do anything fancy, I unlocked the utest area and wrote the DCF record(using some of the code from program and erase example). The utest area is now locked again.
The issue is that i would like to get the board back up and running since i dont know what went wrong. I managed to get my hands on a spare Lauterbach and from what i can see everything is fine, the utest area is locked, DCF is written, HSE and HSB both = 1.
Update1: I stepped the board using lauterbach and it turns out it fails when it gets to BAF area, specifically at 0x004057C6
Update2: the part at which it fails is the destructive reset register.