1 /* SPDX-License-Identifier: BSD-2-Clause */ 2 /* 3 * Copyright (c) 2015, Linaro Limited 4 * All rights reserved. 5 */ 6 7 #ifndef XTEST_CRYPTO_COMMON_H 8 #define XTEST_CRYPTO_COMMON_H 9 10 #include "ta_aes_perf.h" 11 #include "ta_sha_perf.h" 12 13 14 15 16 #define AES_PERF_INPLACE 0 17 18 #define CRYPTO_DEF_LOOPS 1 /* Default amount of inner loops */ 19 20 #define CRYPTO_USE_ZEROS 0 /* Init input data to zero */ 21 #define CRYPTO_USE_RANDOM 1 /* Get input data from /dev/urandom */ 22 #define CRYPTO_NOT_INITED 2 /* Input data are not initialized */ 23 24 #define CRYPTO_DEF_WARMUP 2 /* Start with a 2-second busy loop */ 25 #define CRYPTO_DEF_COUNT 5000 /* Default number of measurements */ 26 #define CRYPTO_DEF_VERBOSITY 0 27 #define CRYPTO_DEF_UNIT_SIZE 0 /* Process whole buffer */ 28 29 30 #define _verbose(lvl, ...) \ 31 do { \ 32 if (verbosity >= lvl) { \ 33 printf(__VA_ARGS__); \ 34 fflush(stdout); \ 35 } \ 36 } while (0) 37 38 #define verbose(...) _verbose(1, __VA_ARGS__) 39 #define vverbose(...) _verbose(2, __VA_ARGS__) 40 41 42 int aes_perf_runner_cmd_parser(int argc, char *argv[]); 43 void aes_perf_run_test(int mode, int keysize, int decrypt, size_t size, 44 size_t unit, unsigned int n, unsigned int l, 45 int random_in, int in_place, int warmup, int verbosity); 46 47 int sha_perf_runner_cmd_parser(int argc, char *argv[]); 48 void sha_perf_run_test(int algo, size_t size, unsigned int n, 49 unsigned int l, int random_in, int offset, 50 int warmup, int verbosity); 51 52 #ifdef CFG_SECURE_DATA_PATH 53 int sdp_basic_runner_cmd_parser(int argc, char *argv[]); 54 #endif 55 56 #endif /* XTEST_CRYPTO_PERF_H */ 57