Community
cancel
Showing results for 
Search instead for 
Did you mean: 
ndehoumon
Beginner
100 Views

ipp 6.0 : RSA Encryption problem: ippsRSAGenerate crash

Jump to solution

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
100 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
100 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
100 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
101 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

Reply