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.

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.

I have a similar problem.

I am trying to perform a mod_inv execution with pkeu´s math funtions.

I convert a k bignum to montgomery format and pass p a mont(k), to security engine and the result doesn't work.

The descryptor has the next fields.

sd_header -> 0x50f00081

ptr[0].len= 66

ptr[0].ptr= P -> prime of nist 521 bits curve

ptr[2].len= 3

ptr[2].ptr= [80 00 00] it is the montgomery representation of u= 1

ptr[4].len= 66

ptr[4].ptr= address of result