I am attempting to implement the Digital Signature Algorithm verification process using the PKEU's math functions. I can get every step of the verification to compute properly except what one would think is the easiest part: x mod q, where x is a 512-bit result of numerous calculations beforehand, and q is a 160-bit value.
I tried converting x and the number 1 into Montgomery form, and using MOD_MULT2_DECONV. This doesn't work. I've also tried padding q with leading zeroes so it is 512 bits long and that doesn't help.
Does anybody have a suggestions as to how to perform this simple calculation using the PKEU?
Thank you for any help.