blob: d2805e0a49c570c557dfa8207fda6fca52c787be [file] [log] [blame]
Etienne Carriere109c1d72019-01-09 11:02:02 +01001/*
2 * Copyright (c) 2018, Linaro Limited
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License Version 2 as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 */
13
14#include <stdio.h>
15#include <string.h>
16#include <inttypes.h>
17
18#include <pkcs11.h>
19
20#include "xtest_test.h"
21#include "xtest_helpers.h"
22
23static void xtest_tee_test_1000(ADBG_Case_t *c)
24{
25 CK_RV rv;
26
27 rv = C_Initialize(NULL);
28 if (!ADBG_EXPECT_CK_OK(c, rv))
29 return;
30
31 rv = C_Finalize(NULL);
32 if (!ADBG_EXPECT_CK_OK(c, rv))
33 return;
34
35 rv = C_Initialize(NULL);
36 if (!ADBG_EXPECT_CK_OK(c, rv))
37 return;
38
39 rv = C_Initialize(NULL);
40 ADBG_EXPECT_CK_RESULT(c, CKR_CRYPTOKI_ALREADY_INITIALIZED, rv);
41
42 rv = C_Finalize(NULL);
43 ADBG_EXPECT_CK_OK(c, rv);
44}
45
46ADBG_CASE_DEFINE(pkcs11, 1000, xtest_tee_test_1000,
47 "Initialize and close Cryptoki library");