Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6712 Discussions

Unusual Behavior when using ippsGFpCmpElement

Crypto_P
Beginner
915 Views

Hi All,

 

When trying to implement the code below,  ippsGFpCmpElement returns a result of 2. Indicating that the small_number is larger then the large number. This is unexpected since the large number, small number and modulus are:

large_number: 319014718988379809496913694531707207695
small_number: 319014718988379809496913694467282698255

modulus: 115792089210356248762697446949407573530086143415290314195533631308867097853951

BigNum large_number("0xF0000000000000000000000F0000000F");
		BigNum small_number ("0xF000000000000000000000000000000F");
		BigNum mod_256_correct  ("0xFFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF");

		IppsBigNumSGN Sign, Sign_small;
		int BitLen, BitLen_small;
		Ipp32u* pData, *pData_small;
		ippsRef_BN(&Sign, &BitLen, &pData, large_number);
		ippsRef_BN(&Sign_small, &BitLen_small, &pData_small, small_number);


		//Init large gfelement
		int size = 0;
		int err_state = 0;
		ippsGFpGetSize(256, &size);	
		
		IppsGFpState* _p_galois_field = (IppsGFpState*)(new Ipp8u[size]);;	

		ippsGFpInit( mod_256_correct, mod_256_correct.BitSize(), ippsGFpMethod_p256r1(),_p_galois_field );

		size = 0;
		ippsGFpElementGetSize(_p_galois_field, &size);

		IppsGFpElement*	_p_large_num = (IppsGFpElement*) (new Ipp8u[size]);;
		IppsGFpElement*	_p_small_num = (IppsGFpElement*) (new Ipp8u[size]);;	
		
		
		ippsGFpElementInit(pData, BITSIZE_WORD(BitLen),_p_large_num,_p_galois_field);
		ippsGFpElementInit(pData_small, BITSIZE_WORD(BitLen_small),_p_small_num,_p_galois_field); 
 
		int result = 0;
		auto error_code = ippsGFpCmpElement(_p_large_num, _p_small_num, &result, _p_galois_field);

		delete[](Ipp8u*)_p_small_num;
		delete[](Ipp8u*)_p_large_num;
		delete[](Ipp8u*)_p_galois_field;

 Am I wrong to expect a value of 1 for result?

Also, my implementation of the Bignum  class is from the Developers Reference.

Ippcp version info: ippCP AVX2 (l9) 2020.0.3

Windows 64 bit machine.

I appreciate the help!

0 Kudos
4 Replies
NoorjahanSk_Intel
Moderator
828 Views

Hi,

Thanks for reaching out to us.

We are also able to reproduce the issue with 2021.04 version from our end.

We are looking into it. We will get back to you soon.

 

Thanks & Regards

Noorjahan

 

Gennady_F_Intel
Moderator
812 Views

using the latest 2021.4 version, I see the output results == 0. which is the wrong results.

>test.exe

ippCP AVX2 (l9) 2021.1 (10.0) (r0xf3e1808) 2021.1.0.255727624

...ippsGFpCmpElement returns 0 code


We will escalate the case versus the Crypto developer team and will get back to this shortly.


NoorjahanSk_Intel
Moderator
586 Views

Hi,

Thank you for your patience.

The issue raised by you has been fixed in the latest oneAPI 2022.1 version(ippcp 2021.5).

Please download and let us know if this resolves your issue.

 

Thanks & Regards,

Noorjahan.

0 Kudos
Gennady_F_Intel
Moderator
555 Views

Hello,


Here is the output results when linked this case against IPP 2021 u5:


ippCP AVX2 (l9) 2021.5.0 (11.3 ) (r0xaf5af430) 2021.5.0

...ippsGFpCmpElement returns 0 code 

...ippsGFpCmpElement Result 1  --> #define IPP_IS_GT (1) // the first element is greater than the second one


The issue is closing.

This issue has been resolved and we will no longer respond to this thread. If you require additional assistance from Intel, please start a new thread. Any further interaction in this thread will be considered community only. 


Thanks,

Gennady




0 Kudos
Reply