intel/cryptography-primitives

ippsGFpECSignDSA/ippsGFpECVerifyDSA fail when using ippCPUID_AVX512IFMA

Closed this issue · 8 comments

I've tested ippcp_2021.12.1, built from source against openssl-3.0.12, on Ubuntu 22.04, on a Intel(R) Xeon(R) Gold 6312U.

I've attached a patch which can be applied on the ippcp_2021.12.1, which adds an example highlighting the issue. When building with examples you'll have a new executable that will print "Passed" or "Failed" depending on whether the verification result was valid or not.

The sample uses a PRNG with default values, initializes a GF, EC, Private Key, Public Key, Ephemeral Private Key, the message and message digest and finally, signs and verifies. At the top of the main function you can find a commented out line tweaking the CPU features.

The signature verification result is invalid when AVX512IFMA is enabled, but valid when I disable AVX512IFMA via the ippcpSetCpuFeatures.

There has been a previous report of a suspected bug here:

🔗 https://community.intel.com/t5/Intel-Integrated-Performance/Suspected-Bug-ippsGFpECSignDSA-generates-small-signatures-when/m-p/1511674.

Can you please investigate and share your findings here? It would be nice to know which other parts of IPPCP may be affected by AVX512, if you find out the issue isn't exclusive to ECC DSA.

Thank you.

ecc_avx512ifma_example.txt

Hello, can you check latest crypto library?
/opt/intel/oneapi/ippcp/2025.0/lib/libippcp.so.12

I run these test code, by disabling/enabling the following code, the test can pass the test?
cpu_features &= ~(ippCPUID_AVX512IFMA);

thanks,
Chao

Hi @rui-alm, could you please tell if the issue is still relevant for you?

Hi @paveldyakov! Yes, the issue is still relevant. I haven't tested oneAPI yet, as suggested by @chaoyu3.

I believed to be testing the latest IPPCP version ippcp_2021.12.1, but I have noticed soon after I posted this issue, a new version of IPPCP was released, which I believe is now called v1.0.0. Is this the version used by oneAPI?

I work with Intel SGX as well and the latest version 2.25 is using IPPCP 2021.12.1 and I can reproduce the issue on SGX as well, so eventually the fix would need to be integrated there.

I tried to compile v1.0.0 locally but it's failing with many errors similar to this:

_build/asm_sources/l9/asm_intel64/l9_pcpsm3l9_ni_as.asm:199: info: label `vsm3rnds2' originally defined here
_build/asm_sources/l9/asm_intel64/l9_pcpsm3l9_ni_as.asm:199: error: parser: instruction expected
_build/asm_sources/l9/asm_intel64/l9_pcpsm3l9_ni_as.asm:83: ... from macro `SM3ROUNDS4' defined here
make[2]: *** [sources/ippcp/CMakeFiles/ippcp_s_l9-asmobjs.dir/build.make:490: sources/ippcp/CMakeFiles/ippcp_s_l9-asmobjs.dir/__/__/asm_sources/l9/asm_intel64/l9_pcpsm3l9_ni_as.asm.o] Error 1

Any idea what's wrong with my configuration?

Thank you for your help.

@rui-alm,
Please find the answers:

which I believe is now called v1.0.0. Is this the version used by oneAPI?

Yes, you are right. v1.0.0 is included into oneAPI 2025.0 base toolkit

Any idea what's wrong with my configuration?

In the 1.0.0 release we have enabled new instructions support. Please update the version of NASM that you use.
Based on https://github.com/intel/cryptography-primitives/blob/develop/BUILD.md#common-tools the minimum required version of NASM is 2.16.02

Would be glad to help you more

Thank you @paveldyakov. I've used NASM 2.16.03 and managed to compile IPPCP v1.0.0 with the ECDSA sign/verify example I provided above.

I haven't been able to reproduce the issue. I haven't done extensive testing, as most of our tests are currently targetting IPPCP's version used by SGX, but it suggests the issue has been fixed.

Are you aware of plans to update SGX's version of IPPCP?

Thank you very much for your help.

@rui-alm,

Are you aware of plans to update SGX's version of IPPCP?

I am not aware about near-term plans to update IPPCP version in SGX. Probably it will happened sometimes next year

Hi @rui-alm,
please let me know if I can help more or if we can close the issue

Hi @paveldyakov,

We can close the issue. I'll open a new ticket if I find anything else, but for now it looks good.

I'll keep in touch with the SGX team regarding upcoming updates.

Thank you very much @paveldyakov and @chaoyu3 for your help.

Kind regards!