Introduce common service client

In preparation for making common service access information
such as the maximum request length or supported serializations,
a common service client has been introduced that standardizes
common client state, including any available service access
info.  All clients refactored to use the common service client.

Signed-off-by: Julian Hall <julian.hall@arm.com>
Change-Id: I31336901476f5647d2ed00294716940f475da08c
diff --git a/components/service/attestation/client/provision/attest_provision_client.c b/components/service/attestation/client/provision/attest_provision_client.c
index 90fe04d..3301a84 100644
--- a/components/service/attestation/client/provision/attest_provision_client.c
+++ b/components/service/attestation/client/provision/attest_provision_client.c
@@ -10,6 +10,7 @@
 #include <common/tlv/tlv.h>
 #include <psa/initial_attestation.h>
 #include <provision/attest_provision.h>
+#include <service/common/client/service_client.h>
 #include <protocols/service/attestation/packed-c/export_iak_public_key.h>
 #include <protocols/service/attestation/packed-c/import_iak.h>
 #include <protocols/service/attestation/packed-c/opcodes.h>
@@ -18,28 +19,19 @@
 /**
  * @brief      The singleton attest_provision_client instance
  *
- * The attest provison C API assumes a single backend service provider.  This
- * structure defines the state used by the attest_provision_client that communicates
- * with a remote provider using the provided rpc caller.
+ * The attest provison C API assumes a single backend service provider.
  */
-static struct attest_provision_client
-{
-    struct rpc_caller *caller;
-    int rpc_status;
-} instance;
+static struct service_client instance;
 
 
 psa_status_t attest_provision_client_init(struct rpc_caller *caller)
 {
-	instance.caller = caller;
-	instance.rpc_status = TS_RPC_CALL_ACCEPTED;
-
-	return PSA_SUCCESS;
+	return service_client_init(&instance, caller);
 }
 
 void attest_provision_client_deinit(void)
 {
-	instance.caller = NULL;
+	service_client_deinit(&instance);
 }
 
 int attest_provision_client_rpc_status(void)
@@ -48,147 +40,147 @@
 }
 
 psa_status_t attest_provision_export_iak_public_key(
-    uint8_t *data,
-    size_t data_size,
-    size_t *data_length)
+	uint8_t *data,
+	size_t data_size,
+	size_t *data_length)
 {
-    psa_status_t psa_status = PSA_ERROR_GENERIC_ERROR;
+	psa_status_t psa_status = PSA_ERROR_GENERIC_ERROR;
 
-    *data_length = 0; /* For failure case */
+	*data_length = 0; /* For failure case */
 
-    rpc_call_handle call_handle;
-    uint8_t *req_buf;
+	rpc_call_handle call_handle;
+	uint8_t *req_buf;
 
-    call_handle = rpc_caller_begin(instance.caller, &req_buf, 0);
+	call_handle = rpc_caller_begin(instance.caller, &req_buf, 0);
 
-    if (call_handle) {
+	if (call_handle) {
 
-        uint8_t *resp_buf;
-        size_t resp_len;
-        int opstatus;
+		uint8_t *resp_buf;
+		size_t resp_len;
+		int opstatus;
 
-        instance.rpc_status = rpc_caller_invoke(instance.caller, call_handle,
-            TS_ATTESTATION_OPCODE_EXPORT_IAK_PUBLIC_KEY, &opstatus, &resp_buf, &resp_len);
+		instance.rpc_status = rpc_caller_invoke(instance.caller, call_handle,
+			TS_ATTESTATION_OPCODE_EXPORT_IAK_PUBLIC_KEY, &opstatus, &resp_buf, &resp_len);
 
-        if (instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
-            psa_status = opstatus;
+			psa_status = opstatus;
 
-            if (psa_status == PSA_SUCCESS) {
+			if (psa_status == PSA_SUCCESS) {
 
-                struct tlv_const_iterator resp_iter;
-                struct tlv_record decoded_record;
-                tlv_const_iterator_begin(&resp_iter, resp_buf, resp_len);
+				struct tlv_const_iterator resp_iter;
+				struct tlv_record decoded_record;
+				tlv_const_iterator_begin(&resp_iter, resp_buf, resp_len);
 
-                if (tlv_find_decode(&resp_iter,
-                    TS_ATTESTATION_EXPORT_IAK_PUBLIC_KEY_OUT_TAG_DATA, &decoded_record)) {
+				if (tlv_find_decode(&resp_iter,
+					TS_ATTESTATION_EXPORT_IAK_PUBLIC_KEY_OUT_TAG_DATA, &decoded_record)) {
 
-                    if (decoded_record.length <= data_size) {
+					if (decoded_record.length <= data_size) {
 
-                        memcpy(data, decoded_record.value, decoded_record.length);
-                        *data_length = decoded_record.length;
-                    }
-                    else {
-                        /* Provided buffer is too small */
-                        psa_status = PSA_ERROR_BUFFER_TOO_SMALL;
-                    }
-                }
-                else {
-                    /* Mandatory response parameter missing */
-                    psa_status = PSA_ERROR_GENERIC_ERROR;
-                }
-            }
-        }
+						memcpy(data, decoded_record.value, decoded_record.length);
+						*data_length = decoded_record.length;
+					}
+					else {
+						/* Provided buffer is too small */
+						psa_status = PSA_ERROR_BUFFER_TOO_SMALL;
+					}
+				}
+				else {
+					/* Mandatory response parameter missing */
+					psa_status = PSA_ERROR_GENERIC_ERROR;
+				}
+			}
+		}
 
-        rpc_caller_end(instance.caller, call_handle);
-    }
+		rpc_caller_end(instance.caller, call_handle);
+	}
 
-    return psa_status;
+	return psa_status;
 }
 
 psa_status_t attest_provision_import_iak(
-    const uint8_t *data,
-    size_t data_length)
+	const uint8_t *data,
+	size_t data_length)
 {
-    psa_status_t psa_status = PSA_ERROR_GENERIC_ERROR;
-    size_t req_len = tlv_required_space(data_length);
+	psa_status_t psa_status = PSA_ERROR_GENERIC_ERROR;
+	size_t req_len = tlv_required_space(data_length);
 
-    struct tlv_record key_record;
-    key_record.tag = TS_ATTESTATION_IMPORT_IAK_IN_TAG_DATA;
-    key_record.length = data_length;
-    key_record.value = data;
+	struct tlv_record key_record;
+	key_record.tag = TS_ATTESTATION_IMPORT_IAK_IN_TAG_DATA;
+	key_record.length = data_length;
+	key_record.value = data;
 
-    rpc_call_handle call_handle;
-    uint8_t *req_buf;
+	rpc_call_handle call_handle;
+	uint8_t *req_buf;
 
-    call_handle = rpc_caller_begin(instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(instance.caller, &req_buf, req_len);
 
-    if (call_handle) {
+	if (call_handle) {
 
-        uint8_t *resp_buf;
-        size_t resp_len;
-        int opstatus;
-        struct tlv_iterator req_iter;
+		uint8_t *resp_buf;
+		size_t resp_len;
+		int opstatus;
+		struct tlv_iterator req_iter;
 
-        tlv_iterator_begin(&req_iter, req_buf, req_len);
-        tlv_encode(&req_iter, &key_record);
+		tlv_iterator_begin(&req_iter, req_buf, req_len);
+		tlv_encode(&req_iter, &key_record);
 
-        instance.rpc_status = rpc_caller_invoke(instance.caller, call_handle,
-            TS_ATTESTATION_OPCODE_IMPORT_IAK, &opstatus, &resp_buf, &resp_len);
+		instance.rpc_status = rpc_caller_invoke(instance.caller, call_handle,
+			TS_ATTESTATION_OPCODE_IMPORT_IAK, &opstatus, &resp_buf, &resp_len);
 
-        if (instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
-            psa_status = opstatus;
-        }
+			psa_status = opstatus;
+		}
 
-        rpc_caller_end(instance.caller, call_handle);
-    }
+		rpc_caller_end(instance.caller, call_handle);
+	}
 
-    return psa_status;
+	return psa_status;
 
 }
 
 psa_status_t attest_provision_iak_exists(void)
 {
-    psa_status_t psa_status = PSA_ERROR_GENERIC_ERROR;
-    rpc_call_handle call_handle;
-    uint8_t *req_buf;
+	psa_status_t psa_status = PSA_ERROR_GENERIC_ERROR;
+	rpc_call_handle call_handle;
+	uint8_t *req_buf;
 
-    call_handle = rpc_caller_begin(instance.caller, &req_buf, 0);
+	call_handle = rpc_caller_begin(instance.caller, &req_buf, 0);
 
-    if (call_handle) {
+	if (call_handle) {
 
-        uint8_t *resp_buf;
-        size_t resp_len;
-        int opstatus;
+		uint8_t *resp_buf;
+		size_t resp_len;
+		int opstatus;
 
-        instance.rpc_status = rpc_caller_invoke(instance.caller, call_handle,
-            TS_ATTESTATION_OPCODE_IAK_EXISTS, &opstatus, &resp_buf, &resp_len);
+		instance.rpc_status = rpc_caller_invoke(instance.caller, call_handle,
+			TS_ATTESTATION_OPCODE_IAK_EXISTS, &opstatus, &resp_buf, &resp_len);
 
-        if (instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
-            psa_status = opstatus;
-        }
+			psa_status = opstatus;
+		}
 
-        rpc_caller_end(instance.caller, call_handle);
-    }
+		rpc_caller_end(instance.caller, call_handle);
+	}
 
-    return psa_status;
+	return psa_status;
 }
 
 psa_status_t tfm_initial_attest_get_public_key(
-    uint8_t *public_key,
-    size_t public_key_buf_size,
-    size_t *public_key_len,
-    psa_ecc_family_t *elliptic_curve_type)
+	uint8_t *public_key,
+	size_t public_key_buf_size,
+	size_t *public_key_len,
+	psa_ecc_family_t *elliptic_curve_type)
 {
-    /* Wrapper to provide compatibility with psa arch tests that assume a TF-M
-     * based device under test.
-     */
-    *elliptic_curve_type = PSA_ECC_FAMILY_SECP_R1;
+	/* Wrapper to provide compatibility with psa arch tests that assume a TF-M
+	 * based device under test.
+	 */
+	*elliptic_curve_type = PSA_ECC_FAMILY_SECP_R1;
 
-    psa_status_t status = attest_provision_export_iak_public_key(public_key,
-        public_key_buf_size, public_key_len);
+	psa_status_t status = attest_provision_export_iak_public_key(public_key,
+		public_key_buf_size, public_key_len);
 
-    return status;
+	return status;
 }
diff --git a/components/service/attestation/client/psa/iat_client.c b/components/service/attestation/client/psa/iat_client.c
index c2bb035..180c044 100644
--- a/components/service/attestation/client/psa/iat_client.c
+++ b/components/service/attestation/client/psa/iat_client.c
@@ -9,6 +9,7 @@
 #include "iat_client.h"
 #include <common/tlv/tlv.h>
 #include <psa/initial_attestation.h>
+#include <service/common/client/service_client.h>
 #include <protocols/service/attestation/packed-c/get_token.h>
 #include <protocols/service/attestation/packed-c/get_token_size.h>
 #include <protocols/service/attestation/packed-c/opcodes.h>
@@ -17,28 +18,19 @@
 /**
  * @brief      The singleton psa_iat_client instance
  *
- * The psa attestation C API assumes a single backend service provider.  This
- * structure defines the state used by the psa_iat_client that communicates
- * with a remote provider using the provided rpc caller.
+ * The psa attestation C API assumes a single backend service provider.
  */
-static struct psa_iat_client
-{
-    struct rpc_caller *caller;
-    int rpc_status;
-} instance;
+static struct service_client instance;
 
 
 psa_status_t psa_iat_client_init(struct rpc_caller *caller)
 {
-	instance.caller = caller;
-	instance.rpc_status = TS_RPC_CALL_ACCEPTED;
-
-	return PSA_SUCCESS;
+	return service_client_init(&instance, caller);
 }
 
 void psa_iat_client_deinit(void)
 {
-	instance.caller = NULL;
+	service_client_deinit(&instance);
 }
 
 int psa_iat_client_rpc_status(void)
diff --git a/components/service/common/client/component.cmake b/components/service/common/client/component.cmake
new file mode 100644
index 0000000..eafa4c4
--- /dev/null
+++ b/components/service/common/client/component.cmake
@@ -0,0 +1,13 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+if (NOT DEFINED TGT)
+	message(FATAL_ERROR "mandatory parameter TGT is not defined.")
+endif()
+
+target_sources(${TGT} PRIVATE
+	"${CMAKE_CURRENT_LIST_DIR}/service_client.c"
+	)
diff --git a/components/service/common/client/service_access_info.h b/components/service/common/client/service_access_info.h
new file mode 100644
index 0000000..83b88ce
--- /dev/null
+++ b/components/service/common/client/service_access_info.h
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef SERVICE_ACCESS_INFO_H
+#define SERVICE_ACCESS_INFO_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief      Information about accessing a service
+ *
+ * Provides information to a client about accessing a service provided
+ * by a remote service provider instance.
+ */
+struct service_access_info
+{
+	uint32_t supported_encodings;
+	size_t max_req_size;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SERVICE_ACCESS_INFO_H */
diff --git a/components/service/common/client/service_client.c b/components/service/common/client/service_client.c
new file mode 100644
index 0000000..3849843
--- /dev/null
+++ b/components/service/common/client/service_client.c
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <stddef.h>
+#include <protocols/rpc/common/packed-c/status.h>
+#include "service_client.h"
+
+psa_status_t service_client_init(
+	struct service_client *context,
+	struct rpc_caller *caller)
+{
+	context->caller = caller;
+	context->rpc_status = TS_RPC_CALL_ACCEPTED;
+
+	context->service_access_info.supported_encodings = 0;
+	context->service_access_info.max_req_size = 0;
+
+	return PSA_SUCCESS;
+}
+
+void service_client_deinit(
+	struct service_client *context)
+{
+	context->caller = NULL;
+}
+
+void service_client_set_service_access_info(
+	struct service_client *context,
+	const struct service_access_info *service_access_info)
+{
+	context->service_access_info = *service_access_info;
+}
diff --git a/components/service/common/client/service_client.h b/components/service/common/client/service_client.h
new file mode 100644
index 0000000..b20f734
--- /dev/null
+++ b/components/service/common/client/service_client.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef SERVICE_CLIENT_H
+#define SERVICE_CLIENT_H
+
+#include <stddef.h>
+#include <psa/error.h>
+#include <rpc_caller.h>
+#include <service/common/client/service_access_info.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief      Common service client structure
+ *
+ * Holds common service objects needed for client access to a service instance.
+ * Includes common information about the service that will have been discovered
+ * in some way.  The TS discovery protocol provides a way to do this.  If
+ * service info is not available, the service_access_info structure stays in its
+ * initialied state.
+ */
+struct service_client
+{
+	struct rpc_caller *caller;
+	int rpc_status;
+	struct service_access_info service_access_info;
+};
+
+/**
+ * @brief      Initialises the service client
+ *
+ * Initialises the service client, including discovery of service info
+ * if supported by the service provider.
+ *
+ * @param[in]  context 	service_client instance
+ * @param[in]  rpc_caller RPC caller to use
+ *
+ * @return     A status indicating the success/failure of the operation
+ */
+psa_status_t service_client_init(
+	struct service_client *context,
+	struct rpc_caller *caller);
+
+/**
+ * @brief      De-initialises the service client
+ *
+ * @param[in]  context 	service_client instance
+ */
+void service_client_deinit(
+	struct service_client *context);
+
+/**
+ * @brief      Set the service info
+ *
+ * Service info will have been discovered in some way.
+ *
+ * @param[in]  context 	service_client instance
+ * @param[in]  service_access_info service_access_info object
+ */
+void service_client_set_service_access_info(
+	struct service_client *context,
+	const struct service_access_info *service_access_info);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SERVICE_CLIENT_H */
diff --git a/components/service/crypto/client/cpp/crypto_client.cpp b/components/service/crypto/client/cpp/crypto_client.cpp
index 602a6b5..33eb7d1 100644
--- a/components/service/crypto/client/cpp/crypto_client.cpp
+++ b/components/service/crypto/client/cpp/crypto_client.cpp
@@ -8,30 +8,28 @@
 #include <protocols/rpc/common/packed-c/status.h>
 
 crypto_client::crypto_client() :
-    m_caller(NULL),
-    m_err_rpc_status(TS_RPC_CALL_ACCEPTED)
+    m_client()
 {
-
+    service_client_init(&m_client, NULL);
 }
 
 crypto_client::crypto_client(struct rpc_caller *caller) :
-    m_caller(caller),
-    m_err_rpc_status(TS_RPC_CALL_ACCEPTED)
+    m_client()
 {
-
+    service_client_init(&m_client, caller);
 }
 
 crypto_client::~crypto_client()
 {
-
+    service_client_deinit(&m_client);
 }
 
 void crypto_client::set_caller(struct rpc_caller *caller)
 {
-    m_caller = caller;
+    m_client.caller = caller;
 }
 
 int crypto_client::err_rpc_status() const
 {
-    return m_err_rpc_status;
+    return m_client.rpc_status;
 }
diff --git a/components/service/crypto/client/cpp/crypto_client.h b/components/service/crypto/client/cpp/crypto_client.h
index 03cf4b3..d996380 100644
--- a/components/service/crypto/client/cpp/crypto_client.h
+++ b/components/service/crypto/client/cpp/crypto_client.h
@@ -9,8 +9,7 @@
 
 #include <cstdint>
 #include <psa/crypto.h>
-
-struct rpc_caller;
+#include <service/common/client/service_client.h>
 
 /*
  * Provides a client interface for accessing an instance of the Crypto service
@@ -72,8 +71,7 @@
     crypto_client(struct rpc_caller *caller);
     void set_caller(struct rpc_caller *caller);
 
-    struct rpc_caller *m_caller;
-    int m_err_rpc_status;
+    struct service_client m_client;
 };
 
 #endif /* CRYPTO_CLIENT_H */
diff --git a/components/service/crypto/client/cpp/packed-c/packedc_crypto_client.cpp b/components/service/crypto/client/cpp/packed-c/packedc_crypto_client.cpp
index a7618ba..43b2a66 100644
--- a/components/service/crypto/client/cpp/packed-c/packedc_crypto_client.cpp
+++ b/components/service/crypto/client/cpp/packed-c/packedc_crypto_client.cpp
@@ -42,7 +42,8 @@
 
 }
 
-psa_status_t packedc_crypto_client::generate_key(const psa_key_attributes_t *attributes, psa_key_id_t *id)
+psa_status_t packedc_crypto_client::generate_key(const psa_key_attributes_t *attributes,
+											psa_key_id_t *id)
 {
 	psa_status_t psa_status = PSA_ERROR_GENERIC_ERROR;
 	struct ts_crypto_generate_key_in req_msg;
@@ -53,7 +54,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(m_caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(m_client.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -63,10 +64,10 @@
 
 		memcpy(req_buf, &req_msg, req_len);
 
-		m_err_rpc_status = rpc_caller_invoke(m_caller, call_handle,
+		m_client.rpc_status = rpc_caller_invoke(m_client.caller, call_handle,
 			TS_CRYPTO_OPCODE_GENERATE_KEY, &opstatus, &resp_buf, &resp_len);
 
-		if (m_err_rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (m_client.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -85,7 +86,7 @@
 			}
 		}
 
-		rpc_caller_end(m_caller, call_handle);
+		rpc_caller_end(m_client.caller, call_handle);
 	}
 
 	return psa_status;
@@ -102,7 +103,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(m_caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(m_client.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -112,12 +113,12 @@
 
 		memcpy(req_buf, &req_msg, req_len);
 
-		m_err_rpc_status = rpc_caller_invoke(m_caller, call_handle,
+		m_client.rpc_status = rpc_caller_invoke(m_client.caller, call_handle,
 			TS_CRYPTO_OPCODE_DESTROY_KEY, &opstatus, &resp_buf, &resp_len);
 
-		if (m_err_rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
+		if (m_client.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
 
-		rpc_caller_end(m_caller, call_handle);
+		rpc_caller_end(m_client.caller, call_handle);
 	}
 
 	return psa_status;
@@ -141,7 +142,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(m_caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(m_client.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -155,10 +156,10 @@
 		tlv_iterator_begin(&req_iter, &req_buf[req_fixed_len], req_len - req_fixed_len);
 		tlv_encode(&req_iter, &key_record);
 
-		m_err_rpc_status = rpc_caller_invoke(m_caller, call_handle,
+		m_client.rpc_status = rpc_caller_invoke(m_client.caller, call_handle,
 			TS_CRYPTO_OPCODE_IMPORT_KEY, &opstatus, &resp_buf, &resp_len);
 
-		if (m_err_rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (m_client.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -177,7 +178,7 @@
 			}
 		}
 
-		rpc_caller_end(m_caller, call_handle);
+		rpc_caller_end(m_client.caller, call_handle);
 	}
 
 	return psa_status;
@@ -198,7 +199,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(m_caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(m_client.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -208,10 +209,10 @@
 
 		memcpy(req_buf, &req_msg, req_len);
 
-		m_err_rpc_status = rpc_caller_invoke(m_caller, call_handle,
+		m_client.rpc_status = rpc_caller_invoke(m_client.caller, call_handle,
 			TS_CRYPTO_OPCODE_EXPORT_KEY, &opstatus, &resp_buf, &resp_len);
 
-		if (m_err_rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (m_client.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -241,7 +242,7 @@
 			}
 		}
 
-		rpc_caller_end(m_caller, call_handle);
+		rpc_caller_end(m_client.caller, call_handle);
 	}
 
 	return psa_status;
@@ -261,7 +262,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(m_caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(m_client.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -271,10 +272,10 @@
 
 		memcpy(req_buf, &req_msg, req_len);
 
-		m_err_rpc_status = rpc_caller_invoke(m_caller, call_handle,
+		m_client.rpc_status = rpc_caller_invoke(m_client.caller, call_handle,
 			TS_CRYPTO_OPCODE_EXPORT_PUBLIC_KEY, &opstatus, &resp_buf, &resp_len);
 
-		if (m_err_rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (m_client.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -304,7 +305,7 @@
 			}
 		}
 
-		rpc_caller_end(m_caller, call_handle);
+		rpc_caller_end(m_client.caller, call_handle);
 	}
 
 	return psa_status;
@@ -332,7 +333,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(m_caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(m_client.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -346,10 +347,10 @@
 		tlv_iterator_begin(&req_iter, &req_buf[req_fixed_len], req_len - req_fixed_len);
 		tlv_encode(&req_iter, &hash_record);
 
-		m_err_rpc_status = rpc_caller_invoke(m_caller, call_handle,
+		m_client.rpc_status = rpc_caller_invoke(m_client.caller, call_handle,
 					TS_CRYPTO_OPCODE_SIGN_HASH, &opstatus, &resp_buf, &resp_len);
 
-		if (m_err_rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (m_client.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -379,7 +380,7 @@
 			}
 		}
 
-		rpc_caller_end(m_caller, call_handle);
+		rpc_caller_end(m_client.caller, call_handle);
 	}
 
 	return psa_status;
@@ -412,7 +413,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(m_caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(m_client.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -427,12 +428,12 @@
 		tlv_encode(&req_iter, &hash_record);
 		tlv_encode(&req_iter, &sig_record);
 
-		m_err_rpc_status = rpc_caller_invoke(m_caller, call_handle,
+		m_client.rpc_status = rpc_caller_invoke(m_client.caller, call_handle,
 					TS_CRYPTO_OPCODE_VERIFY_HASH, &opstatus, &resp_buf, &resp_len);
 
-		if (m_err_rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
+		if (m_client.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
 
-		rpc_caller_end(m_caller, call_handle);
+		rpc_caller_end(m_client.caller, call_handle);
 	}
 
 	return psa_status;
@@ -470,7 +471,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(m_caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(m_client.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -485,10 +486,10 @@
 		tlv_encode(&req_iter, &plaintext_record);
 		if (salt) tlv_encode(&req_iter, &salt_record);
 
-		m_err_rpc_status = rpc_caller_invoke(m_caller, call_handle,
+		m_client.rpc_status = rpc_caller_invoke(m_client.caller, call_handle,
 					TS_CRYPTO_OPCODE_ASYMMETRIC_ENCRYPT, &opstatus, &resp_buf, &resp_len);
 
-		if (m_err_rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (m_client.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -518,7 +519,7 @@
 			}
 		}
 
-		rpc_caller_end(m_caller, call_handle);
+		rpc_caller_end(m_client.caller, call_handle);
 	}
 
 	return psa_status;
@@ -556,7 +557,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(m_caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(m_client.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -571,10 +572,10 @@
 		tlv_encode(&req_iter, &ciphertext_record);
 		if (salt) tlv_encode(&req_iter, &salt_record);
 
-		m_err_rpc_status = rpc_caller_invoke(m_caller, call_handle,
+		m_client.rpc_status = rpc_caller_invoke(m_client.caller, call_handle,
 					TS_CRYPTO_OPCODE_ASYMMETRIC_DECRYPT, &opstatus, &resp_buf, &resp_len);
 
-		if (m_err_rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (m_client.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -604,7 +605,7 @@
 			}
 		}
 
-		rpc_caller_end(m_caller, call_handle);
+		rpc_caller_end(m_client.caller, call_handle);
 	}
 
 	return psa_status;
@@ -621,7 +622,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(m_caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(m_client.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -631,10 +632,10 @@
 
 		memcpy(req_buf, &req_msg, req_len);
 
-		m_err_rpc_status = rpc_caller_invoke(m_caller, call_handle,
+		m_client.rpc_status = rpc_caller_invoke(m_client.caller, call_handle,
 				TS_CRYPTO_OPCODE_GENERATE_RANDOM, &opstatus, &resp_buf, &resp_len);
 
-		if (m_err_rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (m_client.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -663,7 +664,7 @@
 			}
 		}
 
-		rpc_caller_end(m_caller, call_handle);
+		rpc_caller_end(m_client.caller, call_handle);
 	}
 
 	return psa_status;
@@ -681,7 +682,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(m_caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(m_client.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -691,10 +692,10 @@
 
 		memcpy(req_buf, &req_msg, req_len);
 
-		m_err_rpc_status = rpc_caller_invoke(m_caller, call_handle,
+		m_client.rpc_status = rpc_caller_invoke(m_client.caller, call_handle,
 			TS_CRYPTO_OPCODE_HASH_SETUP, &opstatus, &resp_buf, &resp_len);
 
-		if (m_err_rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (m_client.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -713,7 +714,7 @@
 			}
 		}
 
-		rpc_caller_end(m_caller, call_handle);
+		rpc_caller_end(m_client.caller, call_handle);
 	}
 
 	return psa_status;
@@ -739,7 +740,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(m_caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(m_client.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -753,12 +754,12 @@
 		tlv_iterator_begin(&req_iter, &req_buf[req_fixed_len], req_len - req_fixed_len);
 		tlv_encode(&req_iter, &data_record);
 
-		m_err_rpc_status = rpc_caller_invoke(m_caller, call_handle,
+		m_client.rpc_status = rpc_caller_invoke(m_client.caller, call_handle,
 					TS_CRYPTO_OPCODE_HASH_UPDATE, &opstatus, &resp_buf, &resp_len);
 
-		if (m_err_rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
+		if (m_client.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
 
-		rpc_caller_end(m_caller, call_handle);
+		rpc_caller_end(m_client.caller, call_handle);
 	}
 
 	return psa_status;
@@ -778,7 +779,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(m_caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(m_client.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -788,10 +789,10 @@
 
 		memcpy(req_buf, &req_msg, req_fixed_len);
 
-		m_err_rpc_status = rpc_caller_invoke(m_caller, call_handle,
+		m_client.rpc_status = rpc_caller_invoke(m_client.caller, call_handle,
 					TS_CRYPTO_OPCODE_HASH_FINISH, &opstatus, &resp_buf, &resp_len);
 
-		if (m_err_rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (m_client.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -821,7 +822,7 @@
 			}
 		}
 
-		rpc_caller_end(m_caller, call_handle);
+		rpc_caller_end(m_client.caller, call_handle);
 	}
 
 	return psa_status;
diff --git a/components/service/crypto/client/cpp/protobuf/protobuf_crypto_client.cpp b/components/service/crypto/client/cpp/protobuf/protobuf_crypto_client.cpp
index 32acd4c..1823a4a 100644
--- a/components/service/crypto/client/cpp/protobuf/protobuf_crypto_client.cpp
+++ b/components/service/crypto/client/cpp/protobuf/protobuf_crypto_client.cpp
@@ -56,7 +56,7 @@
 		rpc_call_handle call_handle;
 		uint8_t *req_buf;
 
-		call_handle = rpc_caller_begin(m_caller, &req_buf, req_len);
+		call_handle = rpc_caller_begin(m_client.caller, &req_buf, req_len);
 
 		if (call_handle) {
 
@@ -67,10 +67,10 @@
 			pb_ostream_t ostream = pb_ostream_from_buffer(req_buf, req_len);
 			pb_encode(&ostream, ts_crypto_GenerateKeyIn_fields, &req_msg);
 
-			m_err_rpc_status = rpc_caller_invoke(m_caller, call_handle,
+			m_client.rpc_status = rpc_caller_invoke(m_client.caller, call_handle,
 				ts_crypto_Opcode_GENERATE_KEY, &opstatus, &resp_buf, &resp_len);
 
-			if (m_err_rpc_status == TS_RPC_CALL_ACCEPTED) {
+			if (m_client.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 				psa_status = opstatus;
 
@@ -90,7 +90,7 @@
 				}
 			}
 
-			rpc_caller_end(m_caller, call_handle);
+			rpc_caller_end(m_client.caller, call_handle);
 		}
 	}
 
@@ -110,7 +110,7 @@
 		rpc_call_handle call_handle;
 		uint8_t *req_buf;
 
-		call_handle = rpc_caller_begin(m_caller, &req_buf, req_len);
+		call_handle = rpc_caller_begin(m_client.caller, &req_buf, req_len);
 
 		if (call_handle) {
 
@@ -121,12 +121,12 @@
 			pb_ostream_t ostream = pb_ostream_from_buffer(req_buf, req_len);
 			pb_encode(&ostream, ts_crypto_DestroyKeyIn_fields, &req_msg);
 
-			m_err_rpc_status = rpc_caller_invoke(m_caller, call_handle,
+			m_client.rpc_status = rpc_caller_invoke(m_client.caller, call_handle,
 				ts_crypto_Opcode_DESTROY_KEY, &opstatus, &resp_buf, &resp_len);
 
-			if (m_err_rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
+			if (m_client.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
 
-			rpc_caller_end(m_caller, call_handle);
+			rpc_caller_end(m_client.caller, call_handle);
 		}
 	}
 
@@ -151,7 +151,7 @@
 		rpc_call_handle call_handle;
 		uint8_t *req_buf;
 
-		call_handle = rpc_caller_begin(m_caller, &req_buf, req_len);
+		call_handle = rpc_caller_begin(m_client.caller, &req_buf, req_len);
 
 		if (call_handle) {
 
@@ -162,10 +162,10 @@
 			pb_ostream_t ostream = pb_ostream_from_buffer(req_buf, req_len);
 			pb_encode(&ostream, ts_crypto_ImportKeyIn_fields, &req_msg);
 
-			m_err_rpc_status = rpc_caller_invoke(m_caller, call_handle,
+			m_client.rpc_status = rpc_caller_invoke(m_client.caller, call_handle,
 				ts_crypto_Opcode_IMPORT_KEY, &opstatus, &resp_buf, &resp_len);
 
-			if (m_err_rpc_status == TS_RPC_CALL_ACCEPTED) {
+			if (m_client.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 				psa_status = opstatus;
 
@@ -185,7 +185,7 @@
 				}
 			}
 
-			rpc_caller_end(m_caller, call_handle);
+			rpc_caller_end(m_client.caller, call_handle);
 		}
 	}
 
@@ -210,7 +210,7 @@
 		rpc_call_handle call_handle;
 		uint8_t *req_buf;
 
-		call_handle = rpc_caller_begin(m_caller, &req_buf, req_len);
+		call_handle = rpc_caller_begin(m_client.caller, &req_buf, req_len);
 
 		if (call_handle) {
 
@@ -221,10 +221,10 @@
 			pb_ostream_t ostream = pb_ostream_from_buffer(req_buf, req_len);
 			pb_encode(&ostream, ts_crypto_ExportKeyIn_fields, &req_msg);
 
-			m_err_rpc_status = rpc_caller_invoke(m_caller, call_handle,
+			m_client.rpc_status = rpc_caller_invoke(m_client.caller, call_handle,
 				ts_crypto_Opcode_EXPORT_KEY, &opstatus, &resp_buf, &resp_len);
 
-			if (m_err_rpc_status == TS_RPC_CALL_ACCEPTED) {
+			if (m_client.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 				psa_status = opstatus;
 
@@ -264,7 +264,7 @@
 				}
 			}
 
-			rpc_caller_end(m_caller, call_handle);
+			rpc_caller_end(m_client.caller, call_handle);
 		}
 	}
 
@@ -286,7 +286,7 @@
 		rpc_call_handle call_handle;
 		uint8_t *req_buf;
 
-		call_handle = rpc_caller_begin(m_caller, &req_buf, req_len);
+		call_handle = rpc_caller_begin(m_client.caller, &req_buf, req_len);
 
 		if (call_handle) {
 
@@ -297,10 +297,10 @@
 			pb_ostream_t ostream = pb_ostream_from_buffer(req_buf, req_len);
 			pb_encode(&ostream, ts_crypto_ExportPublicKeyIn_fields, &req_msg);
 
-			m_err_rpc_status = rpc_caller_invoke(m_caller, call_handle,
+			m_client.rpc_status = rpc_caller_invoke(m_client.caller, call_handle,
 				ts_crypto_Opcode_EXPORT_PUBLIC_KEY, &opstatus, &resp_buf, &resp_len);
 
-			if (m_err_rpc_status == TS_RPC_CALL_ACCEPTED) {
+			if (m_client.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 				psa_status = opstatus;
 
@@ -341,7 +341,7 @@
 				}
 			}
 
-			rpc_caller_end(m_caller, call_handle);
+			rpc_caller_end(m_client.caller, call_handle);
 		}
 	}
 
@@ -369,7 +369,7 @@
 		rpc_call_handle call_handle;
 		uint8_t *req_buf;
 
-		call_handle = rpc_caller_begin(m_caller, &req_buf, req_len);
+		call_handle = rpc_caller_begin(m_client.caller, &req_buf, req_len);
 
 		if (call_handle) {
 
@@ -380,10 +380,10 @@
 			pb_ostream_t ostream = pb_ostream_from_buffer(req_buf, req_len);
 			pb_encode(&ostream, ts_crypto_SignHashIn_fields, &req_msg);
 
-			m_err_rpc_status = rpc_caller_invoke(m_caller, call_handle,
+			m_client.rpc_status = rpc_caller_invoke(m_client.caller, call_handle,
 						ts_crypto_Opcode_SIGN_HASH, &opstatus, &resp_buf, &resp_len);
 
-			if (m_err_rpc_status == TS_RPC_CALL_ACCEPTED) {
+			if (m_client.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 				psa_status = opstatus;
 
@@ -418,7 +418,7 @@
 				}
 			}
 
-			rpc_caller_end(m_caller, call_handle);
+			rpc_caller_end(m_client.caller, call_handle);
 		}
 	}
 
@@ -450,7 +450,7 @@
 		rpc_call_handle call_handle;
 		uint8_t *req_buf;
 
-		call_handle = rpc_caller_begin(m_caller, &req_buf, req_len);
+		call_handle = rpc_caller_begin(m_client.caller, &req_buf, req_len);
 
 		if (call_handle) {
 
@@ -461,12 +461,12 @@
 			pb_ostream_t ostream = pb_ostream_from_buffer(req_buf, req_len);
 			pb_encode(&ostream, ts_crypto_VerifyHashIn_fields, &req_msg);
 
-			m_err_rpc_status = rpc_caller_invoke(m_caller, call_handle,
+			m_client.rpc_status = rpc_caller_invoke(m_client.caller, call_handle,
 						ts_crypto_Opcode_VERIFY_HASH, &opstatus, &resp_buf, &resp_len);
 
-			if (m_err_rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
+			if (m_client.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
 
-			rpc_caller_end(m_caller, call_handle);
+			rpc_caller_end(m_client.caller, call_handle);
 		}
 	}
 
@@ -501,7 +501,7 @@
 		rpc_call_handle call_handle;
 		uint8_t *req_buf;
 
-		call_handle = rpc_caller_begin(m_caller, &req_buf, req_len);
+		call_handle = rpc_caller_begin(m_client.caller, &req_buf, req_len);
 
 		if (call_handle) {
 
@@ -512,10 +512,10 @@
 			pb_ostream_t ostream = pb_ostream_from_buffer(req_buf, req_len);
 			pb_encode(&ostream, ts_crypto_AsymmetricEncryptIn_fields, &req_msg);
 
-			m_err_rpc_status = rpc_caller_invoke(m_caller, call_handle,
+			m_client.rpc_status = rpc_caller_invoke(m_client.caller, call_handle,
 						ts_crypto_Opcode_ASYMMETRIC_ENCRYPT, &opstatus, &resp_buf, &resp_len);
 
-			if (m_err_rpc_status == TS_RPC_CALL_ACCEPTED) {
+			if (m_client.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 				psa_status = opstatus;
 
@@ -550,7 +550,7 @@
 				}
 			}
 
-			rpc_caller_end(m_caller, call_handle);
+			rpc_caller_end(m_client.caller, call_handle);
 		}
 	}
 
@@ -585,7 +585,7 @@
 		rpc_call_handle call_handle;
 		uint8_t *req_buf;
 
-		call_handle = rpc_caller_begin(m_caller, &req_buf, req_len);
+		call_handle = rpc_caller_begin(m_client.caller, &req_buf, req_len);
 
 		if (call_handle) {
 
@@ -596,10 +596,10 @@
 			pb_ostream_t ostream = pb_ostream_from_buffer(req_buf, req_len);
 			pb_encode(&ostream, ts_crypto_AsymmetricDecryptIn_fields, &req_msg);
 
-			m_err_rpc_status = rpc_caller_invoke(m_caller, call_handle,
+			m_client.rpc_status = rpc_caller_invoke(m_client.caller, call_handle,
 						ts_crypto_Opcode_ASYMMETRIC_DECRYPT, &opstatus, &resp_buf, &resp_len);
 
-			if (m_err_rpc_status == TS_RPC_CALL_ACCEPTED) {
+			if (m_client.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 				psa_status = opstatus;
 
@@ -622,19 +622,19 @@
 						}
 						else {
 							/* Provided buffer is too small */
-							m_err_rpc_status = PSA_ERROR_BUFFER_TOO_SMALL;
+							m_client.rpc_status = PSA_ERROR_BUFFER_TOO_SMALL;
 						}
 					}
 					else {
 						/* Failed to decode response message */
-						m_err_rpc_status = PSA_ERROR_GENERIC_ERROR;
+						m_client.rpc_status = PSA_ERROR_GENERIC_ERROR;
 					}
 
 					::free(plaintext_byte_array);
 				}
 			}
 
-			rpc_caller_end(m_caller, call_handle);
+			rpc_caller_end(m_client.caller, call_handle);
 		}
 	}
 
@@ -657,7 +657,7 @@
 		rpc_call_handle call_handle;
 		uint8_t *req_buf;
 
-		call_handle = rpc_caller_begin(m_caller, &req_buf, req_len);
+		call_handle = rpc_caller_begin(m_client.caller, &req_buf, req_len);
 
 		if (call_handle) {
 
@@ -668,10 +668,10 @@
 			pb_ostream_t ostream = pb_ostream_from_buffer(req_buf, req_len);
 			pb_encode(&ostream, ts_crypto_GenerateRandomIn_fields, &req_msg);
 
-			m_err_rpc_status = rpc_caller_invoke(m_caller, call_handle,
+			m_client.rpc_status = rpc_caller_invoke(m_client.caller, call_handle,
 					ts_crypto_Opcode_GENERATE_RANDOM, &opstatus, &resp_buf, &resp_len);
 
-			if (m_err_rpc_status == TS_RPC_CALL_ACCEPTED) {
+			if (m_client.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 				psa_status = opstatus;
 
@@ -703,7 +703,7 @@
 				}
 			}
 
-			rpc_caller_end(m_caller, call_handle);
+			rpc_caller_end(m_client.caller, call_handle);
 		}
 	}
 
diff --git a/components/service/crypto/client/psa/psa_aead.c b/components/service/crypto/client/psa/psa_aead.c
index 45c32cc..6f92f4c 100644
--- a/components/service/crypto/client/psa/psa_aead.c
+++ b/components/service/crypto/client/psa/psa_aead.c
@@ -58,7 +58,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -68,11 +68,11 @@
 
 		memcpy(req_buf, &req_msg, req_len);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				opcode, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -91,7 +91,7 @@
 			}
 		}
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -127,7 +127,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -137,11 +137,11 @@
 
 		memcpy(req_buf, &req_msg, req_fixed_len);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_AEAD_GENERATE_NONCE, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -171,7 +171,7 @@
 			}
 		}
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -198,7 +198,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -212,13 +212,13 @@
 		tlv_iterator_begin(&req_iter, &req_buf[req_fixed_len], req_len - req_fixed_len);
 		tlv_encode(&req_iter, &data_record);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_AEAD_SET_NONCE, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -240,7 +240,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -250,13 +250,13 @@
 
 		memcpy(req_buf, &req_msg, req_fixed_len);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_AEAD_SET_LENGTHS, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -283,7 +283,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -297,13 +297,13 @@
 		tlv_iterator_begin(&req_iter, &req_buf[req_fixed_len], req_len - req_fixed_len);
 		tlv_encode(&req_iter, &data_record);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_AEAD_UPDATE_AD, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -334,7 +334,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -348,11 +348,11 @@
 		tlv_iterator_begin(&req_iter, &req_buf[req_fixed_len], req_len - req_fixed_len);
 		tlv_encode(&req_iter, &data_record);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_AEAD_UPDATE, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -382,7 +382,7 @@
 			}
 		}
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -408,7 +408,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -418,11 +418,11 @@
 
 		memcpy(req_buf, &req_msg, req_fixed_len);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_AEAD_FINISH, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -470,7 +470,7 @@
 			}
 		}
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -501,7 +501,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -515,11 +515,11 @@
 		tlv_iterator_begin(&req_iter, &req_buf[req_fixed_len], req_len - req_fixed_len);
 		tlv_encode(&req_iter, &data_record);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_AEAD_VERIFY, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -549,7 +549,7 @@
 			}
 		}
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -567,7 +567,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -577,13 +577,13 @@
 
 		memcpy(req_buf, &req_msg, req_fixed_len);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_AEAD_ABORT, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
diff --git a/components/service/crypto/client/psa/psa_asymmetric_decrypt.c b/components/service/crypto/client/psa/psa_asymmetric_decrypt.c
index abd8a7c..1b9300e 100644
--- a/components/service/crypto/client/psa/psa_asymmetric_decrypt.c
+++ b/components/service/crypto/client/psa/psa_asymmetric_decrypt.c
@@ -49,7 +49,7 @@
     rpc_call_handle call_handle;
     uint8_t *req_buf;
 
-    call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+    call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
     if (call_handle) {
 
@@ -64,11 +64,11 @@
         tlv_encode(&req_iter, &ciphertext_record);
         if (salt) tlv_encode(&req_iter, &salt_record);
 
-        psa_crypto_client_instance.rpc_status =
-            rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+        psa_crypto_client_instance.base.rpc_status =
+            rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
                     TS_CRYPTO_OPCODE_ASYMMETRIC_DECRYPT, &opstatus, &resp_buf, &resp_len);
 
-        if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+        if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
             psa_status = opstatus;
 
@@ -98,7 +98,7 @@
             }
         }
 
-        rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+        rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
     }
 
     return psa_status;
diff --git a/components/service/crypto/client/psa/psa_asymmetric_encrypt.c b/components/service/crypto/client/psa/psa_asymmetric_encrypt.c
index 22005fb..efe6c83 100644
--- a/components/service/crypto/client/psa/psa_asymmetric_encrypt.c
+++ b/components/service/crypto/client/psa/psa_asymmetric_encrypt.c
@@ -49,7 +49,7 @@
     rpc_call_handle call_handle;
     uint8_t *req_buf;
 
-    call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+    call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
     if (call_handle) {
 
@@ -64,11 +64,11 @@
         tlv_encode(&req_iter, &plaintext_record);
         if (salt) tlv_encode(&req_iter, &salt_record);
 
-        psa_crypto_client_instance.rpc_status =
-            rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+        psa_crypto_client_instance.base.rpc_status =
+            rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
                     TS_CRYPTO_OPCODE_ASYMMETRIC_ENCRYPT, &opstatus, &resp_buf, &resp_len);
 
-        if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+        if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
             psa_status = opstatus;
 
@@ -98,7 +98,7 @@
             }
         }
 
-        rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+        rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
     }
 
     return psa_status;
diff --git a/components/service/crypto/client/psa/psa_cipher.c b/components/service/crypto/client/psa/psa_cipher.c
index 85d4b9a..5621ad3 100644
--- a/components/service/crypto/client/psa/psa_cipher.c
+++ b/components/service/crypto/client/psa/psa_cipher.c
@@ -28,7 +28,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -38,11 +38,11 @@
 
 		memcpy(req_buf, &req_msg, req_len);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				opcode, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -61,7 +61,7 @@
 			}
 		}
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -97,7 +97,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -107,11 +107,11 @@
 
 		memcpy(req_buf, &req_msg, req_fixed_len);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_CIPHER_GENERATE_IV, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -141,7 +141,7 @@
 			}
 		}
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -168,7 +168,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -182,13 +182,13 @@
 		tlv_iterator_begin(&req_iter, &req_buf[req_fixed_len], req_len - req_fixed_len);
 		tlv_encode(&req_iter, &data_record);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_CIPHER_SET_IV, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -219,7 +219,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -233,11 +233,11 @@
 		tlv_iterator_begin(&req_iter, &req_buf[req_fixed_len], req_len - req_fixed_len);
 		tlv_encode(&req_iter, &data_record);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_CIPHER_UPDATE, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -267,7 +267,7 @@
 			}
 		}
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -289,7 +289,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -299,11 +299,11 @@
 
 		memcpy(req_buf, &req_msg, req_fixed_len);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_CIPHER_FINISH, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -333,7 +333,7 @@
 			}
 		}
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -351,7 +351,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -361,13 +361,13 @@
 
 		memcpy(req_buf, &req_msg, req_fixed_len);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_CIPHER_ABORT, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
diff --git a/components/service/crypto/client/psa/psa_copy_key.c b/components/service/crypto/client/psa/psa_copy_key.c
index 3f3c46f..2919a0e 100644
--- a/components/service/crypto/client/psa/psa_copy_key.c
+++ b/components/service/crypto/client/psa/psa_copy_key.c
@@ -33,7 +33,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -43,11 +43,11 @@
 
 		memcpy(req_buf, &req_msg, req_len);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 						TS_CRYPTO_OPCODE_COPY_KEY, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -66,7 +66,7 @@
 			}
 		}
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
diff --git a/components/service/crypto/client/psa/psa_crypto_client.c b/components/service/crypto/client/psa/psa_crypto_client.c
index 834b5e6..bda68e9 100644
--- a/components/service/crypto/client/psa/psa_crypto_client.c
+++ b/components/service/crypto/client/psa/psa_crypto_client.c
@@ -10,7 +10,7 @@
 /* The singleton psa_crypto_client state */
 struct psa_crypto_client psa_crypto_client_instance = {
 
-	.caller = NULL,
+	.base.caller = NULL,
 
 	/* To conform to PSA API, psa_crypto_init needs to be called.
 	 * This state variable is used enforces this.
@@ -21,7 +21,7 @@
 psa_status_t psa_crypto_init(void) {
 
 	/* Must be called after psa_crypto_client_init */
-	if (psa_crypto_client_instance.caller) {
+	if (psa_crypto_client_instance.base.caller) {
 
 		psa_crypto_client_instance.init_status = PSA_SUCCESS;
 	}
@@ -31,17 +31,16 @@
 
 psa_status_t psa_crypto_client_init(struct rpc_caller *caller)
 {
-	psa_crypto_client_instance.caller = caller;
-	return PSA_SUCCESS;
+	return service_client_init(&psa_crypto_client_instance.base, caller);
 }
 
 void psa_crypto_client_deinit(void)
 {
-	psa_crypto_client_instance.caller = NULL;
+	service_client_deinit(&psa_crypto_client_instance.base);
 	psa_crypto_client_instance.init_status = PSA_ERROR_BAD_STATE;
 }
 
 int psa_crypto_client_rpc_status(void)
 {
-	return psa_crypto_client_instance.rpc_status;
+	return psa_crypto_client_instance.base.rpc_status;
 }
diff --git a/components/service/crypto/client/psa/psa_crypto_client.h b/components/service/crypto/client/psa/psa_crypto_client.h
index 688ab85..d8ae1cb 100644
--- a/components/service/crypto/client/psa/psa_crypto_client.h
+++ b/components/service/crypto/client/psa/psa_crypto_client.h
@@ -9,6 +9,7 @@
 
 #include <psa/error.h>
 #include <rpc_caller.h>
+#include <service/common/client/service_client.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -18,13 +19,11 @@
  * @brief      The singleton psa_crypto_client state
  *
  * The psa crypto C API assumes a single instance of the backend provider.  This
- * structure defines the state used by the psa_cryypto_client that communicates
- * with a remote provider using the provided rpc caller.
+ * structure extends the base service client.
  */
 struct psa_crypto_client
 {
-    struct rpc_caller *caller;
-    int rpc_status;
+    struct service_client base;
     psa_status_t init_status;
 };
 
diff --git a/components/service/crypto/client/psa/psa_destroy_key.c b/components/service/crypto/client/psa/psa_destroy_key.c
index 28bd5ab..829a560 100644
--- a/components/service/crypto/client/psa/psa_destroy_key.c
+++ b/components/service/crypto/client/psa/psa_destroy_key.c
@@ -26,7 +26,7 @@
     rpc_call_handle call_handle;
     uint8_t *req_buf;
 
-    call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+    call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
     if (call_handle) {
 
@@ -36,13 +36,13 @@
 
         memcpy(req_buf, &req_msg, req_len);
 
-        psa_crypto_client_instance.rpc_status =
-            rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+        psa_crypto_client_instance.base.rpc_status =
+            rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
                         TS_CRYPTO_OPCODE_DESTROY_KEY, &opstatus, &resp_buf, &resp_len);
 
-        if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
+        if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
 
-        rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+        rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
     }
 
     return psa_status;
diff --git a/components/service/crypto/client/psa/psa_export_key.c b/components/service/crypto/client/psa/psa_export_key.c
index d5c2181..420553b 100644
--- a/components/service/crypto/client/psa/psa_export_key.c
+++ b/components/service/crypto/client/psa/psa_export_key.c
@@ -33,7 +33,7 @@
     rpc_call_handle call_handle;
     uint8_t *req_buf;
 
-    call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+    call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
     if (call_handle) {
 
@@ -43,11 +43,11 @@
 
         memcpy(req_buf, &req_msg, req_len);
 
-        psa_crypto_client_instance.rpc_status =
-            rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+        psa_crypto_client_instance.base.rpc_status =
+            rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
                     TS_CRYPTO_OPCODE_EXPORT_KEY, &opstatus, &resp_buf, &resp_len);
 
-        if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+        if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
             psa_status = opstatus;
 
@@ -77,7 +77,7 @@
             }
         }
 
-        rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+        rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
     }
 
     return psa_status;
diff --git a/components/service/crypto/client/psa/psa_export_public_key.c b/components/service/crypto/client/psa/psa_export_public_key.c
index 7528ff9..ad1344c 100644
--- a/components/service/crypto/client/psa/psa_export_public_key.c
+++ b/components/service/crypto/client/psa/psa_export_public_key.c
@@ -31,7 +31,7 @@
     rpc_call_handle call_handle;
     uint8_t *req_buf;
 
-    call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+    call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
     if (call_handle) {
 
@@ -41,11 +41,11 @@
 
         memcpy(req_buf, &req_msg, req_len);
 
-        psa_crypto_client_instance.rpc_status =
-            rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+        psa_crypto_client_instance.base.rpc_status =
+            rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
                 TS_CRYPTO_OPCODE_EXPORT_PUBLIC_KEY, &opstatus, &resp_buf, &resp_len);
 
-        if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+        if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
             psa_status = opstatus;
 
@@ -75,7 +75,7 @@
             }
         }
 
-        rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+        rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
     }
 
     return psa_status;
diff --git a/components/service/crypto/client/psa/psa_generate_key.c b/components/service/crypto/client/psa/psa_generate_key.c
index 1b76c87..5604020 100644
--- a/components/service/crypto/client/psa/psa_generate_key.c
+++ b/components/service/crypto/client/psa/psa_generate_key.c
@@ -32,7 +32,7 @@
     rpc_call_handle call_handle;
     uint8_t *req_buf;
 
-    call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+    call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
     if (call_handle) {
 
@@ -42,11 +42,11 @@
 
         memcpy(req_buf, &req_msg, req_len);
 
-        psa_crypto_client_instance.rpc_status =
-            rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+        psa_crypto_client_instance.base.rpc_status =
+            rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
                         TS_CRYPTO_OPCODE_GENERATE_KEY, &opstatus, &resp_buf, &resp_len);
 
-        if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+        if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
             psa_status = opstatus;
 
@@ -65,7 +65,7 @@
             }
         }
 
-        rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+        rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
     }
 
     return psa_status;
diff --git a/components/service/crypto/client/psa/psa_generate_random.c b/components/service/crypto/client/psa/psa_generate_random.c
index 92915db..a942191 100644
--- a/components/service/crypto/client/psa/psa_generate_random.c
+++ b/components/service/crypto/client/psa/psa_generate_random.c
@@ -26,7 +26,7 @@
     rpc_call_handle call_handle;
     uint8_t *req_buf;
 
-    call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+    call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
     if (call_handle) {
 
@@ -36,11 +36,11 @@
 
         memcpy(req_buf, &req_msg, req_len);
 
-        psa_crypto_client_instance.rpc_status =
-            rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+        psa_crypto_client_instance.base.rpc_status =
+            rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
                     TS_CRYPTO_OPCODE_GENERATE_RANDOM, &opstatus, &resp_buf, &resp_len);
 
-        if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+        if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
             psa_status = opstatus;
 
@@ -69,7 +69,7 @@
             }
         }
 
-        rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+        rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
     }
 
     return psa_status;
diff --git a/components/service/crypto/client/psa/psa_get_key_attributes.c b/components/service/crypto/client/psa/psa_get_key_attributes.c
index cd45d24..35e3ed4 100644
--- a/components/service/crypto/client/psa/psa_get_key_attributes.c
+++ b/components/service/crypto/client/psa/psa_get_key_attributes.c
@@ -28,7 +28,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -38,11 +38,11 @@
 
 		memcpy(req_buf, &req_msg, req_len);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 						TS_CRYPTO_OPCODE_GET_KEY_ATTRIBUTES, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -62,7 +62,7 @@
 			}
 		}
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
diff --git a/components/service/crypto/client/psa/psa_hash.c b/components/service/crypto/client/psa/psa_hash.c
index 972d378..b66d00f 100644
--- a/components/service/crypto/client/psa/psa_hash.c
+++ b/components/service/crypto/client/psa/psa_hash.c
@@ -25,7 +25,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -35,11 +35,11 @@
 
 		memcpy(req_buf, &req_msg, req_len);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_HASH_SETUP, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -58,7 +58,7 @@
 			}
 		}
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -85,7 +85,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -99,13 +99,13 @@
 		tlv_iterator_begin(&req_iter, &req_buf[req_fixed_len], req_len - req_fixed_len);
 		tlv_encode(&req_iter, &data_record);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_HASH_UPDATE, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -127,7 +127,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -137,11 +137,11 @@
 
 		memcpy(req_buf, &req_msg, req_fixed_len);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_HASH_FINISH, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -171,7 +171,7 @@
 			}
 		}
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -189,7 +189,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -199,13 +199,13 @@
 
 		memcpy(req_buf, &req_msg, req_fixed_len);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_HASH_ABORT, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -232,7 +232,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -246,13 +246,13 @@
 		tlv_iterator_begin(&req_iter, &req_buf[req_fixed_len], req_len - req_fixed_len);
 		tlv_encode(&req_iter, &data_record);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_HASH_VERIFY, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -271,7 +271,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -281,11 +281,11 @@
 
 		memcpy(req_buf, &req_msg, req_fixed_len);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_HASH_CLONE, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -304,7 +304,7 @@
 			}
 		}
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
diff --git a/components/service/crypto/client/psa/psa_import_key.c b/components/service/crypto/client/psa/psa_import_key.c
index ad2346e..fcbb745 100644
--- a/components/service/crypto/client/psa/psa_import_key.c
+++ b/components/service/crypto/client/psa/psa_import_key.c
@@ -40,7 +40,7 @@
     rpc_call_handle call_handle;
     uint8_t *req_buf;
 
-    call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+    call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
     if (call_handle) {
 
@@ -54,11 +54,11 @@
         tlv_iterator_begin(&req_iter, &req_buf[req_fixed_len], req_len - req_fixed_len);
         tlv_encode(&req_iter, &key_record);
 
-        psa_crypto_client_instance.rpc_status =
-            rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+        psa_crypto_client_instance.base.rpc_status =
+            rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
                         TS_CRYPTO_OPCODE_IMPORT_KEY, &opstatus, &resp_buf, &resp_len);
 
-        if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+        if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
             psa_status = opstatus;
 
@@ -77,7 +77,7 @@
             }
         }
 
-        rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+        rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
     }
 
     return psa_status;
diff --git a/components/service/crypto/client/psa/psa_key_derivation.c b/components/service/crypto/client/psa/psa_key_derivation.c
index e518f5a..9127861 100644
--- a/components/service/crypto/client/psa/psa_key_derivation.c
+++ b/components/service/crypto/client/psa/psa_key_derivation.c
@@ -27,7 +27,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -37,11 +37,11 @@
 
 		memcpy(req_buf, &req_msg, req_len);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_KEY_DERIVATION_SETUP, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -60,7 +60,7 @@
 			}
 		}
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -79,7 +79,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -89,11 +89,11 @@
 
 		memcpy(req_buf, &req_msg, req_len);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_KEY_DERIVATION_GET_CAPACITY, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -112,7 +112,7 @@
 			}
 		}
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -132,7 +132,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -142,13 +142,13 @@
 
 		memcpy(req_buf, &req_msg, req_len);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_KEY_DERIVATION_SET_CAPACITY, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -178,7 +178,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -192,13 +192,13 @@
 		tlv_iterator_begin(&req_iter, &req_buf[req_fixed_len], req_len - req_fixed_len);
 		tlv_encode(&req_iter, &data_record);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_KEY_DERIVATION_INPUT_BYTES, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -220,7 +220,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -230,13 +230,13 @@
 
 		memcpy(req_buf, &req_msg, req_len);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_KEY_DERIVATION_INPUT_KEY, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -258,7 +258,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -268,11 +268,11 @@
 
 		memcpy(req_buf, &req_msg, req_fixed_len);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_KEY_DERIVATION_OUTPUT_BYTES, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -301,7 +301,7 @@
 			}
 		}
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -325,7 +325,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -335,11 +335,11 @@
 
 		memcpy(req_buf, &req_msg, req_len);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_KEY_DERIVATION_OUTPUT_KEY, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -359,7 +359,7 @@
 			}
 		}
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -378,7 +378,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -388,13 +388,13 @@
 
 		memcpy(req_buf, &req_msg, req_fixed_len);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_KEY_DERIVATION_ABORT, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -426,7 +426,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -440,13 +440,13 @@
 		tlv_iterator_begin(&req_iter, &req_buf[req_fixed_len], req_len - req_fixed_len);
 		tlv_encode(&req_iter, &data_record);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_KEY_DERIVATION_KEY_AGREEMENT, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -478,7 +478,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -492,11 +492,11 @@
 		tlv_iterator_begin(&req_iter, &req_buf[req_fixed_len], req_len - req_fixed_len);
 		tlv_encode(&req_iter, &data_record);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_KEY_DERIVATION_RAW_KEY_AGREEMENT, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -526,7 +526,7 @@
 			}
 		}
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
diff --git a/components/service/crypto/client/psa/psa_mac.c b/components/service/crypto/client/psa/psa_mac.c
index 9844ec6..6423ea5 100644
--- a/components/service/crypto/client/psa/psa_mac.c
+++ b/components/service/crypto/client/psa/psa_mac.c
@@ -28,7 +28,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -38,11 +38,11 @@
 
 		memcpy(req_buf, &req_msg, req_len);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				opcode, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -61,7 +61,7 @@
 			}
 		}
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -102,7 +102,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -116,13 +116,13 @@
 		tlv_iterator_begin(&req_iter, &req_buf[req_fixed_len], req_len - req_fixed_len);
 		tlv_encode(&req_iter, &data_record);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_MAC_UPDATE, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -144,7 +144,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -154,11 +154,11 @@
 
 		memcpy(req_buf, &req_msg, req_fixed_len);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_MAC_SIGN_FINISH, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
 			psa_status = opstatus;
 
@@ -188,7 +188,7 @@
 			}
 		}
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -215,7 +215,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -229,13 +229,13 @@
 		tlv_iterator_begin(&req_iter, &req_buf[req_fixed_len], req_len - req_fixed_len);
 		tlv_encode(&req_iter, &data_record);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_MAC_VERIFY_FINISH, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
@@ -253,7 +253,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -263,13 +263,13 @@
 
 		memcpy(req_buf, &req_msg, req_fixed_len);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 				TS_CRYPTO_OPCODE_MAC_ABORT, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
diff --git a/components/service/crypto/client/psa/psa_purge_key.c b/components/service/crypto/client/psa/psa_purge_key.c
index 39c4d02..f000e51 100644
--- a/components/service/crypto/client/psa/psa_purge_key.c
+++ b/components/service/crypto/client/psa/psa_purge_key.c
@@ -26,7 +26,7 @@
 	rpc_call_handle call_handle;
 	uint8_t *req_buf;
 
-	call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+	call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
 	if (call_handle) {
 
@@ -36,13 +36,13 @@
 
 		memcpy(req_buf, &req_msg, req_len);
 
-		psa_crypto_client_instance.rpc_status =
-			rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+		psa_crypto_client_instance.base.rpc_status =
+			rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
 						TS_CRYPTO_OPCODE_PURGE_KEY, &opstatus, &resp_buf, &resp_len);
 
-		if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
+		if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
 
-		rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+		rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
 	}
 
 	return psa_status;
diff --git a/components/service/crypto/client/psa/psa_sign_hash.c b/components/service/crypto/client/psa/psa_sign_hash.c
index 810f5f2..d310a02 100644
--- a/components/service/crypto/client/psa/psa_sign_hash.c
+++ b/components/service/crypto/client/psa/psa_sign_hash.c
@@ -38,7 +38,7 @@
     rpc_call_handle call_handle;
     uint8_t *req_buf;
 
-    call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+    call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
     if (call_handle) {
 
@@ -52,11 +52,11 @@
         tlv_iterator_begin(&req_iter, &req_buf[req_fixed_len], req_len - req_fixed_len);
         tlv_encode(&req_iter, &hash_record);
 
-        psa_crypto_client_instance.rpc_status =
-            rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+        psa_crypto_client_instance.base.rpc_status =
+            rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
                         TS_CRYPTO_OPCODE_SIGN_HASH, &opstatus, &resp_buf, &resp_len);
 
-        if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) {
+        if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
             psa_status = opstatus;
 
@@ -86,7 +86,7 @@
             }
         }
 
-        rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+        rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
     }
 
     return psa_status;
diff --git a/components/service/crypto/client/psa/psa_verify_hash.c b/components/service/crypto/client/psa/psa_verify_hash.c
index 4f74737..accd9cd 100644
--- a/components/service/crypto/client/psa/psa_verify_hash.c
+++ b/components/service/crypto/client/psa/psa_verify_hash.c
@@ -43,7 +43,7 @@
     rpc_call_handle call_handle;
     uint8_t *req_buf;
 
-    call_handle = rpc_caller_begin(psa_crypto_client_instance.caller, &req_buf, req_len);
+    call_handle = rpc_caller_begin(psa_crypto_client_instance.base.caller, &req_buf, req_len);
 
     if (call_handle) {
 
@@ -58,13 +58,13 @@
         tlv_encode(&req_iter, &hash_record);
         tlv_encode(&req_iter, &sig_record);
 
-        psa_crypto_client_instance.rpc_status =
-            rpc_caller_invoke(psa_crypto_client_instance.caller, call_handle,
+        psa_crypto_client_instance.base.rpc_status =
+            rpc_caller_invoke(psa_crypto_client_instance.base.caller, call_handle,
                     TS_CRYPTO_OPCODE_VERIFY_HASH, &opstatus, &resp_buf, &resp_len);
 
-        if (psa_crypto_client_instance.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
+        if (psa_crypto_client_instance.base.rpc_status == TS_RPC_CALL_ACCEPTED) psa_status = opstatus;
 
-        rpc_caller_end(psa_crypto_client_instance.caller, call_handle);
+        rpc_caller_end(psa_crypto_client_instance.base.caller, call_handle);
     }
 
     return psa_status;
diff --git a/components/service/crypto/test/service/psa_crypto_api/psa_crypto_api_client.cpp b/components/service/crypto/test/service/psa_crypto_api/psa_crypto_api_client.cpp
index 3ab5a51..4263532 100644
--- a/components/service/crypto/test/service/psa_crypto_api/psa_crypto_api_client.cpp
+++ b/components/service/crypto/test/service/psa_crypto_api/psa_crypto_api_client.cpp
@@ -22,7 +22,7 @@
 psa_status_t psa_crypto_api_client::generate_key(const psa_key_attributes_t *attributes, psa_key_id_t *id)
 {
 	psa_status_t psa_status = psa_generate_key(attributes, id);
-	m_err_rpc_status = psa_crypto_client_rpc_status();
+	m_client.rpc_status = psa_crypto_client_rpc_status();
 
 	return psa_status;
 }
@@ -30,7 +30,7 @@
 psa_status_t psa_crypto_api_client::destroy_key(psa_key_id_t id)
 {
 	psa_status_t psa_status = psa_destroy_key(id);
-	m_err_rpc_status = psa_crypto_client_rpc_status();
+	m_client.rpc_status = psa_crypto_client_rpc_status();
 
 	return psa_status;
 }
@@ -39,7 +39,7 @@
 						const uint8_t *data, size_t data_length, psa_key_id_t *id)
 {
 	psa_status_t psa_status = psa_import_key(attributes, data, data_length, id);
-	m_err_rpc_status = psa_crypto_client_rpc_status();
+	m_client.rpc_status = psa_crypto_client_rpc_status();
 
 	return psa_status;
 }
@@ -49,7 +49,7 @@
 						size_t *data_length)
 {
 	psa_status_t psa_status = psa_export_key(id, data, data_size, data_length);
-	m_err_rpc_status = psa_crypto_client_rpc_status();
+	m_client.rpc_status = psa_crypto_client_rpc_status();
 
 	return psa_status;
 }
@@ -58,7 +58,7 @@
 								uint8_t *data, size_t data_size, size_t *data_length)
 {
 	psa_status_t psa_status = psa_export_public_key(id, data, data_size, data_length);
-	m_err_rpc_status = psa_crypto_client_rpc_status();
+	m_client.rpc_status = psa_crypto_client_rpc_status();
 
 	return psa_status;
 }
@@ -69,7 +69,7 @@
 {
 	psa_status_t psa_status = psa_sign_hash(id, alg, hash, hash_length,
 									signature, signature_size, signature_length);
-	m_err_rpc_status = psa_crypto_client_rpc_status();
+	m_client.rpc_status = psa_crypto_client_rpc_status();
 
 	return psa_status;
 }
@@ -81,7 +81,7 @@
 {
 	psa_status_t psa_status = psa_verify_hash(id, alg, hash, hash_length,
 									signature, signature_length);
-	m_err_rpc_status = psa_crypto_client_rpc_status();
+	m_client.rpc_status = psa_crypto_client_rpc_status();
 
 	return psa_status;
 }
@@ -94,7 +94,7 @@
 	psa_status_t psa_status = psa_asymmetric_encrypt(id, alg, input, input_length,
 												salt, salt_length,
 												output, output_size, output_length);
-	m_err_rpc_status = psa_crypto_client_rpc_status();
+	m_client.rpc_status = psa_crypto_client_rpc_status();
 
 	return psa_status;
 }
@@ -107,7 +107,7 @@
 	psa_status_t psa_status = psa_asymmetric_decrypt(id, alg, input, input_length,
 												salt, salt_length,
 												output, output_size, output_length);
-	m_err_rpc_status = psa_crypto_client_rpc_status();
+	m_client.rpc_status = psa_crypto_client_rpc_status();
 
 	return psa_status;
 }
@@ -115,7 +115,7 @@
 psa_status_t psa_crypto_api_client::generate_random(uint8_t *output, size_t output_size)
 {
 	psa_status_t psa_status = psa_generate_random(output, output_size);
-	m_err_rpc_status = psa_crypto_client_rpc_status();
+	m_client.rpc_status = psa_crypto_client_rpc_status();
 
 	return psa_status;
 }
@@ -127,7 +127,7 @@
 	psa_status_t psa_status = psa_hash_setup(&op, alg);
 
 	*op_handle = op.handle;
-	m_err_rpc_status = psa_crypto_client_rpc_status();
+	m_client.rpc_status = psa_crypto_client_rpc_status();
 
 	return psa_status;
 }
@@ -139,7 +139,7 @@
 	op.handle = op_handle;
 
 	psa_status_t psa_status = psa_hash_update(&op, input, input_length);
-	m_err_rpc_status = psa_crypto_client_rpc_status();
+	m_client.rpc_status = psa_crypto_client_rpc_status();
 
 	return psa_status;
 }
@@ -151,7 +151,7 @@
 	op.handle = op_handle;
 
 	psa_status_t psa_status = psa_hash_finish(&op, hash, hash_size, hash_length);
-	m_err_rpc_status = psa_crypto_client_rpc_status();
+	m_client.rpc_status = psa_crypto_client_rpc_status();
 
 	return psa_status;
 }
diff --git a/components/service/secure_storage/backend/secure_storage_client/secure_storage_client.c b/components/service/secure_storage/backend/secure_storage_client/secure_storage_client.c
index fcbc996..555a866 100644
--- a/components/service/secure_storage/backend/secure_storage_client/secure_storage_client.c
+++ b/components/service/secure_storage/backend/secure_storage_client/secure_storage_client.c
@@ -25,9 +25,10 @@
 	size_t response_length = 0;
 	struct secure_storage_request_set *request_desc;
 	rpc_call_handle handle;
-	rpc_status_t rpc_status = TS_RPC_CALL_ACCEPTED;
 	psa_status_t psa_status = PSA_SUCCESS;
 
+	this_context->client.rpc_status = TS_RPC_CALL_ACCEPTED;
+
 	(void)client_id;
 
 	/* Validating input parameters */
@@ -40,7 +41,7 @@
 		return PSA_ERROR_INVALID_ARGUMENT;
 	}
 
-	handle = rpc_caller_begin(this_context->rpc_caller, &request, request_length);
+	handle = rpc_caller_begin(this_context->client.caller, &request, request_length);
 
 	if (handle) {
 		/* Populating request descriptor */
@@ -50,17 +51,18 @@
 		request_desc->create_flags = create_flags;
 		memcpy(&request_desc->p_data, p_data, data_length);
 
-		rpc_status = rpc_caller_invoke(this_context->rpc_caller, handle,
+		this_context->client.rpc_status = rpc_caller_invoke(this_context->client.caller,
+						handle,
 						TS_SECURE_STORAGE_OPCODE_SET,
 						(uint32_t *)&psa_status, &response,
 						&response_length);
 
-		if (rpc_status != TS_RPC_CALL_ACCEPTED) {
+		if (this_context->client.rpc_status != TS_RPC_CALL_ACCEPTED) {
 			/* RPC failure */
 			psa_status = PSA_ERROR_GENERIC_ERROR;
 		}
 
-		rpc_caller_end(this_context->rpc_caller, handle);
+		rpc_caller_end(this_context->client.caller, handle);
 	}
 	else {
 		psa_status = PSA_ERROR_GENERIC_ERROR;
@@ -83,16 +85,17 @@
 	size_t response_length = 0;
 	struct secure_storage_request_get *request_desc;
 	rpc_call_handle handle;
-	rpc_status_t rpc_status = TS_RPC_CALL_ACCEPTED;
 	psa_status_t psa_status = PSA_SUCCESS;
 
+	this_context->client.rpc_status = TS_RPC_CALL_ACCEPTED;
+
 	(void)client_id;
 
 	/* Validating input parameters */
 	if (p_data == NULL)
 		return PSA_ERROR_INVALID_ARGUMENT;
 
-	handle = rpc_caller_begin(this_context->rpc_caller, &request, sizeof(*request_desc));
+	handle = rpc_caller_begin(this_context->client.caller, &request, sizeof(*request_desc));
 
 	if (handle) {
 		/* Populating request descriptor */
@@ -101,12 +104,13 @@
 		request_desc->data_offset = data_offset;
 		request_desc->data_size = data_size;
 
-		rpc_status = rpc_caller_invoke(this_context->rpc_caller, handle,
+		this_context->client.rpc_status = rpc_caller_invoke(this_context->client.caller,
+						handle,
 						TS_SECURE_STORAGE_OPCODE_GET,
 						(uint32_t *)&psa_status, &response,
 						&response_length);
 
-		if (rpc_status != TS_RPC_CALL_ACCEPTED ) {
+		if (this_context->client.rpc_status != TS_RPC_CALL_ACCEPTED ) {
 			/* RPC failure */
 			psa_status = PSA_ERROR_GENERIC_ERROR;
 		}
@@ -117,7 +121,7 @@
 			memcpy(p_data, response, *p_data_length);
 		}
 
-		rpc_caller_end(this_context->rpc_caller, handle);
+		rpc_caller_end(this_context->client.caller, handle);
 	}
 	else {
 		psa_status = PSA_ERROR_GENERIC_ERROR;
@@ -138,7 +142,6 @@
 	struct secure_storage_request_get_info *request_desc;
 	struct secure_storage_response_get_info *response_desc;
 	rpc_call_handle handle;
-	rpc_status_t rpc_status;
 	psa_status_t psa_status = PSA_ERROR_GENERIC_ERROR;
 
 	(void)client_id;
@@ -147,19 +150,19 @@
 	if (p_info == NULL)
 		return PSA_ERROR_INVALID_ARGUMENT;
 
-	handle = rpc_caller_begin(this_context->rpc_caller, &request, sizeof(*request_desc));
+	handle = rpc_caller_begin(this_context->client.caller, &request, sizeof(*request_desc));
 
 	if (handle) {
 		/* Populating request descriptor */
 		request_desc = (struct secure_storage_request_get_info *)request;
 		request_desc->uid = uid;
 
-		rpc_status = rpc_caller_invoke(this_context->rpc_caller, handle,
+		this_context->client.rpc_status = rpc_caller_invoke(this_context->client.caller, handle,
 						TS_SECURE_STORAGE_OPCODE_GET_INFO,
 						(uint32_t *)&psa_status, &response,
 						&response_length);
 
-		if (rpc_status != TS_RPC_CALL_ACCEPTED) {
+		if (this_context->client.rpc_status != TS_RPC_CALL_ACCEPTED) {
 			/* RPC failure */
 			psa_status = PSA_ERROR_GENERIC_ERROR;
 		} else if (response_length && response_length != sizeof(*response_desc)) {
@@ -177,7 +180,7 @@
 			p_info->flags = PSA_STORAGE_FLAG_NONE;
 		}
 
-		rpc_caller_end(this_context->rpc_caller, handle);
+		rpc_caller_end(this_context->client.caller, handle);
 	}
 	else {
 		psa_status = PSA_ERROR_GENERIC_ERROR;
@@ -196,29 +199,31 @@
 	size_t response_length = 0;
 	struct secure_storage_request_remove *request_desc;
 	rpc_call_handle handle;
-	rpc_status_t rpc_status = TS_RPC_CALL_ACCEPTED;
 	psa_status_t psa_status = PSA_SUCCESS;
 
+	this_context->client.rpc_status = TS_RPC_CALL_ACCEPTED;
+
 	(void)client_id;
 
-	handle = rpc_caller_begin(this_context->rpc_caller, &request, sizeof(*request_desc));
+	handle = rpc_caller_begin(this_context->client.caller, &request, sizeof(*request_desc));
 
 	if (handle) {
 		/* Populating request descriptor */
 		request_desc = (struct secure_storage_request_remove *)request;
 		request_desc->uid = uid;
 
-		rpc_status = rpc_caller_invoke(this_context->rpc_caller, handle,
+		this_context->client.rpc_status = rpc_caller_invoke(this_context->client.caller,
+						handle,
 						TS_SECURE_STORAGE_OPCODE_REMOVE,
 						(uint32_t *)&psa_status, &response,
 						&response_length);
 
-		if (rpc_status != TS_RPC_CALL_ACCEPTED) {
+		if (this_context->client.rpc_status != TS_RPC_CALL_ACCEPTED) {
 			/* RPC failure */
 			psa_status = PSA_ERROR_GENERIC_ERROR;
 		}
 
-		rpc_caller_end(this_context->rpc_caller, handle);
+		rpc_caller_end(this_context->client.caller, handle);
 	}
 	else {
 		psa_status = PSA_ERROR_GENERIC_ERROR;
@@ -240,14 +245,15 @@
 	size_t response_length = 0;
 	struct secure_storage_request_create *request_desc;
 	rpc_call_handle handle;
-	rpc_status_t rpc_status = TS_RPC_CALL_ACCEPTED;
 	psa_status_t psa_status = PSA_SUCCESS;
 
+	this_context->client.rpc_status = TS_RPC_CALL_ACCEPTED;
+
 	(void)client_id;
 
 	request_length = sizeof(*request_desc);
 
-	handle = rpc_caller_begin(this_context->rpc_caller, &request, request_length);
+	handle = rpc_caller_begin(this_context->client.caller, &request, request_length);
 
 	if (handle) {
 
@@ -256,17 +262,18 @@
 		request_desc->capacity = capacity;
 		request_desc->create_flags = create_flags;
 
-		rpc_status = rpc_caller_invoke(this_context->rpc_caller, handle,
+		this_context->client.rpc_status = rpc_caller_invoke(this_context->client.caller,
+						handle,
 						TS_SECURE_STORAGE_OPCODE_CREATE,
 						(uint32_t *)&psa_status, &response,
 						&response_length);
 
-		if (rpc_status != TS_RPC_CALL_ACCEPTED) {
+		if (this_context->client.rpc_status != TS_RPC_CALL_ACCEPTED) {
 			/* RPC failure */
 			psa_status = PSA_ERROR_GENERIC_ERROR;
 		}
 
-		rpc_caller_end(this_context->rpc_caller, handle);
+		rpc_caller_end(this_context->client.caller, handle);
 	}
 	else {
 		psa_status = PSA_ERROR_GENERIC_ERROR;
@@ -289,9 +296,10 @@
 	size_t response_length = 0;
 	struct secure_storage_request_set_extended *request_desc;
 	rpc_call_handle handle;
-	rpc_status_t rpc_status = TS_RPC_CALL_ACCEPTED;
 	psa_status_t psa_status = PSA_SUCCESS;
 
+	this_context->client.rpc_status = TS_RPC_CALL_ACCEPTED;
+
 	(void)client_id;
 
 	/* Validating input parameters */
@@ -304,7 +312,7 @@
 		return PSA_ERROR_INVALID_ARGUMENT;
 	}
 
-	handle = rpc_caller_begin(this_context->rpc_caller, &request, request_length);
+	handle = rpc_caller_begin(this_context->client.caller, &request, request_length);
 
 	if (handle) {
 		/* Populating request descriptor */
@@ -314,17 +322,18 @@
 		request_desc->data_length = data_length;
 		memcpy(&request_desc->p_data, p_data, data_length);
 
-		rpc_status = rpc_caller_invoke(this_context->rpc_caller, handle,
+		this_context->client.rpc_status = rpc_caller_invoke(this_context->client.caller,
+						handle,
 						TS_SECURE_STORAGE_OPCODE_SET_EXTENDED,
 						(uint32_t *)&psa_status, &response,
 						&response_length);
 
-		if (rpc_status != TS_RPC_CALL_ACCEPTED) {
+		if (this_context->client.rpc_status != TS_RPC_CALL_ACCEPTED) {
 			/* RPC failure */
 			psa_status = PSA_ERROR_GENERIC_ERROR;
 		}
 
-		rpc_caller_end(this_context->rpc_caller, handle);
+		rpc_caller_end(this_context->client.caller, handle);
 	}
 	else {
 		psa_status = PSA_ERROR_GENERIC_ERROR;
@@ -341,22 +350,22 @@
 	size_t response_length = 0;
 	struct secure_storage_response_get_support *response_desc;
 	rpc_call_handle handle;
-	rpc_status_t rpc_status;
 	psa_status_t psa_status = PSA_ERROR_GENERIC_ERROR;
 	uint32_t feature_map = 0;
 
 	(void)client_id;
 
-	handle = rpc_caller_begin(this_context->rpc_caller, &request, 0);
+	handle = rpc_caller_begin(this_context->client.caller, &request, 0);
 
 	if (handle) {
 
-		rpc_status = rpc_caller_invoke(this_context->rpc_caller, handle,
+		this_context->client.rpc_status = rpc_caller_invoke(this_context->client.caller,
+						handle,
 						TS_SECURE_STORAGE_OPCODE_GET_SUPPORT,
 						(uint32_t *)&psa_status, &response,
 						&response_length);
 
-		if (rpc_status != TS_RPC_CALL_ACCEPTED) {
+		if (this_context->client.rpc_status != TS_RPC_CALL_ACCEPTED) {
 			/* RPC failure */
 			psa_status = PSA_ERROR_GENERIC_ERROR;
 		} else if (response_length < sizeof(*response_desc)) {
@@ -368,7 +377,7 @@
 			feature_map = response_desc->support;
 		}
 
-		rpc_caller_end(this_context->rpc_caller, handle);
+		rpc_caller_end(this_context->client.caller, handle);
 	}
 
 	return feature_map;
@@ -378,7 +387,7 @@
 struct storage_backend *secure_storage_client_init(struct secure_storage_client *context,
 								struct rpc_caller *caller)
 {
-	context->rpc_caller = caller;
+	service_client_init(&context->client, caller);
 
 	static const struct storage_backend_interface interface =
 	{
@@ -399,5 +408,5 @@
 
 void secure_storage_client_deinit(struct secure_storage_client *context)
 {
-	(void)context;
+	service_client_deinit(&context->client);
 }
diff --git a/components/service/secure_storage/backend/secure_storage_client/secure_storage_client.h b/components/service/secure_storage/backend/secure_storage_client/secure_storage_client.h
index fa7d9e7..cb90e62 100644
--- a/components/service/secure_storage/backend/secure_storage_client/secure_storage_client.h
+++ b/components/service/secure_storage/backend/secure_storage_client/secure_storage_client.h
@@ -8,6 +8,7 @@
 #define SECURE_STORAGE_CLIENT_H
 
 #include <service/secure_storage/backend/storage_backend.h>
+#include <service/common/client/service_client.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -19,7 +20,7 @@
 struct secure_storage_client
 {
     struct storage_backend backend;
-    struct rpc_caller *rpc_caller;
+    struct service_client client;
 };
 
 /**
diff --git a/components/service/test_runner/client/cpp/test_runner_client.cpp b/components/service/test_runner/client/cpp/test_runner_client.cpp
index b1b2784..dbcc42d 100644
--- a/components/service/test_runner/client/cpp/test_runner_client.cpp
+++ b/components/service/test_runner/client/cpp/test_runner_client.cpp
@@ -17,32 +17,30 @@
 #include <string>
 
 test_runner_client::test_runner_client() :
-    m_caller(NULL),
-    m_err_rpc_status(TS_RPC_CALL_ACCEPTED)
+    m_client()
 {
-
+    service_client_init(&m_client, NULL);
 }
 
 test_runner_client::test_runner_client(struct rpc_caller *caller) :
-    m_caller(caller),
-    m_err_rpc_status(TS_RPC_CALL_ACCEPTED)
+    m_client()
 {
-
+    service_client_init(&m_client, caller);
 }
 
 test_runner_client::~test_runner_client()
 {
-
+    service_client_deinit(&m_client);
 }
 
 void test_runner_client::set_caller(struct rpc_caller *caller)
 {
-    m_caller = caller;
+    m_client.caller = caller;
 }
 
 int test_runner_client::err_rpc_status() const
 {
-    return m_err_rpc_status;
+    return m_client.rpc_status;
 }
 
 int test_runner_client::run_tests(
@@ -67,7 +65,7 @@
     std::vector<struct test_result> &results)
 {
     int test_status = TS_TEST_RUNNER_STATUS_ERROR;
-    m_err_rpc_status = TS_RPC_ERROR_RESOURCE_FAILURE;
+    m_client.rpc_status = TS_RPC_ERROR_RESOURCE_FAILURE;
     rpc_call_handle call_handle;
     uint8_t *req_buf;
     std::vector<uint8_t> req_param;
@@ -75,7 +73,7 @@
     serialize_test_spec(req_param, spec);
 
     size_t req_len = req_param.size();
-    call_handle = rpc_caller_begin(m_caller, &req_buf, req_len);
+    call_handle = rpc_caller_begin(m_client.caller, &req_buf, req_len);
 
     if (call_handle) {
 
@@ -89,10 +87,10 @@
             TS_TEST_RUNNER_OPCODE_LIST_TESTS :
             TS_TEST_RUNNER_OPCODE_RUN_TESTS;
 
-        m_err_rpc_status = rpc_caller_invoke(m_caller, call_handle,
+        m_client.rpc_status = rpc_caller_invoke(m_client.caller, call_handle,
             opcode, &opstatus, &resp_buf, &resp_len);
 
-        if (m_err_rpc_status == TS_RPC_CALL_ACCEPTED) {
+        if (m_client.rpc_status == TS_RPC_CALL_ACCEPTED) {
 
             test_status = opstatus;
 
@@ -102,7 +100,7 @@
             }
         }
 
-        rpc_caller_end(m_caller, call_handle);
+        rpc_caller_end(m_client.caller, call_handle);
     }
 
     return test_status;
diff --git a/components/service/test_runner/client/cpp/test_runner_client.h b/components/service/test_runner/client/cpp/test_runner_client.h
index b86b93e..d3d39ce 100644
--- a/components/service/test_runner/client/cpp/test_runner_client.h
+++ b/components/service/test_runner/client/cpp/test_runner_client.h
@@ -11,8 +11,7 @@
 #include <vector>
 #include <string>
 #include <service/test_runner/common/test_runner.h>
-
-struct rpc_caller;
+#include <service/common/client/service_client.h>
 
 /*
  * Provides a client interface for running remote tests using the test-runner
@@ -52,8 +51,7 @@
     int deserialize_result(const uint8_t *value_buf, size_t value_len,
                 struct test_result &result) const;
 
-    struct rpc_caller *m_caller;
-    int m_err_rpc_status;
+    struct service_client m_client;
 };
 
 #endif /* TEST_RUNNER_CLIENT_H */