aboutsummaryrefslogtreecommitdiff
path: root/core/arch/arm32/tee
diff options
context:
space:
mode:
authorJerome Forissier <jerome.forissier@linaro.org>2014-08-20 18:56:57 +0200
committerPascal Brand <pascal.brand@st.com>2014-11-04 16:57:57 +0100
commitffe040395b13924a8bfb106002a3512c0f1024c6 (patch)
treed21f8ffe68206362d15726f0816e9d2b199a7d05 /core/arch/arm32/tee
parentaf0c87eccf97c3dc97cfb68f2dffb487343388bc (diff)
Add crypto provider internal API
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Reviewed-by: Pascal Brand <pascal.brand@linaro.org> Tested-by: Pascal Brand <pascal.brand@linaro.org> (STM platform)
Diffstat (limited to 'core/arch/arm32/tee')
-rw-r--r--core/arch/arm32/tee/init.c15
-rw-r--r--core/arch/arm32/tee/tee_rpmb.c13
2 files changed, 17 insertions, 11 deletions
diff --git a/core/arch/arm32/tee/init.c b/core/arch/arm32/tee/init.c
index 78d969c..569a8cb 100644
--- a/core/arch/arm32/tee/init.c
+++ b/core/arch/arm32/tee/init.c
@@ -24,7 +24,6 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <tee_ltc_wrapper.h>
#include <assert.h>
#include <malloc.h> /* required for inits */
@@ -35,7 +34,7 @@
#include <kernel/time_source.h>
#include <mm/tee_mmu.h>
#include <tee/tee_fs.h>
-
+#include <tee/tee_cryp_provider.h>
@@ -80,8 +79,8 @@ TEE_Result init_teecore(void)
teecore_init_ta_ram();
teecore_init_pub_ram();
- /* Libtomcrypt initialization */
- tee_ltc_init();
+ /* Initialize cryptographic provider */
+ tee_cryp_init();
/* time initialization */
time_source_init();
@@ -89,3 +88,11 @@ TEE_Result init_teecore(void)
IMSG("teecore inits done");
return TEE_SUCCESS;
}
+
+TEE_Result tee_cryp_init(void)
+{
+ if (crypto_ops.init)
+ return crypto_ops.init();
+
+ return TEE_SUCCESS;
+}
diff --git a/core/arch/arm32/tee/tee_rpmb.c b/core/arch/arm32/tee/tee_rpmb.c
index 4cafd66..a11fc9f 100644
--- a/core/arch/arm32/tee/tee_rpmb.c
+++ b/core/arch/arm32/tee/tee_rpmb.c
@@ -37,10 +37,9 @@
#include <kernel/tee_ta_manager.h>
#include <tee/tee_rpmb.h>
#include <kernel/chip_services.h>
-#include <tee/tee_hash.h>
#include <kernel/tee_misc.h>
-#include <tee/tee_hash.h>
-#include <tee/tee_svc_cryp.h>
+#include <tee/tee_cryp_provider.h>
+#include <tee/tee_cryp_utl.h>
#include <sm/teesmc.h>
#include <mm/core_mmu.h>
@@ -174,17 +173,17 @@ static TEE_Result mac_calc(uint8_t *mac, uint32_t macsize,
static TEE_Result mac_init(void *ctx, const uint8_t *key __unused,
uint32_t keysize __unused)
{
- return tee_hash_init(ctx, TEE_ALG_HMAC_SHA256);
+ return crypto_ops.hash.init(ctx, TEE_ALG_HMAC_SHA256);
}
static TEE_Result mac_update(void *ctx, const uint8_t *data, uint32_t datasize)
{
- return tee_hash_update(ctx, TEE_ALG_HMAC_SHA256, data, datasize);
+ return crypto_ops.hash.update(ctx, TEE_ALG_HMAC_SHA256, data, datasize);
}
static TEE_Result mac_final(void *ctx, uint8_t *mac, uint32_t macsize)
{
- return tee_hash_final(ctx, TEE_ALG_HMAC_SHA256, mac, macsize);
+ return crypto_ops.hash.final(ctx, TEE_ALG_HMAC_SHA256, mac, macsize);
}
/*
@@ -856,7 +855,7 @@ static TEE_Result tee_rpmb_init(uint16_t dev_id, bool writekey, bool commercial)
memcpy(rpmb_ctx->cid, dev_info.cid, RPMB_EMMC_CID_SIZE);
if ((rpmb_ctx->hash_ctx_size == 0) &&
- (tee_hash_get_ctx_size(
+ (crypto_ops.mac.get_ctx_size(
TEE_ALG_HMAC_SHA256,
(size_t *)(&rpmb_ctx->hash_ctx_size)))) {
rpmb_ctx->hash_ctx_size = 0;