Topic: How to pass User defined 'Random Number' for signature generation

Hi Guys,

In my use case, I need to pass a particular number as the Random-number to the signature generation function, which is wc_SignatureGenerate( )
Function parameters are : -
hash_type: WC_HASH_TYPE_SHA256
signature_type: WC_SIGNATURE_TYPE_ECC
Signature length used: 60 bytes

For example Random Number = 0x1111111111111111111111111111111111111111111111111111111111111111.

Can someone please guide me in achieving this! That would be helpful.

Thanks in advance,
Thippeswamy D R


Re: How to pass User defined 'Random Number' for signature generation

I do not recommend doing that at all. ECC signatures use a random value and they are different every time you sign some data. It verifies after the fact. I'm assuming you are trying to do a known answer test for the ECC sign function. NIST recommends doing a sign-and-verify test.

If you really want to replace the random number generator that always returns 1, you can set the macro CUSTOM_RAND_GENERATE_BLOCK to a function that you provide that memset's the buffer with 0xFF. You can do that, but I don't recommend that at all. You don't want the code to get out and have the random number generator returning the same value constantly.