diff options
author | Jens Wiklander <jens.wiklander@linaro.org> | 2017-11-09 23:20:25 +0100 |
---|---|---|
committer | Jérôme Forissier <jerome.forissier@linaro.org> | 2017-11-14 13:48:32 +0100 |
commit | e9eaba5c0a3d27075b1e995294fd42de65c0b912 (patch) | |
tree | 74999649def54c18ee7b4fa22f4486178086dc4f /core | |
parent | 82d91db11f0188df939ce52f6106a39f026de74c (diff) |
Replace struct mac_ops with function interface
Adds mac_cipher_get_ctx_size(), mac_cipher_init(), mac_cipher_update()
and mac_cipher_final() replacing struct mac_ops in crypto_ops.
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/crypto/crypto.c | 28 | ||||
-rw-r--r-- | core/include/tee/tee_cryp_provider.h | 21 | ||||
-rw-r--r-- | core/lib/libtomcrypt/src/tee_ltc_provider.c | 21 | ||||
-rw-r--r-- | core/tee/tee_cryp_hkdf.c | 32 | ||||
-rw-r--r-- | core/tee/tee_cryp_pbkdf2.c | 26 | ||||
-rw-r--r-- | core/tee/tee_fs_key_manager.c | 10 | ||||
-rw-r--r-- | core/tee/tee_rpmb_fs.c | 50 | ||||
-rw-r--r-- | core/tee/tee_svc_cryp.c | 26 |
8 files changed, 95 insertions, 119 deletions
diff --git a/core/crypto/crypto.c b/core/crypto/crypto.c index b1a1baf5..5521f1da 100644 --- a/core/crypto/crypto.c +++ b/core/crypto/crypto.c @@ -68,3 +68,31 @@ TEE_Result crypto_cipher_get_block_size(uint32_t algo __unused, return TEE_ERROR_NOT_IMPLEMENTED } #endif /*_CFG_CRYPTO_WITH_CIPHER*/ + +#if !defined(_CFG_CRYPTO_WITH_MAC) +TEE_Result crypto_mac_get_ctx_size(uint32_t algo __unused, + size_t *size __unused) +{ + return TEE_ERROR_NOT_IMPLEMENTED; +} + +TEE_Result crypto_mac_init(void *ctx __unused, uint32_t algo __unused, + const uint8_t *key __unused, size_t len __unused) +{ + return TEE_ERROR_NOT_IMPLEMENTED; +} + +TEE_Result crypto_mac_update(void *ctx __unused, uint32_t algo __unused, + const uint8_t *data __unused, size_t len __unused) +{ + return TEE_ERROR_NOT_IMPLEMENTED; +} + +TEE_Result crypto_mac_final(void *ctx __unused, uint32_t algo __unused, + uint8_t *digest __unused, + size_t digest_len __unused) +{ + return TEE_ERROR_NOT_IMPLEMENTED; +} +#endif /*_CFG_CRYPTO_WITH_MAC*/ + diff --git a/core/include/tee/tee_cryp_provider.h b/core/include/tee/tee_cryp_provider.h index 3ab70416..ac32d014 100644 --- a/core/include/tee/tee_cryp_provider.h +++ b/core/include/tee/tee_cryp_provider.h @@ -47,17 +47,6 @@ #include <tee_api_types.h> -/* Message Authentication Code functions */ -struct mac_ops { - TEE_Result (*get_ctx_size)(uint32_t algo, size_t *size); - TEE_Result (*init)(void *ctx, uint32_t algo, - const uint8_t *key, size_t len); - TEE_Result (*update)(void *ctx, uint32_t algo, - const uint8_t *data, size_t len); - TEE_Result (*final)(void *ctx, uint32_t algo, - uint8_t *digest, size_t digest_len); -}; - /* Authenticated encryption */ struct authenc_ops { TEE_Result (*get_ctx_size)(uint32_t algo, size_t *size); @@ -259,7 +248,6 @@ struct crypto_ops { const char *name; TEE_Result (*init)(void); - struct mac_ops mac; struct authenc_ops authenc; struct acipher_ops acipher; struct bignum_ops bignum; @@ -288,6 +276,15 @@ TEE_Result crypto_cipher_update(void *ctx, uint32_t algo, void crypto_cipher_final(void *ctx, uint32_t algo); TEE_Result crypto_cipher_get_block_size(uint32_t algo, size_t *size); +/* Message Authentication Code functions */ +TEE_Result crypto_mac_get_ctx_size(uint32_t algo, size_t *size); +TEE_Result crypto_mac_init(void *ctx, uint32_t algo, const uint8_t *key, + size_t len); +TEE_Result crypto_mac_update(void *ctx, uint32_t algo, const uint8_t *data, + size_t len); +TEE_Result crypto_mac_final(void *ctx, uint32_t algo, uint8_t *digest, + size_t digest_len); + /* * Verifies a SHA-256 hash, doesn't require tee_cryp_init() to be called in * advance and has as few dependencies as possible. diff --git a/core/lib/libtomcrypt/src/tee_ltc_provider.c b/core/lib/libtomcrypt/src/tee_ltc_provider.c index a26b8522..e6f54c9a 100644 --- a/core/lib/libtomcrypt/src/tee_ltc_provider.c +++ b/core/lib/libtomcrypt/src/tee_ltc_provider.c @@ -2254,7 +2254,7 @@ struct cbc_state { }; #endif -static TEE_Result mac_get_ctx_size(uint32_t algo, size_t *size) +TEE_Result crypto_mac_get_ctx_size(uint32_t algo, size_t *size) { switch (algo) { #if defined(CFG_CRYPTO_HMAC) @@ -2289,7 +2289,7 @@ static TEE_Result mac_get_ctx_size(uint32_t algo, size_t *size) return TEE_SUCCESS; } -static TEE_Result mac_init(void *ctx, uint32_t algo, const uint8_t *key, +TEE_Result crypto_mac_init(void *ctx, uint32_t algo, const uint8_t *key, size_t len) { TEE_Result res; @@ -2373,7 +2373,7 @@ static TEE_Result mac_init(void *ctx, uint32_t algo, const uint8_t *key, return TEE_SUCCESS; } -static TEE_Result mac_update(void *ctx, uint32_t algo, const uint8_t *data, +TEE_Result crypto_mac_update(void *ctx, uint32_t algo, const uint8_t *data, size_t len) { #if defined(CFG_CRYPTO_CBC_MAC) @@ -2448,7 +2448,7 @@ static TEE_Result mac_update(void *ctx, uint32_t algo, const uint8_t *data, return TEE_SUCCESS; } -static TEE_Result mac_final(void *ctx, uint32_t algo, uint8_t *digest, +TEE_Result crypto_mac_final(void *ctx, uint32_t algo, uint8_t *digest, size_t digest_len) { #if defined(CFG_CRYPTO_CBC_MAC) @@ -2493,8 +2493,9 @@ static TEE_Result mac_final(void *ctx, uint32_t algo, uint8_t *digest, memset(cbc->block+cbc->current_block_len, pad_len, pad_len); cbc->current_block_len = 0; - if (TEE_SUCCESS != mac_update( - ctx, algo, cbc->block, cbc->block_len)) + if (TEE_SUCCESS != crypto_mac_update(ctx, algo, + cbc->block, + cbc->block_len)) return TEE_ERROR_BAD_STATE; break; default: @@ -2978,14 +2979,6 @@ static TEE_Result tee_ltc_init(void) const struct crypto_ops crypto_ops = { .name = "LibTomCrypt provider", .init = tee_ltc_init, -#if defined(_CFG_CRYPTO_WITH_MAC) - .mac = { - .get_ctx_size = mac_get_ctx_size, - .init = mac_init, - .update = mac_update, - .final = mac_final, - }, -#endif #if defined(_CFG_CRYPTO_WITH_AUTHENC) .authenc = { .dec_final = authenc_dec_final, diff --git a/core/tee/tee_cryp_hkdf.c b/core/tee/tee_cryp_hkdf.c index d5287d97..7c93f70d 100644 --- a/core/tee/tee_cryp_hkdf.c +++ b/core/tee/tee_cryp_hkdf.c @@ -44,12 +44,6 @@ static TEE_Result hkdf_extract(uint32_t hash_id, const uint8_t *ikm, void *ctx = NULL; uint32_t hash_algo = TEE_ALG_HASH_ALGO(hash_id); uint32_t hmac_algo = (TEE_OPERATION_MAC << 28) | hash_id; - const struct mac_ops *m = &crypto_ops.mac; - - if (!m->get_ctx_size || !m->init || !m->update) { - res = TEE_ERROR_NOT_IMPLEMENTED; - goto out; - } if (!salt || !salt_len) { /* @@ -63,7 +57,7 @@ static TEE_Result hkdf_extract(uint32_t hash_id, const uint8_t *ikm, goto out; } - res = m->get_ctx_size(hmac_algo, &ctx_size); + res = crypto_mac_get_ctx_size(hmac_algo, &ctx_size); if (res != TEE_SUCCESS) goto out; @@ -79,15 +73,15 @@ static TEE_Result hkdf_extract(uint32_t hash_id, const uint8_t *ikm, * Therefore, salt is the HMAC key in the formula from section 2.2: * "PRK = HMAC-Hash(salt, IKM)" */ - res = m->init(ctx, hmac_algo, salt, salt_len); + res = crypto_mac_init(ctx, hmac_algo, salt, salt_len); if (res != TEE_SUCCESS) goto out; - res = m->update(ctx, hmac_algo, ikm, ikm_len); + res = crypto_mac_update(ctx, hmac_algo, ikm, ikm_len); if (res != TEE_SUCCESS) goto out; - res = m->final(ctx, hmac_algo, prk, *prk_len); + res = crypto_mac_final(ctx, hmac_algo, prk, *prk_len); if (res != TEE_SUCCESS) goto out; @@ -105,15 +99,9 @@ static TEE_Result hkdf_expand(uint32_t hash_id, const uint8_t *prk, size_t tn_len, hash_len, i, n, where, ctx_size; TEE_Result res = TEE_SUCCESS; void *ctx = NULL; - const struct mac_ops *m = &crypto_ops.mac; uint32_t hash_algo = TEE_ALG_HASH_ALGO(hash_id); uint32_t hmac_algo = TEE_ALG_HMAC_ALGO(hash_id); - if (!m->get_ctx_size || !m->init || !m->update || !m->final) { - res = TEE_ERROR_NOT_IMPLEMENTED; - goto out; - } - res = tee_hash_get_digest_size(hash_algo, &hash_len); if (res != TEE_SUCCESS) goto out; @@ -126,7 +114,7 @@ static TEE_Result hkdf_expand(uint32_t hash_id, const uint8_t *prk, if (!info) info_len = 0; - res = m->get_ctx_size(hmac_algo, &ctx_size); + res = crypto_mac_get_ctx_size(hmac_algo, &ctx_size); if (res != TEE_SUCCESS) goto out; @@ -162,19 +150,19 @@ static TEE_Result hkdf_expand(uint32_t hash_id, const uint8_t *prk, for (i = 1; i <= n; i++) { uint8_t c = i; - res = m->init(ctx, hmac_algo, prk, prk_len); + res = crypto_mac_init(ctx, hmac_algo, prk, prk_len); if (res != TEE_SUCCESS) goto out; - res = m->update(ctx, hmac_algo, tn, tn_len); + res = crypto_mac_update(ctx, hmac_algo, tn, tn_len); if (res != TEE_SUCCESS) goto out; - res = m->update(ctx, hmac_algo, info, info_len); + res = crypto_mac_update(ctx, hmac_algo, info, info_len); if (res != TEE_SUCCESS) goto out; - res = m->update(ctx, hmac_algo, &c, 1); + res = crypto_mac_update(ctx, hmac_algo, &c, 1); if (res != TEE_SUCCESS) goto out; - res = m->final(ctx, hmac_algo, tn, sizeof(tn)); + res = crypto_mac_final(ctx, hmac_algo, tn, sizeof(tn)); if (res != TEE_SUCCESS) goto out; diff --git a/core/tee/tee_cryp_pbkdf2.c b/core/tee/tee_cryp_pbkdf2.c index 5e6abc1f..d10584a5 100644 --- a/core/tee/tee_cryp_pbkdf2.c +++ b/core/tee/tee_cryp_pbkdf2.c @@ -53,36 +53,37 @@ static TEE_Result pbkdf2_f(uint8_t *out, size_t len, uint32_t idx, uint8_t u[TEE_MAX_HASH_SIZE]; uint32_t be_index; size_t i, j; - const struct mac_ops *mac = &crypto_ops.mac; memset(out, 0, len); for (i = 1; i <= p->iteration_count; i++) { - res = mac->init(h->ctx, h->algo, p->password, p->password_len); + res = crypto_mac_init(h->ctx, h->algo, p->password, + p->password_len); if (res != TEE_SUCCESS) return res; if (i == 1) { if (p->salt && p->salt_len) { - res = mac->update(h->ctx, h->algo, p->salt, - p->salt_len); + res = crypto_mac_update(h->ctx, h->algo, + p->salt, p->salt_len); if (res != TEE_SUCCESS) return res; } be_index = TEE_U32_TO_BIG_ENDIAN(idx); - res = mac->update(h->ctx, h->algo, - (uint8_t *)&be_index, - sizeof(be_index)); + res = crypto_mac_update(h->ctx, h->algo, + (uint8_t *)&be_index, + sizeof(be_index)); if (res != TEE_SUCCESS) return res; } else { - res = mac->update(h->ctx, h->algo, u, h->hash_len); + res = crypto_mac_update(h->ctx, h->algo, u, + h->hash_len); if (res != TEE_SUCCESS) return res; } - res = mac->final(h->ctx, h->algo, u, sizeof(u)); + res = crypto_mac_final(h->ctx, h->algo, u, sizeof(u)); if (res != TEE_SUCCESS) return res; @@ -102,11 +103,6 @@ TEE_Result tee_cryp_pbkdf2(uint32_t hash_id, const uint8_t *password, uint8_t *out = derived_key; struct pbkdf2_parms pbkdf2_parms; struct hmac_parms hmac_parms = {0, }; - const struct mac_ops *mac = &crypto_ops.mac; - - if (!mac->get_ctx_size || !mac->init || !mac->update || - !mac->final) - return TEE_ERROR_NOT_IMPLEMENTED; hmac_parms.algo = TEE_ALG_HMAC_ALGO(hash_id); @@ -114,7 +110,7 @@ TEE_Result tee_cryp_pbkdf2(uint32_t hash_id, const uint8_t *password, if (res != TEE_SUCCESS) return res; - res = mac->get_ctx_size(hmac_parms.algo, &ctx_size); + res = crypto_mac_get_ctx_size(hmac_parms.algo, &ctx_size); if (res != TEE_SUCCESS) return res; diff --git a/core/tee/tee_fs_key_manager.c b/core/tee/tee_fs_key_manager.c index 9afd186b..6b914887 100644 --- a/core/tee/tee_fs_key_manager.c +++ b/core/tee/tee_fs_key_manager.c @@ -70,7 +70,7 @@ static TEE_Result do_hmac(void *out_key, size_t out_key_size, if (!out_key || !in_key || !message) return TEE_ERROR_BAD_PARAMETERS; - res = crypto_ops.mac.get_ctx_size(TEE_FS_KM_HMAC_ALG, &hash_ctx_size); + res = crypto_mac_get_ctx_size(TEE_FS_KM_HMAC_ALG, &hash_ctx_size); if (res != TEE_SUCCESS) return res; @@ -78,17 +78,15 @@ static TEE_Result do_hmac(void *out_key, size_t out_key_size, if (!ctx) return TEE_ERROR_OUT_OF_MEMORY; - res = crypto_ops.mac.init(ctx, TEE_FS_KM_HMAC_ALG, in_key, in_key_size); + res = crypto_mac_init(ctx, TEE_FS_KM_HMAC_ALG, in_key, in_key_size); if (res != TEE_SUCCESS) goto exit; - res = crypto_ops.mac.update(ctx, TEE_FS_KM_HMAC_ALG, - message, message_size); + res = crypto_mac_update(ctx, TEE_FS_KM_HMAC_ALG, message, message_size); if (res != TEE_SUCCESS) goto exit; - res = crypto_ops.mac.final(ctx, TEE_FS_KM_HMAC_ALG, out_key, - out_key_size); + res = crypto_mac_final(ctx, TEE_FS_KM_HMAC_ALG, out_key, out_key_size); if (res != TEE_SUCCESS) goto exit; diff --git a/core/tee/tee_rpmb_fs.c b/core/tee/tee_rpmb_fs.c index bde489e4..a63f022c 100644 --- a/core/tee/tee_rpmb_fs.c +++ b/core/tee/tee_rpmb_fs.c @@ -353,18 +353,18 @@ static TEE_Result tee_rpmb_key_gen(uint16_t dev_id __unused, memcpy(message, rpmb_ctx->cid, RPMB_EMMC_CID_SIZE); memset(message + RPMB_CID_PRV_OFFSET, 0, 1); memset(message + RPMB_CID_CRC_OFFSET, 0, 1); - res = crypto_ops.mac.init(ctx, TEE_ALG_HMAC_SHA256, hwkey.data, - HW_UNIQUE_KEY_LENGTH); + res = crypto_mac_init(ctx, TEE_ALG_HMAC_SHA256, hwkey.data, + HW_UNIQUE_KEY_LENGTH); if (res != TEE_SUCCESS) goto out; - res = crypto_ops.mac.update(ctx, TEE_ALG_HMAC_SHA256, + res = crypto_mac_update(ctx, TEE_ALG_HMAC_SHA256, message, RPMB_EMMC_CID_SIZE); if (res != TEE_SUCCESS) goto out; - res = crypto_ops.mac.final(ctx, TEE_ALG_HMAC_SHA256, key, len); + res = crypto_mac_final(ctx, TEE_ALG_HMAC_SHA256, key, len); out: free(ctx); @@ -415,19 +415,19 @@ static TEE_Result tee_rpmb_mac_calc(uint8_t *mac, uint32_t macsize, if (!ctx) return TEE_ERROR_OUT_OF_MEMORY; - res = crypto_ops.mac.init(ctx, TEE_ALG_HMAC_SHA256, key, keysize); + res = crypto_mac_init(ctx, TEE_ALG_HMAC_SHA256, key, keysize); if (res != TEE_SUCCESS) goto func_exit; for (i = 0; i < blkcnt; i++) { - res = crypto_ops.mac.update(ctx, TEE_ALG_HMAC_SHA256, - datafrms[i].data, - RPMB_MAC_PROTECT_DATA_SIZE); + res = crypto_mac_update(ctx, TEE_ALG_HMAC_SHA256, + datafrms[i].data, + RPMB_MAC_PROTECT_DATA_SIZE); if (res != TEE_SUCCESS) goto func_exit; } - res = crypto_ops.mac.final(ctx, TEE_ALG_HMAC_SHA256, mac, macsize); + res = crypto_mac_final(ctx, TEE_ALG_HMAC_SHA256, mac, macsize); if (res != TEE_SUCCESS) goto func_exit; @@ -741,8 +741,8 @@ static TEE_Result tee_rpmb_data_cpy_mac_calc(struct rpmb_data_frame *datafrm, goto func_exit; } - res = crypto_ops.mac.init(ctx, TEE_ALG_HMAC_SHA256, rpmb_ctx->key, - RPMB_KEY_MAC_SIZE); + res = crypto_mac_init(ctx, TEE_ALG_HMAC_SHA256, rpmb_ctx->key, + RPMB_KEY_MAC_SIZE); if (res != TEE_SUCCESS) goto func_exit; @@ -762,9 +762,8 @@ static TEE_Result tee_rpmb_data_cpy_mac_calc(struct rpmb_data_frame *datafrm, */ memcpy(&localfrm, &datafrm[i], RPMB_DATA_FRAME_SIZE); - res = crypto_ops.mac.update(ctx, TEE_ALG_HMAC_SHA256, - localfrm.data, - RPMB_MAC_PROTECT_DATA_SIZE); + res = crypto_mac_update(ctx, TEE_ALG_HMAC_SHA256, localfrm.data, + RPMB_MAC_PROTECT_DATA_SIZE); if (res != TEE_SUCCESS) goto func_exit; @@ -796,13 +795,13 @@ static TEE_Result tee_rpmb_data_cpy_mac_calc(struct rpmb_data_frame *datafrm, goto func_exit; /* Update MAC against the last block */ - res = crypto_ops.mac.update(ctx, TEE_ALG_HMAC_SHA256, lastfrm->data, - RPMB_MAC_PROTECT_DATA_SIZE); + res = crypto_mac_update(ctx, TEE_ALG_HMAC_SHA256, lastfrm->data, + RPMB_MAC_PROTECT_DATA_SIZE); if (res != TEE_SUCCESS) goto func_exit; - res = crypto_ops.mac.final(ctx, TEE_ALG_HMAC_SHA256, rawdata->key_mac, - RPMB_KEY_MAC_SIZE); + res = crypto_mac_final(ctx, TEE_ALG_HMAC_SHA256, rawdata->key_mac, + RPMB_KEY_MAC_SIZE); if (res != TEE_SUCCESS) goto func_exit; @@ -1128,22 +1127,12 @@ static TEE_Result tee_rpmb_write_and_verify_key(uint16_t dev_id __unused) } #endif -/* True when all the required crypto functions are available */ -static bool have_crypto_ops(void) -{ - return (crypto_ops.mac.init && crypto_ops.mac.update && - crypto_ops.mac.final); -} - /* This function must never return TEE_SUCCESS if rpmb_ctx == NULL */ static TEE_Result tee_rpmb_init(uint16_t dev_id) { TEE_Result res = TEE_SUCCESS; struct rpmb_dev_info dev_info; - if (!have_crypto_ops()) - return TEE_ERROR_NOT_SUPPORTED; - if (!rpmb_ctx) { rpmb_ctx = calloc(1, sizeof(struct tee_rpmb_ctx)); if (!rpmb_ctx) @@ -1178,9 +1167,8 @@ static TEE_Result tee_rpmb_init(uint16_t dev_id) memcpy(rpmb_ctx->cid, dev_info.cid, RPMB_EMMC_CID_SIZE); if ((rpmb_ctx->hash_ctx_size == 0) && - (crypto_ops.mac.get_ctx_size( - TEE_ALG_HMAC_SHA256, - &rpmb_ctx->hash_ctx_size))) { + crypto_mac_get_ctx_size(TEE_ALG_HMAC_SHA256, + &rpmb_ctx->hash_ctx_size)) { rpmb_ctx->hash_ctx_size = 0; res = TEE_ERROR_GENERIC; goto func_exit; diff --git a/core/tee/tee_svc_cryp.c b/core/tee/tee_svc_cryp.c index 570c5ed1..83831566 100644 --- a/core/tee/tee_svc_cryp.c +++ b/core/tee/tee_svc_cryp.c @@ -2056,11 +2056,7 @@ TEE_Result syscall_cryp_state_alloc(unsigned long algo, unsigned long mode, if (key1 == 0 || key2 != 0) { res = TEE_ERROR_BAD_PARAMETERS; } else { - if (crypto_ops.mac.get_ctx_size) - res = crypto_ops.mac.get_ctx_size(algo, - &cs->ctx_size); - else - res = TEE_ERROR_NOT_IMPLEMENTED; + res = crypto_mac_get_ctx_size(algo, &cs->ctx_size); if (res != TEE_SUCCESS) break; cs->ctx = calloc(1, cs->ctx_size); @@ -2205,11 +2201,8 @@ TEE_Result syscall_hash_init(unsigned long state, return TEE_ERROR_BAD_PARAMETERS; key = (struct tee_cryp_obj_secret *)o->attr; - if (!crypto_ops.mac.init) - return TEE_ERROR_NOT_IMPLEMENTED; - res = crypto_ops.mac.init(cs->ctx, cs->algo, - (void *)(key + 1), - key->key_size); + res = crypto_mac_init(cs->ctx, cs->algo, + (void *)(key + 1), key->key_size); if (res != TEE_SUCCESS) return res; break; @@ -2258,10 +2251,7 @@ TEE_Result syscall_hash_update(unsigned long state, const void *chunk, return res; break; case TEE_OPERATION_MAC: - if (!crypto_ops.mac.update) - return TEE_ERROR_NOT_IMPLEMENTED; - res = crypto_ops.mac.update(cs->ctx, cs->algo, chunk, - chunk_size); + res = crypto_mac_update(cs->ctx, cs->algo, chunk, chunk_size); if (res != TEE_SUCCESS) return res; break; @@ -2335,8 +2325,6 @@ TEE_Result syscall_hash_final(unsigned long state, const void *chunk, break; case TEE_OPERATION_MAC: - if (!crypto_ops.mac.update || !crypto_ops.mac.final) - return TEE_ERROR_NOT_IMPLEMENTED; res = tee_mac_get_digest_size(cs->algo, &hash_size); if (res != TEE_SUCCESS) return res; @@ -2346,13 +2334,13 @@ TEE_Result syscall_hash_final(unsigned long state, const void *chunk, } if (chunk_size) { - res = crypto_ops.mac.update(cs->ctx, cs->algo, chunk, - chunk_size); + res = crypto_mac_update(cs->ctx, cs->algo, chunk, + chunk_size); if (res != TEE_SUCCESS) return res; } - res = crypto_ops.mac.final(cs->ctx, cs->algo, hash, hash_size); + res = crypto_mac_final(cs->ctx, cs->algo, hash, hash_size); if (res != TEE_SUCCESS) return res; break; |