diff options
Diffstat (limited to 'test/validation/api/crypto/util.h')
-rw-r--r-- | test/validation/api/crypto/util.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/test/validation/api/crypto/util.h b/test/validation/api/crypto/util.h new file mode 100644 index 000000000..a81a56820 --- /dev/null +++ b/test/validation/api/crypto/util.h @@ -0,0 +1,50 @@ +/* Copyright (c) 2014-2018, Linaro Limited + * Copyright (c) 2021-2023, Nokia + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef UTIL_H +#define UTIL_H + +#include <stdint.h> +#include <odp_api.h> +#include <odp_cunit_common.h> + +#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) + +struct suite_context_s { + odp_crypto_op_mode_t op_mode; + odp_pool_t pool; + odp_queue_t queue; + odp_queue_type_t q_type; + odp_event_t (*compl_queue_deq)(void); +}; + +extern struct suite_context_s suite_context; + +const char *auth_alg_name(odp_auth_alg_t auth); + +const char *cipher_alg_name(odp_cipher_alg_t cipher); + +/* + * Check if given cipher and authentication algorithms are supported + * + * cipher Cipher algorithm + * auth Authentication algorithm + * + * returns ODP_TEST_ACTIVE when both algorithms are supported or + * ODP_TEST_INACTIVE when either algorithm is not supported + */ +int check_alg_support(odp_cipher_alg_t cipher, odp_auth_alg_t auth); + +static inline void fill_with_pattern(uint8_t *buf, uint32_t len) +{ + static uint8_t value; + + for (uint32_t n = 0; n < len; n++) + buf[n] = value++; +} + +#endif |