Intel® Integrated Performance Primitives
Community support and discussions relating to developing high-performance vision, signal, security, and storage applications.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
6628 Discussions

ipp 6.0 : RSA Encryption problem: ippsRSAGenerate crash

ndehoumon
Beginner
168 Views

Hi,

ippsRSAGenerate keeps crashing. What's the problem with that code:

-static const Ipp32u dataE[] = {65537};

static const int keyLen = 2048;
primeLen_ = keyLen/2;

//pseudo-random engine
int rngSize;
ippsPRNGGetSize(&rngSize);

IppsPRNGState* pRNG = (IppsPRNGState*)ippsMalloc_8u(rngSize);

int MaxSeedBitsize=512;
ippsPRNGInit(MaxSeedBitsize, pRNG);

// Give entropy to the PRNG
BigNum b(data32Len);
b.Randomize();

status=ippsPRNGSetSeed(b.GetBN(), pRNG);

...

BigNum publicExponent(sizeof(dataE)/sizeof(dataE[0]));
publicExponent.Set(1,dataE); // calls ippsSet_BN

ippsRSAGenerate(
publicExponent.GetBN(),
keyLen_,
primeLen_,
gen_t(primeLen_),
pRSADecKey_,
ippsPRNGen,
pRNG
);

with :

int gen_t(int kp)
{
int t;

t = 27;
if(kp>150) t = 18;
if(kp>200) t = 15;
if(kp>250) t = 12;
if(kp>300) t = 9;
if(kp>350) t = 8;
if(kp>400) t = 7;
if(kp>450) t = 6;
return t;
}

Any suggestions will be very helpful Thanks.

0 Kudos
1 Solution
Vladimir_Dudnik
Employee
168 Views
Hello,
our expert recommend you to try something like this:
[cpp]int gen_t(int kp)
{
int t;

t = 27;
if(kp>150) t = 18;
if(kp>200) t = 15;
if(kp>250) t = 12;
if(kp>300) t = 9;
if(kp>350) t = 8;
if(kp>400) t = 7;
if(kp>450) t = 6;
return t;
}
[/cpp]
Regards,
Vladimir

View solution in original post

3 Replies
Vladimir_Dudnik
Employee
168 Views

The code you provide does ot compile. I would recommend you to carefully check parameters you use for IPP function call (please also refer to IPP documentation to see if any limitations have to be considered)

Vladimir

ndehoumon
Beginner
168 Views
Quoting - vdudnik

The code you provide does ot compile. I would recommend you to carefully check parameters you use for IPP function call (please also refer to IPP documentation to see if any limitations have to be considered)

Vladimir

Hi ,

Thanks for your reply. The code does actually compile. But I did not want to paste all parts in this thread. So I try to replicate a kind of pseudo-code for it.
Anyway thanks, I fixed the problem.

Now my problem with ippsRSAGenerate is the t=nTrials Security parameter specified for the Miller-Rabin probable primality . When I use nTrials values derived from the Miller-Rabin pure theory , the program takes too much time to compute. It just to much calculations.

I'm using 2048-bit and 3072-bit keys. Do you have any suggestions ( tradoffs ) about nTrials values ?

Thanks.

Vladimir_Dudnik
Employee
169 Views
Hello,
our expert recommend you to try something like this:
[cpp]int gen_t(int kp)
{
int t;

t = 27;
if(kp>150) t = 18;
if(kp>200) t = 15;
if(kp>250) t = 12;
if(kp>300) t = 9;
if(kp>350) t = 8;
if(kp>400) t = 7;
if(kp>450) t = 6;
return t;
}
[/cpp]
Regards,
Vladimir

Reply