Make all keyslot context types fully self-contained.

Duplicate all dynamically allocated memory passed
keyslot context during initialization and make it
self contained.

Before current patch all pointers passed in keyslot
context initialization routines have to remain valid
for the duration of the keyslot context. Otherwise
memory violation could occur.

This patch fixes the issue in backward compatible
way so that we do not have to change API for all
keyslot contexts. As of now all dynamically allocated
memory can be freed right after keyslot context
initialization.
This commit is contained in:
Ondrej Kozina
2024-02-20 12:03:15 +01:00
committed by Milan Broz
parent 209e6167b5
commit 9311c923ca
4 changed files with 434 additions and 48 deletions

View File

@@ -184,4 +184,11 @@ CRYPTSETUP_2.7 {
CRYPTSETUP_2.8 {
global:
crypt_safe_memcpy;
crypt_keyslot_context_init_by_passphrase;
crypt_keyslot_context_init_by_keyfile;
crypt_keyslot_context_init_by_token;
crypt_keyslot_context_init_by_volume_key;
crypt_keyslot_context_init_by_signed_key;
crypt_keyslot_context_init_by_keyring;
crypt_keyslot_context_init_by_vk_in_keyring;
} CRYPTSETUP_2.7;