Skip to content

Commit

Permalink
keystore_modify_key function
Browse files Browse the repository at this point in the history
  • Loading branch information
jnippula committed Mar 5, 2024
1 parent 439f40e commit e3bad5d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions platforms/common/include/px4_platform_common/crypto_backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions src/drivers/stub_keystore/keystore_backend_definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@

#pragma once

#include <inttypes.h>

/* 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;
Expand Down
6 changes: 6 additions & 0 deletions src/drivers/stub_keystore/stub_keystore.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit e3bad5d

Please sign in to comment.