intel / pailliercryptolib

Intel Paillier Cryptosystem Library is an open-source library which provides accelerated performance of a partial homomorphic encryption (HE), named Paillier cryptosystem, by utilizing Intel® IPP-Crypto on AVX512IFMA instructions. Intel Paillier Cryptosystem Library is certified for ISO compliance.
Apache License 2.0
73 stars 18 forks source link

Segmentation fault when encrypting plaintexts with multi-thread and QAT enabled #65

Closed xhuan28 closed 1 year ago

xhuan28 commented 1 year ago

Reproduce case: There is a vector of big numbers with size of 2048x101, that is, total 206848 big numbers. Those values are split into 4 groups, 51712 big numbers in each group. Big numbers in each group are encrypted in a separate thread with QAT enabled. The QAT batch size is 1024, so there are total 50 batches and 512 numbers as a residue. Expected result: Encryption is completed without error. Actual result: Segmentation fault.

justalittlenoob commented 1 year ago

Hi @xhuan28
Please UPDATE and try this branch: zpf/add-heQatBnModExp_MT in PR #61
There is an unit test CryptoTest_APPLEVEL_OMP, which is used to test app level multi-thread use case.
https://github.com/intel/pailliercryptolib/blob/18ee694c177a4f52ca0bf30cf46853b4d2255ca0/test/test_cryptography.cpp#L18

xhuan28 commented 1 year ago

Yes, it really fixes my issue. Will you refine this PR to support the case with QAT_LITE enabled just as what heQatBnModExp() do?

justalittlenoob commented 1 year ago

Yes, it really fixes my issue. Will you refine this PR to support the case with QAT_LITE enabled just as what heQatBnModExp() do?