1 // SPDX-License-Identifier: BSD-2-Clause
2 /*
3  * Copyright (c) 2020, Linaro Limited
4  */
5 
6 #include <assert.h>
7 #include <ck_debug.h>
8 #include <pkcs11.h>
9 #include <stdio.h>
10 #include <tee_client_api.h>
11 
12 #include "ck_helpers.h"
13 
14 #ifdef DEBUG
ckteec_assert_expected_rv(const char * function,CK_RV rv,const CK_RV * expected_rv,size_t expected_count)15 void ckteec_assert_expected_rv(const char *function, CK_RV rv,
16 			       const CK_RV *expected_rv, size_t expected_count)
17 {
18 	size_t n = 0;
19 
20 	for (n = 0; n < expected_count; n++)
21 		if (rv == expected_rv[n])
22 			return;
23 
24 	fprintf(stderr, "libckteec: %s: unexpected return value 0x%lx (%s)\n",
25 		function, rv, ckr2str(rv));
26 
27 	assert(0);
28 }
29 #endif
30