Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/45987 )
Change subject: amd/picasso/verstage: replace rsa accel with modexp ......................................................................
Patch Set 5:
Patch Set 5: Code-Review+2
Looks like the byte swizzling is necessary because the PSP reads the data buffer as an array of dwords (32-bit values). Given the documentation I have (none), I guess this is the reason why one needs to swap the byte order. If so, the pointer types of the MOD_EXP_PARAMS_T struct (as well as any other affected structs) should be changed accordingly.
Note that this is just about completely reversing the whole 4096 byte string, there's nothing specific to dwords here. If you look at the loop, it takes the first dword form the front, swaps it, and puts it at the back of the output string. You would get the same result by operating on 8 bytes at a time, or single bytes.
The vboot software implementation is doing the same thing internally, btw, it's not unusual (because OpenSSL formats mandate these values to be big-endian but most machines operate on little-endian internally).
Oh, I see now. Then the same loop could be written using 8-bit accesses. Or am I missing something again?