Question

I am trying to debug a SHA512 implementation in Verilog, but I can't find an example message schedule anywhere. I have made a simple C++ program made with Crypto++ but I can't find which variable to debug to see the complete message schedule, since it's written in assembler.

I need either an example schedule or help to identify the crypto++ schedule

Was it helpful?

Solution

Include crypto++ in your project code, then open sha.h file and add your breakpoints, compile your code with debug, then when your code pause at a breakpoint you'll see whole SHA512 code and you'll be able to debug and see all variables including message schedule. If you add breakpoint in SHA512 function and compile your code with debug, you won't see assembly code, instead, you'll see C++ source code of it and you'll be able to add variables to watch window and check their values.

Also you can press F11 while debugging (step-into) to get into hash function, again it won't be assembly, you'll see C++ code of hash function. Then follow code and see SHA message schedule.

As you know in SHA for each round, there is one round constant k[i] and one entry in the message schedule array w[i], 0 ≤ i ≤ 63. Therefore open sha.cpp and you'll see w variable, that's what you need to debug. Also I have to tell you, SHA code and a lot of parts of Crypto++ is written in assembly, so it doesn't matter you are debugging or reading a code, it's written in assembly. So you can uncomment

"// smaller but slower"

part in sha.cpp and use C++ code instead of assembly code or simply use another library for SHA which you'll be able to debug easily.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top