From aa61bc49420d5b1ac9a849b8f760240fd629afaf Mon Sep 17 00:00:00 2001 From: Jukka Laitinen Date: Fri, 16 Jul 2021 10:19:53 +0300 Subject: [PATCH] Add functions for initializing empty crypto backend handles Signed-off-by: Jukka Laitinen --- .../stub_keystore/keystore_backend_definitions.h | 5 ++--- .../px4_sw_crypto/sw_crypto/crypto_backend_definitions.h | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/platforms/common/px4_sw_crypto/stub_keystore/keystore_backend_definitions.h b/platforms/common/px4_sw_crypto/stub_keystore/keystore_backend_definitions.h index c3a3f054067..3e990cd71f4 100644 --- a/platforms/common/px4_sw_crypto/stub_keystore/keystore_backend_definitions.h +++ b/platforms/common/px4_sw_crypto/stub_keystore/keystore_backend_definitions.h @@ -37,6 +37,5 @@ typedef struct { int handle; } keystore_session_handle_t; -/* For the stub_keystore the handle is not used at the moment, so it is always valid */ - -inline bool keystore_session_handle_valid(keystore_session_handle_t handle) {return handle.handle > 0;} +static inline void keystore_session_handle_init(keystore_session_handle_t *handle) {handle->handle = 0;} +static inline bool keystore_session_handle_valid(keystore_session_handle_t handle) {return handle.handle > 0;} diff --git a/platforms/common/px4_sw_crypto/sw_crypto/crypto_backend_definitions.h b/platforms/common/px4_sw_crypto/sw_crypto/crypto_backend_definitions.h index 36219e04f4e..052962aa44b 100644 --- a/platforms/common/px4_sw_crypto/sw_crypto/crypto_backend_definitions.h +++ b/platforms/common/px4_sw_crypto/sw_crypto/crypto_backend_definitions.h @@ -43,4 +43,5 @@ typedef struct { keystore_session_handle_t keystore_handle; } crypto_session_handle_t; +static inline void crypto_session_handle_init(crypto_session_handle_t *handle) {handle->handle = 0;} static inline bool crypto_session_handle_valid(crypto_session_handle_t handle) {return handle.handle > 0;}