snucrypto / HEAAN

Other
359 stars 94 forks source link

Test Bootstrapping crashes Segmentation Fault #41

Closed tjungND closed 4 years ago

tjungND commented 4 years ago

After compiling the library, TestHEAAN works fine for other tests, but for "./TestHEANN Bootstrapping", it crashes with Segmentation fault.

image

Any suggestions would be highly appreciated.

KyoohyungHan commented 4 years ago

@tjungND This is related to segmentation fault issue of the pull request (https://github.com/snucrypto/HEAAN/pull/36#issuecomment-585278950)

If you checkout to commit "cda993ce97fce9828e814cd966946ccdab756d87", this test works well..

tjungND commented 4 years ago

@tjungND This is related to segmentation fault issue of the pull request (#36 (comment))

If you checkout to commit "cda993ce97fce9828e814cd966946ccdab756d87", this test works well..

Thanks! I got to the Ring::sub part that crashes after conjugate. Didn't know there was a commit related to it. Much appreciated!

tjungND commented 4 years ago

@tjungND This is related to segmentation fault issue of the pull request (#36 (comment))

If you checkout to commit "cda993ce97fce9828e814cd966946ccdab756d87", this test works well..

Hmm, I'm not sure what's happening. I checked out that commit, but it still seg faults. The Ring::sub does have SubMod(res, p1, p2, mod) instead of AddMod(res, p1, -p2, mod).

BTW, gamma-2017 says the code crashes after changing AddMod(res, p1,-p2, mod) to SubMod(res, p1,p2,mod).

I rolled back to AddMod(res, p1,-p2,mod), and Bootstrapping works correctly.

I'm on MacOS Catalina Version 10.15.3 NTL version is 11.4.3 G++ version is 4.2.1

Anyway, I'm happy that it works for me. I'll fork a branch and roll back to AddMod for myself. Thanks for the pointer. That helped.

du1204 commented 4 years ago

Hi, I rolled back the previous pull request (#36 (comment)). Sorry for the confusion.

tjungND commented 4 years ago

Hi, I rolled back the previous pull request (#36 (comment)). Sorry for the confusion.

No problem. Thanks!

Just FYI, when it was SubMod instead of AddMod, I found

SubMod(res[i], cipher1.bx[i], cipher2.bx[i], q);

Segfaults randomly at i = 1-3 if cipher2 is derived by

Scheme::conjugate(cipher2, cipher1);

I absolutely have no idea what's the issue. ¯_(ツ)_/¯