From 4c6779812d5e813cb64eae182a7f71d6deabb5d6 Mon Sep 17 00:00:00 2001 From: Jukka Laitinen Date: Wed, 9 Jun 2021 11:24:30 +0300 Subject: [PATCH] Add keystore_put_key interface function for storing keys permanently Signed-off-by: Jukka Laitinen --- .../common/include/px4_platform_common/crypto_backend.h | 9 +++++++++ .../common/px4_sw_crypto/stub_keystore/stub_keystore.c | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/platforms/common/include/px4_platform_common/crypto_backend.h b/platforms/common/include/px4_platform_common/crypto_backend.h index 9b4edd5b94..ae63875560 100644 --- a/platforms/common/include/px4_platform_common/crypto_backend.h +++ b/platforms/common/include/px4_platform_common/crypto_backend.h @@ -71,6 +71,15 @@ void keystore_close(keystore_session_handle_t *handle); */ size_t keystore_get_key(keystore_session_handle_t handle, uint8_t idx, uint8_t *key_buf, size_t key_buf_size); +/* + * Store a key persistently into the keystore + * idx: key index in keystore + * key: pointer to the key + * key_size: size of the key + */ +bool keystore_put_key(keystore_session_handle_t handle, uint8_t idx, uint8_t *key, size_t key_size); + + /* * Architecture specific PX4 Crypto API functions */ diff --git a/platforms/common/px4_sw_crypto/stub_keystore/stub_keystore.c b/platforms/common/px4_sw_crypto/stub_keystore/stub_keystore.c index 8633ba6399..0f33436479 100644 --- a/platforms/common/px4_sw_crypto/stub_keystore/stub_keystore.c +++ b/platforms/common/px4_sw_crypto/stub_keystore/stub_keystore.c @@ -77,3 +77,8 @@ size_t keystore_get_key(keystore_session_handle_t handle, uint8_t idx, uint8_t * return ret; } + +bool keystore_put_key(keystore_session_handle_t handle, uint8_t idx, uint8_t *key, size_t key_size) +{ + return false; +}