blob: c170e11702c97fa0b9e2b6380bfba1c0ab597169 [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);
Etienne Carriere21f4e3c2020-02-05 15:40:24 +010044
45 rv = C_Finalize(NULL);
46 ADBG_EXPECT_CK_RESULT(c, CKR_CRYPTOKI_NOT_INITIALIZED, rv);
Etienne Carriere109c1d72019-01-09 11:02:02 +010047}
48
49ADBG_CASE_DEFINE(pkcs11, 1000, xtest_tee_test_1000,
50 "Initialize and close Cryptoki library");