intel / pailliercryptolib

Intel Paillier Cryptosystem Library is an open-source library which provides accelerated performance of a partial homomorphic encryption (HE), named Paillier cryptosystem, by utilizing Intel® IPP-Crypto on AVX512IFMA instructions. Intel Paillier Cryptosystem Library is certified for ISO compliance.
Apache License 2.0
73 stars 18 forks source link

Pseudo random number generator issue #53

Closed justalittlenoob closed 1 year ago

justalittlenoob commented 1 year ago

When a machine does NOT support rdseed and rdrand instruction, IPP-Crypto S/W pseudo random number generator ippsPRNGen_BN and ippsPRNGen will be used. There will be 2 issue.

  1. ippsPRNGen will cause getDJNBN or getNormalBN fall into an infinite loop, because p always equals to q.
  2. ippsPRNGen_BN will cause an error like below.(provided by @xhuan28)
    image
xhuan28 commented 1 year ago

According to Intel recommendation:

"The RDSEED instruction is intended for seeding a software PRNG of arbitrary width, whereas the RDRAND is intended for applications that merely require high-quality random numbers."

Is it more reasonable to use ippsPRNGenRDRand_BN() to generate random value if both the RDSEED and RDRAND exist.

justalittlenoob commented 1 year ago

According to Intel recommendation:

"The RDSEED instruction is intended for seeding a software PRNG of arbitrary width, whereas the RDRAND is intended for applications that merely require high-quality random numbers."

Is it more reasonable to use ippsPRNGenRDRand_BN() to generate random value if both the RDSEED and RDRAND exist.

I don't think so. The reasons are as follows:

justalittlenoob commented 1 year ago

This issue is fixed with PR #54