Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
54 Views

ippsECCPGenKeyPair() fault (IPP 5.3)

It looks like ippsECCPGenKeyPair() function from IPP 5.3 enters some kind of infinite loop very very often andnever returns. It consumes 100% of CPU at that time.

Exactly the same code is working with IPP 5.1 without a scratch.

I'm using dynamic IPP linking.

0 Kudos
4 Replies
Highlighted
54 Views

Hello,

thank for reporting, could you please provide some sample code to reproduce that issue?

Regards,
Vladimir

0 Kudos
Highlighted
Beginner
54 Views

Here it is.
It's has no actual meaning but result is the same - a deadlock or an infinite loop inside ippsECCPGenKeyPair() under IPP 5.3.
IPP 5.1 works well.
//***************************************************************************************
// class TDiamondBigNumber - Big Number wrapper
//***************************************************************************************
class TDiamondBigNumber
{
public:
Ipp8u *pBN;
 int data_size;
int data_bit_size;
bool initialized;
 __fastcall TDiamondBigNumber();
__fastcall TDiamondBigNumber(Ipp8u *pData, int length){ Init(pData, length); }
 __fastcall ~TDiamondBigNumber(){ delete[] pBN; }
 void __fastcall Init(Ipp8u *, int);
 __fastcall operator const IppsBigNumState *(){ return (const IppsBigNumState *)pBN; }
__fastcall operator IppsBigNumState *(){ return (IppsBigNumState *)pBN; }
};

__fastcall TDiamondBigNumber::TDiamondBigNumber()
{
data_size = data_bit_size = 0;
pBN = 0;
initialized = false;
}
void __fastcall TDiamondBigNumber::Init(Ipp8u *pData, int length)
{
data_size = length;
data_bit_size = data_size*8;
int size = (data_size+3)/4;
int ctxSize; ippsBigNumGetSize(size, &ctxSize);
pBN = new Ipp8u [ctxSize];
ippsBigNumInit(size, (IppsBigNumState *)pBN);
 if( pData ) ippsSetOctString_BN(pData, data_size, (IppsBigNumState *)pBN);
initialized = true;
}
//***************************************************************************************
void func()
{
IppStatus status;
Ipp8u *pCtx=0;
int Size;
IppsPRNGState *pRND=0;
BYTE *pEphemeralPublicKey=0;
 ippsPRNGGetSize(&Size);
pRND = (IppsPRNGState *)new BYTE[Size];
ippsPRNGInit(Size, pRND);
 ippsECCPGetSize(224, &Size);
pCtx = new BYTE[Size];
ippsECCPInit(224, (IppsECCPState *)pCtx);
 status = ippsECCPSetStd(IppECCPStd224r1, (IppsECCPState *)pCtx);
 ippsECCPPointGetSize(224, &Size);
pEphemeralPublicKey = new Ipp8u[Size];
ippsECCPPointInit(224, (IppsECCPPointState *)pEphemeralPublicKey);
 TDiamondBigNumber privKey((Ipp8u *)0, 28);
  status = ippsECCPGenKeyPair(privKey, (IppsECCPPointState *)pEphemeralPublicKey, (IppsECCPState *)pCtx, ippsPRNGen, pRND);
 delete[] pCtx;
delete[] (BYTE *)pRND;
delete[] pEphemeralPublicKey;
}
0 Kudos
Highlighted
54 Views

Hello,

please findcomment from our expert in the code:

//***************************************************************************************

void func()
{
IppStatus status;
Ipp8u *pCtx=0;
int Size;
IppsPRNGState *pRND=0;
BYTE *pEphemeralPublicKey=0;

ippsPRNGGetSize(&Size);
pRND = (IppsPRNGState *)new BYTE[Size];
[gres]status = ippsPRNGInit(Size, pRND);[gres] // 0 < Size <= 512, 0 == Size % 8

[gres] // please test status value.. it might save your time

if(ippStsNoErr != status) {

cout << ippGetStatusString(status) << endl;

return;

}

ippsECCPGetSize(224, &Size);
pCtx = new BYTE[Size];
ippsECCPInit(224, (IppsECCPState *)pCtx);

status = ippsECCPSetStd(IppECCPStd224r1, (IppsECCPState *)pCtx);

ippsECCPPointGetSize(224, &Size);
pEphemeralPublicKey = new Ipp8u[Size];
ippsECCPPointInit(224, (IppsECCPPointState *)pEphemeralPublicKey);

TDiamondBigNumber privKey((Ipp8u *)0, 28);

status = ippsECCPGenKeyPair(privKey, (IppsECCPPointState *)pEphemeralPublicKey, (IppsECCPState *)pCtx, ippsPRNGen, pRND);

delete[] pCtx;
delete[] (BYTE *)pRND;
delete[] pEphemeralPublicKey;

}

Regards,
Vladimir

0 Kudos
Highlighted
Beginner
54 Views

Hi,

Thanx.

Size of random generator contextis indeed should be multiple 8 in IPP 5.3. Now, with checking that requirement, my code is working properly.

But still, this whole situation should be fixed by IPP team.

I don't take the Size from anywhere - I'm asking for its valuecalling ippsPRNGGetSize() (in both cases - IPP 5.1 and 5.3 -it returns the same value =179). So, eitherippsPRNGGetSize() should return multiplied value or ippsPRNGInit() should accept 179 as it was in 5.1.

Don't you agree? :)

0 Kudos