Skip to content

Commit

Permalink
opteeos/libmbedtls: support alloc ctx about sha3 series
Browse files Browse the repository at this point in the history
optee support using mbedtls sha3 series

Signed-off-by: makejian <[email protected]>
  • Loading branch information
ThePassionate committed Dec 24, 2024
1 parent 72908d2 commit aad7ff8
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
28 changes: 28 additions & 0 deletions lib/libmbedtls/core/hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,34 @@ TEE_Result crypto_sha512_alloc_ctx(struct crypto_hash_ctx **ctx)
}
#endif

#if defined(CFG_CRYPTO_SHA3_224)
TEE_Result crypto_sha3_224_alloc_ctx(struct crypto_hash_ctx **ctx)
{
return mbed_hash_alloc_ctx(ctx, MBEDTLS_MD_SHA3_224);
}
#endif

#if defined(CFG_CRYPTO_SHA3_256)
TEE_Result crypto_sha3_256_alloc_ctx(struct crypto_hash_ctx **ctx)
{
return mbed_hash_alloc_ctx(ctx, MBEDTLS_MD_SHA3_256);
}
#endif

#if defined(CFG_CRYPTO_SHA3_384)
TEE_Result crypto_sha3_384_alloc_ctx(struct crypto_hash_ctx **ctx)
{
return mbed_hash_alloc_ctx(ctx, MBEDTLS_MD_SHA3_384);
}
#endif

#if defined(CFG_CRYPTO_SHA3_512)
TEE_Result crypto_sha3_512_alloc_ctx(struct crypto_hash_ctx **ctx)
{
return mbed_hash_alloc_ctx(ctx, MBEDTLS_MD_SHA3_512);
}
#endif

#if defined(CFG_CRYPTO_SHA256)
TEE_Result hash_sha256_check(const uint8_t *hash, const uint8_t *data,
size_t data_size)
Expand Down
28 changes: 28 additions & 0 deletions lib/libmbedtls/core/hmac.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,31 @@ TEE_Result crypto_hmac_sha512_alloc_ctx(struct crypto_mac_ctx **ctx)
return mbed_hmac_alloc_ctx(ctx, MBEDTLS_MD_SHA512);
}
#endif

#if defined(CFG_CRYPTO_SHA3_224)
TEE_Result crypto_hmac_sha3_224_alloc_ctx(struct crypto_mac_ctx **ctx)
{
return mbed_hmac_alloc_ctx(ctx, MBEDTLS_MD_SHA3_224);
}
#endif

#if defined(CFG_CRYPTO_SHA3_256)
TEE_Result crypto_hmac_sha3_256_alloc_ctx(struct crypto_mac_ctx **ctx)
{
return mbed_hmac_alloc_ctx(ctx, MBEDTLS_MD_SHA3_256);
}
#endif

#if defined(CFG_CRYPTO_SHA3_384)
TEE_Result crypto_hmac_sha3_384_alloc_ctx(struct crypto_mac_ctx **ctx)
{
return mbed_hmac_alloc_ctx(ctx, MBEDTLS_MD_SHA3_384);
}
#endif

#if defined(CFG_CRYPTO_SHA3_512)
TEE_Result crypto_hmac_sha3_512_alloc_ctx(struct crypto_mac_ctx **ctx)
{
return mbed_hmac_alloc_ctx(ctx, MBEDTLS_MD_SHA3_512);
}
#endif

0 comments on commit aad7ff8

Please sign in to comment.