8000 tests/pkg/relic: add Paillier encryption tests by krzysztof-cabaj · Pull Request #21301 · RIOT-OS/RIOT · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

tests/pkg/relic: add Paillier encryption tests #21301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 18, 2025

Conversation

krzysztof-cabaj
Copy link
Contributor
@krzysztof-cabaj krzysztof-cabaj commented Mar 17, 2025

Contribution description

This PR adds two tests to Relic library, concerning Paillier encryption:

  • generation of Paillier public key pair and simple encryption and decryption,
  • generation of Paillier public key pair, data encryption and addition of encrypted data.

Unfortunately, currently only 512 bit Paillier encryption works - in following weeks I try to figure out why longer keys leads to stack smashing. I tested native with 256 MiB of memory and stack smashing error appears.
Using big enough BN_PRECI in RELIC_CONFIG_FLAGS and appropriate stack size allows usage of longer keys.

With BN_PRECI=4096 and stack size with 114688 bytes on native - Paillier keys 1024 and 2048 bits works.

Testing procedure

Run tests/pkg/relic and check if all tests are successful.

Issues/PRs references

None

@github-actions github-actions bot added the Area: tests Area: tests and testing framework label Mar 17, 2025
@mguetschow mguetschow added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Mar 17, 2025
@riot-ci
Copy link
riot-ci commented Mar 17, 2025

Murdock results

✔️ PASSED

c1ec586 tests/pkg/relic: add Paillier encrypted data addition test

Success Failures Total Runtime
19 0 20 01m:32s

Artifacts

Copy link
Contributor
@mguetschow mguetschow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor nit, otherwise looks good. Thanks!

@mguetschow
Copy link
Contributor

Unfortunately, currently only 512 bit Paillier encryption works - in following weeks I try to figure out why longer keys leads to
stack smashing. I tested native with 256 MiB of memory and stack smashing error appears.

BN_PRECI is set to 1024 by default. Maybe increasing that one helps?

@krzysztof-cabaj
Copy link
Contributor Author

@mguetschow thanks for hint, but ...
BN_PRECI set to 2048 allows usage of 1024-bit keys. However, when BN_PRECI is set to 4096 or more ... key generation leads to segmentation fault :(. I try to investigate this topic in free time - and this is probably work for another PR.

We can merge this PR with 512-bits (current version) or I could change it to 1024-bits.

Copy link
Contributor
@mguetschow mguetschow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I'd say it's fine to merge like it is. Maybe open an issue instead so we have a reminder to look into it.

@mguetschow mguetschow enabled auto-merge March 18, 2025 08:09
@mguetschow mguetschow added this pull request to the merge queue Mar 18, 2025
Merged via the queue into RIOT-OS:master with commit 6dc9c18 Mar 18, 2025
27 checks passed
@krzysztof-cabaj
Copy link
Contributor Author

Then I'd say it's fine to merge like it is. Maybe open an issue instead so we have a reminder to look into it.

I investigate the issue once again - and BN_PRECI with appropriate, big enough stack allows Paillier keys with 1024 and even 2048 bits.

@mguetschow mguetschow added this to the Release 2025.04 milestone Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: tests Area: tests and testing framework CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0