Add platform specific TRNG driver

Adds platform specific TRNG driver to Crypto opteesp deployment.
Fetches and builds the TZ-TRNG driver from its external
repo and includes it when the crypto/opteesp is built for
the arm/fvp/fvp_base_revc-2xaemv8a platform.  Device region
information provided as external configuration data is
not yet integrated to the TRNG hardware is not yet used.

Signed-off-by: Julian Hall <julian.hall@arm.com>
Change-Id: I8a2946643a279dfcc3aff608427c85e674f0e084
diff --git a/components/config/interface/platform_config.h b/components/config/interface/platform_config.h
new file mode 100644
index 0000000..d11f0eb
--- /dev/null
+++ b/components/config/interface/platform_config.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef TS_CONFIG_INTERFACE_PLATFORM_CONFIG_H
+#define TS_CONFIG_INTERFACE_PLATFORM_CONFIG_H
+
+#include <platform/interface/device_region.h>
+#include <stddef.h>
+
+/**
+ * Provides a common interface for retrieving platform configuration
+ * data for initializing platform provided devices or services.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Query platform configuartion for a particular device_region
+ *
+ * \param[in]  dev_class     Class of device (e.g. 'trng')
+ * \param[in]  dev_instance  The instance of the class of a device on platform
+ *
+ * \return          Pointer to device_region or NULL if no qualifying configuration
+ */
+struct device_region *platform_config_device_query(const char *dev_class,
+                                                    int dev_instance);
+
+/**
+ * \brief Frees a device region returned by platform_config_device_query()
+ *
+ * \param[in]  device_region   Device region object to free.  Can be NULL.
+ */
+void platform_config_device_query_free(struct device_region *device_region);
+
+/**
+ * \brief Add a device_region to the platform configuration
+ *
+ * \param[in] device_region The device_region object to add
+ *
+  * \return          0 if successful
+ */
+int platform_config_device_add(const struct device_region *device_region);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* TS_CONFIG_INTERFACE_PLATFORM_CONFIG_H */
diff --git a/components/service/crypto/provider/mbedcrypto/entropy_adapter/linux/component.cmake b/components/config/ramstore/component.cmake
similarity index 71%
copy from components/service/crypto/provider/mbedcrypto/entropy_adapter/linux/component.cmake
copy to components/config/ramstore/component.cmake
index 9be89d1..3fb8540 100644
--- a/components/service/crypto/provider/mbedcrypto/entropy_adapter/linux/component.cmake
+++ b/components/config/ramstore/component.cmake
@@ -1,5 +1,5 @@
 #-------------------------------------------------------------------------------
-# Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -9,5 +9,6 @@
 endif()
 
 target_sources(${TGT} PRIVATE
-	"${CMAKE_CURRENT_LIST_DIR}/linux_entropy_adapter.c"
+	"${CMAKE_CURRENT_LIST_DIR}/config_ramstore.c"
 	)
+
diff --git a/components/config/ramstore/config_ramstore.c b/components/config/ramstore/config_ramstore.c
new file mode 100644
index 0000000..548ba4b
--- /dev/null
+++ b/components/config/ramstore/config_ramstore.c
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include "config_ramstore.h"
+#include <config/interface/platform_config.h>
+#include <stdlib.h>
+#include <string.h>
+#include <stdint.h>
+
+/**
+ * Variable length container for a configuration object.
+ */
+struct config_container
+{
+	size_t size;
+	struct config_container *next;
+};
+
+static struct config_container *config_container_create(const void *data, size_t size)
+{
+	struct config_container *container = malloc(sizeof(struct config_container) + size);
+
+	if (container) {
+
+		container->size = size;
+		container->next = NULL;
+
+		memcpy((uint8_t*)container + sizeof(struct config_container), data, size);
+	}
+
+	return container;
+}
+
+static void config_container_destroy(struct config_container *container)
+{
+	free(container);
+}
+
+static const void *config_container_data(const struct config_container *container)
+{
+	return (const uint8_t*)container + sizeof(struct config_container);
+}
+
+/**
+ * Singleton config_ramstore instance
+ */
+static struct config_ramstore
+{
+	struct config_container *device_region_list;
+} ramstore = {0};
+
+
+void config_ramstore_init(void)
+{
+	ramstore.device_region_list = NULL;
+}
+
+void config_ramstore_deinit(void)
+{
+	while (ramstore.device_region_list) {
+
+		struct config_container *next = ramstore.device_region_list->next;
+		free(ramstore.device_region_list);
+		ramstore.device_region_list = next;
+	}
+}
+
+int platform_config_device_add(const struct device_region *device_region)
+{
+	struct config_container *container;
+
+	container = config_container_create(device_region, sizeof(struct device_region));
+	if (!container) return -1;
+
+	container->next = ramstore.device_region_list;
+	ramstore.device_region_list = container;
+
+	return 0;
+}
+
+struct device_region *platform_config_device_query(const char *dev_class,
+                                                    int dev_instance)
+{
+	struct device_region *result = NULL;
+	const struct config_container *container = ramstore.device_region_list;
+
+	while (container) {
+
+		const struct device_region *candidate;
+		candidate = (const struct device_region*)config_container_data(container);
+
+		if ((candidate->dev_instance == dev_instance) &&
+			(strcmp(candidate->dev_class, dev_class) == 0)) {
+
+			result = malloc(container->size);
+			if (result) {
+
+				memcpy(result, candidate, container->size);
+			}
+
+			break;
+		}
+
+		container = container->next;
+	}
+
+	return result;
+}
+
+void platform_config_device_query_free(struct device_region *device_region)
+{
+	free(device_region);
+}
diff --git a/components/config/ramstore/config_ramstore.h b/components/config/ramstore/config_ramstore.h
new file mode 100644
index 0000000..5df1838
--- /dev/null
+++ b/components/config/ramstore/config_ramstore.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/**
+ * A config store that implements the common config interface that
+ * saves configuration data in ram.  This may be used in environments
+ * that are configured at run-time e.g. from device tree.  The
+ * config_ramstore is a singleton.
+ */
+#ifndef CONFIG_RAMSTORE_H
+#define CONFIG_RAMSTORE_H
+
+#include <stddef.h>
+#include <platform/interface/device_region.h>
+#include <config/interface/platform_config.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \brief Initializes the singleton store
+ *
+ */
+void config_ramstore_init(void);
+
+/**
+ * \brief Clean-up the config_ramstore after use
+ */
+void config_ramstore_deinit(void);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* CONFIG_RAMSTORE_H */
diff --git a/components/service/crypto/provider/mbedcrypto/entropy_adapter/linux/component.cmake b/components/config/ramstore/test/component.cmake
similarity index 88%
rename from components/service/crypto/provider/mbedcrypto/entropy_adapter/linux/component.cmake
rename to components/config/ramstore/test/component.cmake
index 9be89d1..7f1df76 100644
--- a/components/service/crypto/provider/mbedcrypto/entropy_adapter/linux/component.cmake
+++ b/components/config/ramstore/test/component.cmake
@@ -9,5 +9,5 @@
 endif()
 
 target_sources(${TGT} PRIVATE
-	"${CMAKE_CURRENT_LIST_DIR}/linux_entropy_adapter.c"
+	"${CMAKE_CURRENT_LIST_DIR}/ramstore_tests.cpp"
 	)
diff --git a/components/config/ramstore/test/ramstore_tests.cpp b/components/config/ramstore/test/ramstore_tests.cpp
new file mode 100644
index 0000000..c597b57
--- /dev/null
+++ b/components/config/ramstore/test/ramstore_tests.cpp
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <cstring>
+#include <config/ramstore/config_ramstore.h>
+#include <CppUTest/TestHarness.h>
+
+TEST_GROUP(ConfigRamstoreTests)
+{
+    void setup()
+    {
+        config_ramstore_init();
+    }
+
+    void teardown()
+    {
+        config_ramstore_deinit();
+    }
+};
+
+TEST(ConfigRamstoreTests, checkEmptyConfig)
+{
+    /* Expect queries to an empty store to return gracefully */
+    struct device_region *query_result = platform_config_device_query("flash", 0);
+    CHECK(!query_result);
+
+    /* Expect freeing a null pointer to be harmless */
+    platform_config_device_query_free(query_result);
+}
+
+TEST(ConfigRamstoreTests, checkSingleConfig)
+{
+    struct device_region config;
+
+    /* This would be external configuration, obtained say from device tree */
+    strcpy(config.dev_class, "fs");
+    config.dev_instance = 2;
+    config.base_addr = (uint8_t*)0x0f000010;
+    config.io_region_size = 0x100;
+
+    /* Add the configuration object */
+    int status = platform_config_device_add(&config);
+    CHECK_EQUAL(0, status);
+
+    /* Expect query find the config object */
+    struct device_region *query_result = platform_config_device_query(config.dev_class, config.dev_instance);
+    CHECK(query_result);
+    CHECK(strcmp(config.dev_class, query_result->dev_class) == 0);
+    CHECK_EQUAL(config.dev_instance, query_result->dev_instance);
+    CHECK_EQUAL(config.base_addr, query_result->base_addr);
+    CHECK_EQUAL(config.io_region_size, query_result->io_region_size);
+
+    platform_config_device_query_free(query_result);
+}
+
+TEST(ConfigRamstoreTests, checkMultipleConfig)
+{
+    int status;
+
+    /* Add first config object */
+    struct device_region config1;
+
+    strcpy(config1.dev_class, "flash");
+    config1.dev_instance = 0;
+    config1.base_addr = (uint8_t*)0x0f000010;
+    config1.io_region_size = 0x100;
+
+    status = platform_config_device_add(&config1);
+    CHECK_EQUAL(0, status);
+
+    /* Add second config object */
+    struct device_region config2;
+
+    strcpy(config2.dev_class, "flash");
+    config2.dev_instance = 1;
+    config2.base_addr = (uint8_t*)0x0f000010;
+    config2.io_region_size = 0x100;
+
+    status = platform_config_device_add(&config2);
+    CHECK_EQUAL(0, status);
+
+    /* Expect queries for both objects to work */
+    struct device_region *query1_result = platform_config_device_query(config1.dev_class, config1.dev_instance);
+    CHECK(query1_result);
+
+    struct device_region *query2_result = platform_config_device_query(config2.dev_class, config2.dev_instance);
+    CHECK(query2_result);
+
+    platform_config_device_query_free(query2_result);
+}
\ No newline at end of file
diff --git a/components/service/crypto/client/test/mock/mock_crypto_client.cpp b/components/service/crypto/client/test/mock/mock_crypto_client.cpp
index 69e7478..96195a8 100644
--- a/components/service/crypto/client/test/mock/mock_crypto_client.cpp
+++ b/components/service/crypto/client/test/mock/mock_crypto_client.cpp
@@ -34,7 +34,7 @@
                                                                 storage_ep);
 
         struct rpc_interface *crypto_ep = mbed_crypto_provider_init(&m_crypto_provider,
-                                                                storage_caller, NULL);
+                                                                storage_caller, 0);
         struct rpc_caller *crypto_caller = direct_caller_init_default(&m_crypto_caller,
                                                                 crypto_ep);
 
diff --git a/components/service/crypto/client/test/standalone/standalone_crypto_client.cpp b/components/service/crypto/client/test/standalone/standalone_crypto_client.cpp
index 15986c6..86fd420 100644
--- a/components/service/crypto/client/test/standalone/standalone_crypto_client.cpp
+++ b/components/service/crypto/client/test/standalone/standalone_crypto_client.cpp
@@ -52,7 +52,7 @@
         }
 
         struct rpc_interface *crypto_ep = mbed_crypto_provider_init(&m_crypto_provider,
-                                                                storage_caller, NULL);
+                                                                storage_caller, 0);
         struct rpc_caller *crypto_caller = direct_caller_init_default(&m_crypto_caller,
                                                                 crypto_ep);
 
diff --git a/components/service/crypto/provider/mbedcrypto/crypto_provider.c b/components/service/crypto/provider/mbedcrypto/crypto_provider.c
index a12f625..4d5a0a3 100644
--- a/components/service/crypto/provider/mbedcrypto/crypto_provider.c
+++ b/components/service/crypto/provider/mbedcrypto/crypto_provider.c
@@ -7,7 +7,7 @@
 #include <stdlib.h>
 #include <protocols/service/crypto/packed-c/opcodes.h>
 #include <service/crypto/provider/mbedcrypto/crypto_provider.h>
-#include <service/crypto/provider/mbedcrypto/entropy_adapter/entropy_adapter.h>
+#include <service/crypto/provider/mbedcrypto/trng_adapter/trng_adapter.h>
 #include <service/secure_storage/client/psa/its/its_client.h>
 #include <protocols/rpc/common/packed-c/status.h>
 #include <psa/crypto.h>
@@ -46,11 +46,11 @@
 
 struct rpc_interface *mbed_crypto_provider_init(struct mbed_crypto_provider *context,
                                         struct rpc_caller *storage_provider,
-                                        void *entropy_adapter_config)
+                                        int trng_instance)
 {
     struct rpc_interface *rpc_interface = NULL;
 
-    entropy_adapter_init(entropy_adapter_config);
+    trng_adapter_init(trng_instance);
 
     /*
      * A storage provider is required for persistent key storage.  As this
@@ -76,7 +76,7 @@
 void mbed_crypto_provider_deinit(struct mbed_crypto_provider *context)
 {
     (void)context;
-    entropy_adapter_deinit();
+    trng_adapter_deinit();
 }
 
 void mbed_crypto_provider_register_serializer(struct mbed_crypto_provider *context,
diff --git a/components/service/crypto/provider/mbedcrypto/crypto_provider.h b/components/service/crypto/provider/mbedcrypto/crypto_provider.h
index 5ffd0c3..0a7666f 100644
--- a/components/service/crypto/provider/mbedcrypto/crypto_provider.h
+++ b/components/service/crypto/provider/mbedcrypto/crypto_provider.h
@@ -35,7 +35,7 @@
  */
 struct rpc_interface *mbed_crypto_provider_init(struct mbed_crypto_provider *context,
                                         struct rpc_caller *storage_provider,
-                                        void *entropy_adapter_config);
+                                        int trng_instance);
 
 /*
  * When operation of the provider is no longer required, this function
diff --git a/components/service/crypto/provider/mbedcrypto/entropy_adapter/platform/platform_entropy_adapter.c b/components/service/crypto/provider/mbedcrypto/entropy_adapter/platform/platform_entropy_adapter.c
deleted file mode 100644
index 8bf3ec4..0000000
--- a/components/service/crypto/provider/mbedcrypto/entropy_adapter/platform/platform_entropy_adapter.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
- *
- * SPDX-License-Identifier: BSD-3-Clause
- */
-#include <mbedtls/entropy.h>
-#include <mbedtls/entropy_poll.h>
-#include <platform/interface/entropy.h>
-#include <service/crypto/provider/mbedcrypto/entropy_adapter/entropy_adapter.h>
-#include <stddef.h>
-
-/*
- * An mbed tls compatibile hardware entropy source that adapts the mbed tls hardware poll
- * function to a platform entropy driver.  The actual realization of the driver
- * will depend on the platform selected at build-time.
- */
-static struct ts_plat_entropy_driver driver = {0};
-
-int entropy_adapter_init(void *config)
-{
-    return ts_plat_entropy_create(&driver, config);
-}
-
-void entropy_adapter_deinit(void)
-{
-    ts_plat_entropy_destroy(&driver);
-
-    driver.iface = NULL;
-    driver.context = NULL;
-}
-
-int mbedtls_hardware_poll(void *data, unsigned char *output, size_t len, size_t *olen)
-{
-    int status = MBEDTLS_ERR_ENTROPY_SOURCE_FAILED;
-    *olen = 0;
-
-    if (driver.iface) {
-
-        status = driver.iface->poll(driver.context, output, len, olen);
-    }
-
-    return status;
-}
diff --git a/components/service/crypto/provider/mbedcrypto/entropy_adapter/linux/component.cmake b/components/service/crypto/provider/mbedcrypto/trng_adapter/linux/component.cmake
similarity index 88%
copy from components/service/crypto/provider/mbedcrypto/entropy_adapter/linux/component.cmake
copy to components/service/crypto/provider/mbedcrypto/trng_adapter/linux/component.cmake
index 9be89d1..89056e2 100644
--- a/components/service/crypto/provider/mbedcrypto/entropy_adapter/linux/component.cmake
+++ b/components/service/crypto/provider/mbedcrypto/trng_adapter/linux/component.cmake
@@ -9,5 +9,5 @@
 endif()
 
 target_sources(${TGT} PRIVATE
-	"${CMAKE_CURRENT_LIST_DIR}/linux_entropy_adapter.c"
+	"${CMAKE_CURRENT_LIST_DIR}/linux_trng_adapter.c"
 	)
diff --git a/components/service/crypto/provider/mbedcrypto/entropy_adapter/linux/linux_entropy_adapter.c b/components/service/crypto/provider/mbedcrypto/trng_adapter/linux/linux_trng_adapter.c
similarity index 78%
rename from components/service/crypto/provider/mbedcrypto/entropy_adapter/linux/linux_entropy_adapter.c
rename to components/service/crypto/provider/mbedcrypto/trng_adapter/linux/linux_trng_adapter.c
index 83899b1..15a875a 100644
--- a/components/service/crypto/provider/mbedcrypto/entropy_adapter/linux/linux_entropy_adapter.c
+++ b/components/service/crypto/provider/mbedcrypto/trng_adapter/linux/linux_trng_adapter.c
@@ -5,7 +5,9 @@
  */
 #include <mbedtls/entropy.h>
 #include <mbedtls/entropy_poll.h>
-#include <service/crypto/provider/mbedcrypto/entropy_adapter/entropy_adapter.h>
+#include <service/crypto/provider/mbedcrypto/trng_adapter/trng_adapter.h>
+#include <unistd.h>
+#include <sys/syscall.h>
 #include <errno.h>
 #include <sys/syscall.h>
 #include <unistd.h>
@@ -15,13 +17,12 @@
  * function to the Linux getrandom system call.
  */
 
-int entropy_adapter_init(void *config)
+int trng_adapter_init(int instance)
 {
-    (void)config;
-    return 0;
+    (void)instance;
 }
 
-void entropy_adapter_deinit(void)
+void trng_adapter_deinit()
 {
 
 }
diff --git a/components/service/crypto/provider/mbedcrypto/entropy_adapter/platform/component.cmake b/components/service/crypto/provider/mbedcrypto/trng_adapter/platform/component.cmake
similarity index 87%
rename from components/service/crypto/provider/mbedcrypto/entropy_adapter/platform/component.cmake
rename to components/service/crypto/provider/mbedcrypto/trng_adapter/platform/component.cmake
index d178f1f..575ac22 100644
--- a/components/service/crypto/provider/mbedcrypto/entropy_adapter/platform/component.cmake
+++ b/components/service/crypto/provider/mbedcrypto/trng_adapter/platform/component.cmake
@@ -9,9 +9,9 @@
 endif()
 
 target_sources(${TGT} PRIVATE
-	"${CMAKE_CURRENT_LIST_DIR}/platform_entropy_adapter.c"
+	"${CMAKE_CURRENT_LIST_DIR}/platform_trng_adapter.c"
 	)
 
 set_property(TARGET ${TGT} APPEND_STRING PROPERTY TS_PLATFORM_DRIVER_DEPENDENCIES
-	"entropy"
+	"trng"
 	)
diff --git a/components/service/crypto/provider/mbedcrypto/trng_adapter/platform/platform_trng_adapter.c b/components/service/crypto/provider/mbedcrypto/trng_adapter/platform/platform_trng_adapter.c
new file mode 100644
index 0000000..29628d1
--- /dev/null
+++ b/components/service/crypto/provider/mbedcrypto/trng_adapter/platform/platform_trng_adapter.c
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+#include <mbedtls/entropy.h>
+#include <mbedtls/entropy_poll.h>
+#include <platform/interface/trng.h>
+#include <service/crypto/provider/mbedcrypto/trng_adapter/trng_adapter.h>
+#include <config/interface/platform_config.h>
+#include <stddef.h>
+
+/*
+ * An mbed tls compatibile hardware entropy source that adapts the mbed tls hardware poll
+ * function to a platform trng driver.  The actual realization of the driver
+ * will depend on the platform selected at build-time.
+ */
+static struct platform_trng_driver driver = {0};
+
+int trng_adapter_init(int instance)
+{
+    int status;
+    struct device_region *device_region;
+
+    device_region = platform_config_device_query("trng", instance);
+    status = platform_trng_create(&driver, device_region);
+    platform_config_device_query_free(device_region);
+
+    return status;
+}
+
+void trng_adapter_deinit()
+{
+    platform_trng_destroy(&driver);
+
+    driver.iface = NULL;
+    driver.context = NULL;
+}
+
+int mbedtls_hardware_poll(void *data, unsigned char *output, size_t len, size_t *olen)
+{
+    int status = MBEDTLS_ERR_ENTROPY_SOURCE_FAILED;
+    *olen = 0;
+
+    if (driver.iface) {
+
+        status = driver.iface->poll(driver.context, output, len, olen);
+    }
+
+    return status;
+}
diff --git a/components/service/crypto/provider/mbedcrypto/entropy_adapter/entropy_adapter.h b/components/service/crypto/provider/mbedcrypto/trng_adapter/trng_adapter.h
similarity index 67%
rename from components/service/crypto/provider/mbedcrypto/entropy_adapter/entropy_adapter.h
rename to components/service/crypto/provider/mbedcrypto/trng_adapter/trng_adapter.h
index 48bb741..f1e7254 100644
--- a/components/service/crypto/provider/mbedcrypto/entropy_adapter/entropy_adapter.h
+++ b/components/service/crypto/provider/mbedcrypto/trng_adapter/trng_adapter.h
@@ -3,8 +3,8 @@
  *
  * SPDX-License-Identifier: BSD-3-Clause
  */
-#ifndef MBED_CRYPTO_ENTROPY_ADAPTER_H
-#define MBED_CRYPTO_ENTROPY_ADAPTER_H
+#ifndef MBED_CRYPTO_TRNG_ADAPTER_H
+#define MBED_CRYPTO_TRNG_ADAPTER_H
 
 /*
  * The build-time configuration of Mbed Crypto creates a dependency on a
@@ -20,21 +20,21 @@
 #endif
 
 /**
- * \brief Initialise the entropy adapter
+ * \brief Initialise the trng adapter
  *
- * \param config    Entropy adapter specific configuration or NULL if none.
+ * \param instance    Deployment specific trng instance.
  *
  * \return          0 if successful.
  */
-int entropy_adapter_init(void *config);
+int trng_adapter_init(int instance);
 
 /**
- * \brief Cleans-up the entropy adapter.
+ * \brief Cleans-up the trng adapter.
  */
-void entropy_adapter_deinit(void);
+void trng_adapter_deinit();
 
 #ifdef __cplusplus
 } /* extern "C" */
 #endif
 
-#endif /* MBED_CRYPTO_ENTROPY_ADAPTER_H */
+#endif /* MBED_CRYPTO_TRNG_ADAPTER_H */
diff --git a/components/service/locator/standalone/services/crypto/crypto_service_context.cpp b/components/service/locator/standalone/services/crypto/crypto_service_context.cpp
index e761224..7a49d26 100644
--- a/components/service/locator/standalone/services/crypto/crypto_service_context.cpp
+++ b/components/service/locator/standalone/services/crypto/crypto_service_context.cpp
@@ -26,9 +26,9 @@
 {
     struct rpc_interface *storage_ep = sfs_provider_init(&m_storage_provider);
     struct rpc_caller *storage_caller = direct_caller_init_default(&m_storage_caller,
-                                                                    storage_ep);
+                                                                storage_ep);
     struct rpc_interface *crypto_ep = mbed_crypto_provider_init(&m_crypto_provider,
-                                                                    storage_caller, NULL);
+                                                                storage_caller, 0);
 
     mbed_crypto_provider_register_serializer(&m_crypto_provider,
                     TS_RPC_ENCODING_PROTOBUF, pb_crypto_provider_serializer_instance());