Browse Source

tests: crypto: crypto_hash: Add support for Smartbond Pro DevKit

This commit should add support for the DA1469x Pro DevKit.

Signed-off-by: Ioannis Karachalios <ioannis.karachalios.px@renesas.com>
pull/73547/head
Ioannis Karachalios 1 year ago committed by David Leach
parent
commit
816cf7051b
  1. 9
      tests/crypto/crypto_hash/boards/da1469x_dk_pro.overlay
  2. 10
      tests/crypto/crypto_hash/prj.conf
  3. 10
      tests/crypto/crypto_hash/prj_mtls_shim.conf
  4. 21
      tests/crypto/crypto_hash/src/main.c
  5. 1
      tests/crypto/crypto_hash/testcase.yaml

9
tests/crypto/crypto_hash/boards/da1469x_dk_pro.overlay

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
/*
* Copyright (c) 2023 Renesas Electronics Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
&crypto {
status = "okay";
};

10
tests/crypto/crypto_hash/prj.conf

@ -1,15 +1,9 @@ @@ -1,15 +1,9 @@
CONFIG_ZTEST_STACK_SIZE=4096
CONFIG_ZTEST=y
CONFIG_LOG=y
CONFIG_LOG_MODE_MINIMAL=y
CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_BUILTIN=y
CONFIG_MBEDTLS_TEST=y
CONFIG_MBEDTLS_CIPHER_CCM_ENABLED=y
CONFIG_MBEDTLS_CIPHER_GCM_ENABLED=y
CONFIG_MBEDTLS_HEAP_SIZE=512
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_CRYPTO=y
CONFIG_CRYPTO_MBEDTLS_SHIM=y
CONFIG_CRYPTO_LOG_LEVEL_DBG=y

10
tests/crypto/crypto_hash/prj_mtls_shim.conf

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
CONFIG_MBEDTLS=y
CONFIG_MBEDTLS_BUILTIN=y
CONFIG_MBEDTLS_TEST=y
CONFIG_MBEDTLS_HEAP_SIZE=512
CONFIG_MBEDTLS_CIPHER_CCM_ENABLED=y
CONFIG_MBEDTLS_CIPHER_GCM_ENABLED=y
CONFIG_CRYPTO_MBEDTLS_SHIM=y

21
tests/crypto/crypto_hash/src/main.c

@ -6,8 +6,16 @@ @@ -6,8 +6,16 @@
#include <zephyr/ztest.h>
#include <zephyr/crypto/crypto.h>
#include <zephyr/kernel.h>
#include <zephyr/device.h>
#ifdef CONFIG_CRYPTO_MBEDTLS_SHIM
#define CRYPTO_DRV_NAME CONFIG_CRYPTO_MBEDTLS_SHIM_DRV_NAME
#elif DT_HAS_COMPAT_STATUS_OKAY(renesas_smartbond_crypto)
#define CRYPTO_DEV_COMPAT renesas_smartbond_crypto
#else
#error "You need to enable one crypto device"
#endif
/* Following test are part of mbedTLS */
@ -128,8 +136,21 @@ ZTEST_USER(crypto_hash, test_hash) @@ -128,8 +136,21 @@ ZTEST_USER(crypto_hash, test_hash)
{
int ret;
struct hash_ctx ctx;
#ifdef CRYPTO_DRV_NAME
const struct device *dev = device_get_binding(CRYPTO_DRV_NAME);
if (!dev) {
zassert(0, "Crypto device is not ready");
}
#else
const struct device *dev = DEVICE_DT_GET_ONE(CRYPTO_DEV_COMPAT);
if (!device_is_ready(dev)) {
zassert(0, "Crypto device is not ready");
}
#endif
ctx.flags = CAP_SYNC_OPS | CAP_SEPARATE_IO_BUFS;
ret = hash_begin_session(dev, &ctx, CRYPTO_HASH_ALGO_SHA256);

1
tests/crypto/crypto_hash/testcase.yaml

@ -5,4 +5,5 @@ tests: @@ -5,4 +5,5 @@ tests:
- native_sim
integration_platforms:
- native_sim
extra_args: EXTRA_CONF_FILE=prj_mtls_shim.conf
tags: crypto

Loading…
Cancel
Save