Skip to content
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

Reduce stack footprint #200

Merged
merged 5 commits into from
Mar 7, 2024
Merged

Conversation

ThibsG
Copy link
Contributor

@ThibsG ThibsG commented Mar 6, 2024

fixes #193

@ThibsG ThibsG force-pushed the reduce_stack_footprint branch from dbd3170 to b30f5f8 Compare March 7, 2024 07:47
@ThibsG ThibsG marked this pull request as ready for review March 7, 2024 08:00
@ThibsG ThibsG requested review from ackRow and Manuthor March 7, 2024 08:01
@ThibsG ThibsG mentioned this pull request Mar 7, 2024
Copy link
Contributor

@JosePisco JosePisco left a comment

Choose a reason for hiding this comment

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

👍

@tbrezot
Copy link
Contributor

tbrezot commented Mar 7, 2024

After a quick read of the diffs, my feelings are mixed: on the one hand, this patch sure should fix the issue; one the other hand, it adds a lot of complexity by exposing the boxing. Moreover, I struggle to see the pattern you followed to decide which object to box.

Wouldn't boxing the KMIP Object be enough?

@ThibsG
Copy link
Contributor Author

ThibsG commented Mar 7, 2024

How course, boxing the full Object would do the trick, but if you use Object on its own or sub-components (such as KeyBlock or KeyValue) you will have the same issue again, so you have to go box deeper.

I chose to box some elements based on the size they represent in their enum/struct (thank you @ackRow for the reminder 😉). The threshold is totally arbitrary: if the variable is over something like 50 bytes, I did the box. AFAIK there is no magic threshold to choose when to put on the heap

@Manuthor Manuthor merged commit e75746a into feature/covercrypt_rekey Mar 7, 2024
22 checks passed
@Manuthor Manuthor deleted the reduce_stack_footprint branch March 7, 2024 16:01
ackRow pushed a commit that referenced this pull request Mar 8, 2024
* CI: remove min stack size

* Box in Attributes

* Box key_wrapping_data and more cryptographic_parameters

* Box attributes in KeyValue

* Box BigUint and SafeBigUint in KeyMaterial
Manuthor added a commit that referenced this pull request Mar 8, 2024
* feat: replace attribute rotation to access policy rekey

* refacto: move policy and rekey action in dedicated files

* chore: change vendor attribute name for covercrypt rekey action

* feat: change CLI command rotate to rekey and update tests

* fix: update user key locate tests

* ci: fix pyo3 tests

* ci: use last cloudproof python branch

* refacto: master keys rekey

* feat(pyo3): support and test policy attribute removal and renaming

* refacto: reuse updated private key to refresh user key

* ci: update cloudproof_kms_js branch

* refacto: factor user keys update inner for loop in `refresh_user_decryption_key`

* fix: cli rekey imports

* ci: fix cargo udeps

* feat: add cli command `cc keys rekey` and `cc keys prune`

* feat: add cli policy edit command and tests

* fix: remove deadcode and fix comments

* use closures in CC keys update

* fix: group KMS objects with their IDs

* fix: use release test to avoid worker stack overflow upon test error

* fix: review

* fix: define type `KmipKeyUidObject` to store a key UID and its KmipObject

* fix: apply review suggestions

(cherry picked from commit ebd196e8ed251603b657e1e6445a9e6d8e75ce48)

* ci: double `RUST_MIN_STACK` to `4MB` to avoid stack overflow during tests

* docs: update doc of CLI rekey and policy edit

* docs: update CLI doc and CHANGELOG

* fix: Reduce stack footprint (#200)

* CI: remove min stack size

* Box in Attributes

* Box key_wrapping_data and more cryptographic_parameters

* Box attributes in KeyValue

* Box BigUint and SafeBigUint in KeyMaterial

* chore: update KMS version to `4.13.0`

---------

Co-authored-by: Manuthor <manu.coste@gmail.com>
Co-authored-by: Théophile BRÉZOT <theophile.brezot@cosmian.com>
Co-authored-by: Thibs <ThibsG@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants