diff --git a/platforms/common/include/px4_platform_common/crypto_backend.h b/platforms/common/include/px4_platform_common/crypto_backend.h index 5fdd6a548b3f..da7d4998284f 100644 --- a/platforms/common/include/px4_platform_common/crypto_backend.h +++ b/platforms/common/include/px4_platform_common/crypto_backend.h @@ -82,6 +82,17 @@ size_t keystore_get_key(keystore_session_handle_t handle, uint8_t idx, uint8_t * */ bool keystore_put_key(keystore_session_handle_t handle, uint8_t idx, uint8_t *key, size_t key_size); +/* + * Modify a key in keystore + * handle: a handle to an open keystore + * idx: key index in keystore + * key_buf: work buffer for the key + * key_buf_size: size of the provided work buffer + * cb: callback function to perform the modification of the key + * arg: pointer to callback custom argument + */ +bool keystore_modify_key(keystore_session_handle_t handle, uint8_t idx, uint8_t *key_buf, size_t key_buf_size, + keystore_callback_t cb, void *arg); /* * Architecture specific PX4 Crypto API functions diff --git a/src/drivers/stub_keystore/keystore_backend_definitions.h b/src/drivers/stub_keystore/keystore_backend_definitions.h index 3e990cd71f40..95049c588b6f 100644 --- a/src/drivers/stub_keystore/keystore_backend_definitions.h +++ b/src/drivers/stub_keystore/keystore_backend_definitions.h @@ -33,6 +33,11 @@ #pragma once +#include + +/* callback function definition for modify key */ +typedef bool (*keystore_callback_t)(uint8_t idx, uint8_t *key, size_t key_size, void* arg); + typedef struct { int handle; } keystore_session_handle_t; diff --git a/src/drivers/stub_keystore/stub_keystore.c b/src/drivers/stub_keystore/stub_keystore.c index 1e5054021ad3..212b020073c0 100644 --- a/src/drivers/stub_keystore/stub_keystore.c +++ b/src/drivers/stub_keystore/stub_keystore.c @@ -86,3 +86,9 @@ bool keystore_put_key(keystore_session_handle_t handle, uint8_t idx, uint8_t *ke { return false; } + +bool keystore_modify_key(keystore_session_handle_t handle, uint8_t idx, uint8_t *key_buf, size_t key_buf_size, + keystore_callback_t cb, void *arg) +{ + return false; +}