luckfox-pico-sdk/media/security/librkcrypto/test/test_stress.c
luckfox-eng29 8f34c2760d project:build.sh: Added fastboot support; custom modifications to U-Boot and kernel implemented using patches.
project:cfg:BoardConfig_IPC: Added fastboot BoardConfig file and firmware post-scripts, distinguishing between
the BoardConfigs for Luckfox Pico Pro and Luckfox Pico Max. project:app: Added fastboot_client and rk_smart_door
for quick boot applications; updated rkipc app to adapt to the latest media library. media:samples: Added more
usage examples. media:rockit: Fixed bugs; removed support for retrieving data frames from VPSS. media:isp:
Updated rkaiq library and related tools to support connection to RKISP_Tuner. sysdrv:Makefile: Added support for
compiling drv_ko on Luckfox Pico Ultra W using Ubuntu; added support for custom root filesystem.
sysdrv:tools:board: Updated Buildroot optional mirror sources, updated some software versions, and stored device
tree files and configuration files that undergo multiple modifications for U-Boot and kernel separately.
sysdrv:source:mcu: Used RISC-V MCU SDK with RT-Thread system, mainly for initializing camera AE during quick
boot. sysdrv:source:uboot: Added support for fastboot; added high baud rate DDR bin for serial firmware upgrades.
sysdrv:source:kernel: Upgraded to version 5.10.160; increased NPU frequency for RV1106G3; added support for
fastboot.

Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
2024-10-14 09:47:04 +08:00

68 lines
1.4 KiB
C

/*
* Copyright (c) 2022 Rockchip Electronics Co. Ltd.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "rkcrypto_random.h"
#include "test_cipher.h"
#include "test_hash.h"
#include "test_rsa.h"
#include "test_stress.h"
#include "test_utils.h"
typedef RK_RES (*test_func)(int verbose);
struct test_stress_item {
test_func func;
const char *name;
};
#define DEFINE_STRESS_ITEM(_func) {\
.func = _func, \
.name = #_func, \
}
struct test_stress_item test_stress_tbl[] = {
DEFINE_STRESS_ITEM(test_cipher),
DEFINE_STRESS_ITEM(test_hash),
DEFINE_STRESS_ITEM(test_hmac),
DEFINE_STRESS_ITEM(test_rsa),
};
void stress_test(int test_cnt)
{
int i;
uint32_t j;
int verbose = 0;
RK_RES res;
uint32_t tbl_len = ARRAY_SIZE(test_stress_tbl);
uint8_t rand_buf[ARRAY_SIZE(test_stress_tbl)];
printf("===================== stress test begin =====================\n");
for (i = 0; i < test_cnt; i++) {
printf("stress test %d/%d...\n", i + 1, test_cnt);
res = rk_get_random(rand_buf, tbl_len);
if (res) {
printf("rk_get_random failed %x\n",res);
goto exit;
}
for (j = 0; j < tbl_len; j++) {
uint32_t index = rand_buf[j] % tbl_len;
res = test_stress_tbl[index].func(verbose);
if (res) {
printf("%s error[%x]\n", test_stress_tbl[index].name, res);
goto exit;
}
}
}
printf("===================== stress test finish =====================\n");
exit:
return;
}