harden crypto keys handling
Open
keys
security
- Dominant language
- Python
- Stars
- 13.7k
- Forks
- 875
- Avg merge
- 11h 15m
- Merged PRs (30d)
- 192
Description
Split off from #2525:
- Do not keep cryptographic keys around in Python objects
- Use secure memory for cryptographic keys
This is offered by e.g. sodium_malloc. It works by aligning the data to the end of a page and mprotect()ing the *following* page with PROT_NONE. The remainder of the first page is filled with canary data. Finally another guard page is placed before the page containing the data. All three pages are mlock()d as well, to avoid swapping. Inclusion in core dumps is prohibited as well (MADV_DONTDUMP).
Freeing memory checks the canaries and securely erases the contained data.
Contributor guide
Assessment
This issue has not been assessed yet.