1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /*******************************************************************************
3 * Copyright 2017-2018, Fraunhofer SIT sponsored by Infineon Technologies AG
4 * All rights reserved.
5 *******************************************************************************/
6
7 #ifdef HAVE_CONFIG_H
8 #include <config.h>
9 #endif
10
11 #include <stdio.h>
12 #include <stdlib.h>
13 #include <string.h>
14 #include <signal.h>
15 #include <stdint.h>
16 #define LOGMODULE test
17 #include "util/log.h"
18 #include "util/aux_util.h"
19 #include "tss2-sys/sysapi_util.h"
20 #include <tss2_esys.h>
21 #include "esys_types.h"
22 #include "esys_iutil.h"
23
24 #include <setjmp.h>
25 #include <cmocka.h>
26
27 /**
28 * This unit test checks whether all Esys_<cmd>() functions (one call, async,
29 * and finish check the NULL pointer ESAPI context.
30 */
31
32 void
check_Startup(void ** state)33 check_Startup(void **state)
34 {
35 TSS2_RC r;
36
37 r = Esys_Startup(NULL, 0);
38 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
39
40 r = Esys_Startup_Async(NULL, 0);
41 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
42
43 r = Esys_Startup_Finish(NULL);
44 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
45 }
46
47 void
check_Shutdown(void ** state)48 check_Shutdown(void **state)
49 {
50 TSS2_RC r;
51
52 r = Esys_Shutdown(NULL, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, 0);
53 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
54
55 r = Esys_Shutdown_Async(NULL, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, 0);
56 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
57
58 r = Esys_Shutdown_Finish(NULL);
59 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
60 }
61
62 void
check_SelfTest(void ** state)63 check_SelfTest(void **state)
64 {
65 TSS2_RC r;
66
67 r = Esys_SelfTest(NULL, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, 0);
68 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
69
70 r = Esys_SelfTest_Async(NULL, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, 0);
71 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
72
73 r = Esys_SelfTest_Finish(NULL);
74 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
75 }
76
77 void
check_IncrementalSelfTest(void ** state)78 check_IncrementalSelfTest(void **state)
79 {
80 TSS2_RC r;
81
82 r = Esys_IncrementalSelfTest(NULL,
83 ESYS_TR_NONE,
84 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL);
85 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
86
87 r = Esys_IncrementalSelfTest_Async(NULL,
88 ESYS_TR_NONE,
89 ESYS_TR_NONE, ESYS_TR_NONE, NULL);
90 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
91
92 r = Esys_IncrementalSelfTest_Finish(NULL, NULL);
93 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
94 }
95
96 void
check_GetTestResult(void ** state)97 check_GetTestResult(void **state)
98 {
99 TSS2_RC r;
100
101 r = Esys_GetTestResult(NULL,
102 ESYS_TR_NONE,
103 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL);
104 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
105
106 r = Esys_GetTestResult_Async(NULL,
107 ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE);
108 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
109
110 r = Esys_GetTestResult_Finish(NULL, NULL, NULL);
111 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
112 }
113
114 void
check_StartAuthSession(void ** state)115 check_StartAuthSession(void **state)
116 {
117 TSS2_RC r;
118
119 r = Esys_StartAuthSession(NULL,
120 0,
121 0,
122 ESYS_TR_NONE,
123 ESYS_TR_NONE,
124 ESYS_TR_NONE, NULL, 0, NULL, 0, NULL);
125 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
126
127 r = Esys_StartAuthSession_Async(NULL,
128 0,
129 0,
130 ESYS_TR_NONE,
131 ESYS_TR_NONE,
132 ESYS_TR_NONE, NULL, 0, NULL, 0);
133 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
134
135 r = Esys_StartAuthSession_Finish(NULL, NULL);
136 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
137 }
138
139 void
check_PolicyRestart(void ** state)140 check_PolicyRestart(void **state)
141 {
142 TSS2_RC r;
143
144 r = Esys_PolicyRestart(NULL, 0, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE);
145 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
146
147 r = Esys_PolicyRestart_Async(NULL,
148 0, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE);
149 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
150
151 r = Esys_PolicyRestart_Finish(NULL);
152 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
153 }
154
155 void
check_Create(void ** state)156 check_Create(void **state)
157 {
158 TSS2_RC r;
159
160 r = Esys_Create(NULL,
161 0,
162 ESYS_TR_PASSWORD,
163 ESYS_TR_NONE,
164 ESYS_TR_NONE,
165 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
166 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
167
168 r = Esys_Create_Async(NULL,
169 0,
170 ESYS_TR_PASSWORD,
171 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL, NULL, NULL);
172 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
173
174 r = Esys_Create_Finish(NULL, NULL, NULL, NULL, NULL, NULL);
175 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
176 }
177
178 void
check_Load(void ** state)179 check_Load(void **state)
180 {
181 TSS2_RC r;
182
183 r = Esys_Load(NULL,
184 0,
185 ESYS_TR_PASSWORD,
186 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL, NULL);
187 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
188
189 r = Esys_Load_Async(NULL,
190 0,
191 ESYS_TR_PASSWORD,
192 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL);
193 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
194
195 r = Esys_Load_Finish(NULL, NULL);
196 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
197 }
198
199 void
check_LoadExternal(void ** state)200 check_LoadExternal(void **state)
201 {
202 TSS2_RC r;
203
204 r = Esys_LoadExternal(NULL,
205 ESYS_TR_NONE,
206 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL, 0, NULL);
207 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
208
209 r = Esys_LoadExternal_Async(NULL,
210 ESYS_TR_NONE,
211 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL, 0);
212 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
213
214 r = Esys_LoadExternal_Finish(NULL, NULL);
215 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
216 }
217
218 void
check_ReadPublic(void ** state)219 check_ReadPublic(void **state)
220 {
221 TSS2_RC r;
222
223 r = Esys_ReadPublic(NULL,
224 0,
225 ESYS_TR_NONE,
226 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL, NULL);
227 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
228
229 r = Esys_ReadPublic_Async(NULL,
230 0, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE);
231 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
232
233 r = Esys_ReadPublic_Finish(NULL, NULL, NULL, NULL);
234 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
235 }
236
237 void
check_ActivateCredential(void ** state)238 check_ActivateCredential(void **state)
239 {
240 TSS2_RC r;
241
242 r = Esys_ActivateCredential(NULL,
243 0,
244 0,
245 ESYS_TR_PASSWORD,
246 ESYS_TR_PASSWORD,
247 ESYS_TR_NONE, NULL, NULL, NULL);
248 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
249
250 r = Esys_ActivateCredential_Async(NULL,
251 0,
252 0,
253 ESYS_TR_PASSWORD,
254 ESYS_TR_PASSWORD,
255 ESYS_TR_NONE, NULL, NULL);
256 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
257
258 r = Esys_ActivateCredential_Finish(NULL, NULL);
259 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
260 }
261
262 void
check_MakeCredential(void ** state)263 check_MakeCredential(void **state)
264 {
265 TSS2_RC r;
266
267 r = Esys_MakeCredential(NULL,
268 0,
269 ESYS_TR_NONE,
270 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL, NULL, NULL);
271 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
272
273 r = Esys_MakeCredential_Async(NULL,
274 0,
275 ESYS_TR_NONE,
276 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL);
277 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
278
279 r = Esys_MakeCredential_Finish(NULL, NULL, NULL);
280 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
281 }
282
283 void
check_Unseal(void ** state)284 check_Unseal(void **state)
285 {
286 TSS2_RC r;
287
288 r = Esys_Unseal(NULL,
289 0, ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE, NULL);
290 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
291
292 r = Esys_Unseal_Async(NULL,
293 0, ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE);
294 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
295
296 r = Esys_Unseal_Finish(NULL, NULL);
297 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
298 }
299
300 void
check_ObjectChangeAuth(void ** state)301 check_ObjectChangeAuth(void **state)
302 {
303 TSS2_RC r;
304
305 r = Esys_ObjectChangeAuth(NULL,
306 0,
307 0,
308 ESYS_TR_PASSWORD,
309 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL);
310 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
311
312 r = Esys_ObjectChangeAuth_Async(NULL,
313 0,
314 0,
315 ESYS_TR_PASSWORD,
316 ESYS_TR_NONE, ESYS_TR_NONE, NULL);
317 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
318
319 r = Esys_ObjectChangeAuth_Finish(NULL, NULL);
320 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
321 }
322
323 void
check_CreateLoaded(void ** state)324 check_CreateLoaded(void **state)
325 {
326 TSS2_RC r;
327
328 r = Esys_CreateLoaded(NULL,
329 0,
330 ESYS_TR_PASSWORD,
331 ESYS_TR_NONE,
332 ESYS_TR_NONE, NULL, NULL, NULL, NULL, NULL);
333 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
334
335 r = Esys_CreateLoaded_Async(NULL,
336 0,
337 ESYS_TR_PASSWORD,
338 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL);
339 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
340
341 r = Esys_CreateLoaded_Finish(NULL, NULL, NULL, NULL);
342 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
343 }
344
345 void
check_Duplicate(void ** state)346 check_Duplicate(void **state)
347 {
348 TSS2_RC r;
349
350 r = Esys_Duplicate(NULL,
351 0,
352 0,
353 ESYS_TR_PASSWORD,
354 ESYS_TR_NONE,
355 ESYS_TR_NONE, NULL, NULL, NULL, NULL, NULL);
356 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
357
358 r = Esys_Duplicate_Async(NULL,
359 0,
360 0,
361 ESYS_TR_PASSWORD,
362 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL);
363 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
364
365 r = Esys_Duplicate_Finish(NULL, NULL, NULL, NULL);
366 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
367 }
368
369 void
check_Rewrap(void ** state)370 check_Rewrap(void **state)
371 {
372 TSS2_RC r;
373
374 r = Esys_Rewrap(NULL,
375 0,
376 0,
377 ESYS_TR_PASSWORD,
378 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL, NULL, NULL, NULL);
379 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
380
381 r = Esys_Rewrap_Async(NULL,
382 0,
383 0,
384 ESYS_TR_PASSWORD,
385 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL, NULL);
386 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
387
388 r = Esys_Rewrap_Finish(NULL, NULL, NULL);
389 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
390 }
391
392 void
check_Import(void ** state)393 check_Import(void **state)
394 {
395 TSS2_RC r;
396
397 r = Esys_Import(NULL,
398 0,
399 ESYS_TR_PASSWORD,
400 ESYS_TR_NONE,
401 ESYS_TR_NONE, NULL, NULL, NULL, NULL, NULL, NULL);
402 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
403
404 r = Esys_Import_Async(NULL,
405 0,
406 ESYS_TR_PASSWORD,
407 ESYS_TR_NONE,
408 ESYS_TR_NONE, NULL, NULL, NULL, NULL, NULL);
409 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
410
411 r = Esys_Import_Finish(NULL, NULL);
412 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
413 }
414
415 void
check_RSA_Encrypt(void ** state)416 check_RSA_Encrypt(void **state)
417 {
418 TSS2_RC r;
419
420 r = Esys_RSA_Encrypt(NULL,
421 0,
422 ESYS_TR_NONE,
423 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL, NULL, NULL);
424 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
425
426 r = Esys_RSA_Encrypt_Async(NULL,
427 0,
428 ESYS_TR_NONE,
429 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL, NULL);
430 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
431
432 r = Esys_RSA_Encrypt_Finish(NULL, NULL);
433 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
434 }
435
436 void
check_RSA_Decrypt(void ** state)437 check_RSA_Decrypt(void **state)
438 {
439 TSS2_RC r;
440
441 r = Esys_RSA_Decrypt(NULL,
442 0,
443 ESYS_TR_PASSWORD,
444 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL, NULL, NULL);
445 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
446
447 r = Esys_RSA_Decrypt_Async(NULL,
448 0,
449 ESYS_TR_PASSWORD,
450 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL, NULL);
451 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
452
453 r = Esys_RSA_Decrypt_Finish(NULL, NULL);
454 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
455 }
456
457 void
check_ECDH_KeyGen(void ** state)458 check_ECDH_KeyGen(void **state)
459 {
460 TSS2_RC r;
461
462 r = Esys_ECDH_KeyGen(NULL,
463 0,
464 ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL);
465 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
466
467 r = Esys_ECDH_KeyGen_Async(NULL,
468 0, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE);
469 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
470
471 r = Esys_ECDH_KeyGen_Finish(NULL, NULL, NULL);
472 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
473 }
474
475 void
check_ECDH_ZGen(void ** state)476 check_ECDH_ZGen(void **state)
477 {
478 TSS2_RC r;
479
480 r = Esys_ECDH_ZGen(NULL,
481 0,
482 ESYS_TR_PASSWORD,
483 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL);
484 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
485
486 r = Esys_ECDH_ZGen_Async(NULL,
487 0,
488 ESYS_TR_PASSWORD,
489 ESYS_TR_NONE, ESYS_TR_NONE, NULL);
490 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
491
492 r = Esys_ECDH_ZGen_Finish(NULL, NULL);
493 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
494 }
495
496 void
check_ECC_Parameters(void ** state)497 check_ECC_Parameters(void **state)
498 {
499 TSS2_RC r;
500
501 r = Esys_ECC_Parameters(NULL,
502 ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, 0, NULL);
503 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
504
505 r = Esys_ECC_Parameters_Async(NULL,
506 ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, 0);
507 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
508
509 r = Esys_ECC_Parameters_Finish(NULL, NULL);
510 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
511 }
512
513 void
check_ZGen_2Phase(void ** state)514 check_ZGen_2Phase(void **state)
515 {
516 TSS2_RC r;
517
518 r = Esys_ZGen_2Phase(NULL,
519 0,
520 ESYS_TR_PASSWORD,
521 ESYS_TR_NONE,
522 ESYS_TR_NONE, NULL, NULL, 0, 0, NULL, NULL);
523 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
524
525 r = Esys_ZGen_2Phase_Async(NULL,
526 0,
527 ESYS_TR_PASSWORD,
528 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL, 0, 0);
529 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
530
531 r = Esys_ZGen_2Phase_Finish(NULL, NULL, NULL);
532 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
533 }
534
535 void
check_EncryptDecrypt(void ** state)536 check_EncryptDecrypt(void **state)
537 {
538 TSS2_RC r;
539
540 r = Esys_EncryptDecrypt(NULL,
541 0,
542 ESYS_TR_PASSWORD,
543 ESYS_TR_NONE,
544 ESYS_TR_NONE, 0, 0, NULL, NULL, NULL, NULL);
545 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
546
547 r = Esys_EncryptDecrypt_Async(NULL,
548 0,
549 ESYS_TR_PASSWORD,
550 ESYS_TR_NONE, ESYS_TR_NONE, 0, 0, NULL, NULL);
551 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
552
553 r = Esys_EncryptDecrypt_Finish(NULL, NULL, NULL);
554 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
555 }
556
557 void
check_EncryptDecrypt2(void ** state)558 check_EncryptDecrypt2(void **state)
559 {
560 TSS2_RC r;
561
562 r = Esys_EncryptDecrypt2(NULL,
563 0,
564 ESYS_TR_PASSWORD,
565 ESYS_TR_NONE,
566 ESYS_TR_NONE, NULL, 0, 0, NULL, NULL, NULL);
567 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
568
569 r = Esys_EncryptDecrypt2_Async(NULL,
570 0,
571 ESYS_TR_PASSWORD,
572 ESYS_TR_NONE,
573 ESYS_TR_NONE, NULL, 0, 0, NULL);
574 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
575
576 r = Esys_EncryptDecrypt2_Finish(NULL, NULL, NULL);
577 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
578 }
579
580 void
check_Hash(void ** state)581 check_Hash(void **state)
582 {
583 TSS2_RC r;
584
585 r = Esys_Hash(NULL,
586 ESYS_TR_NONE,
587 ESYS_TR_NONE, ESYS_TR_NONE, NULL, 0, 0, NULL, NULL);
588 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
589
590 r = Esys_Hash_Async(NULL,
591 ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, NULL, 0, 0);
592 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
593
594 r = Esys_Hash_Finish(NULL, NULL, NULL);
595 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
596 }
597
598 void
check_HMAC(void ** state)599 check_HMAC(void **state)
600 {
601 TSS2_RC r;
602
603 r = Esys_HMAC(NULL,
604 0,
605 ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE, NULL, 0, NULL);
606 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
607
608 r = Esys_HMAC_Async(NULL,
609 0,
610 ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE, NULL, 0);
611 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
612
613 r = Esys_HMAC_Finish(NULL, NULL);
614 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
615 }
616
617 void
check_GetRandom(void ** state)618 check_GetRandom(void **state)
619 {
620 TSS2_RC r;
621
622 r = Esys_GetRandom(NULL, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, 0, NULL);
623 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
624
625 r = Esys_GetRandom_Async(NULL, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, 0);
626 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
627
628 r = Esys_GetRandom_Finish(NULL, NULL);
629 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
630 }
631
632 void
check_StirRandom(void ** state)633 check_StirRandom(void **state)
634 {
635 TSS2_RC r;
636
637 r = Esys_StirRandom(NULL, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, NULL);
638 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
639
640 r = Esys_StirRandom_Async(NULL,
641 ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, NULL);
642 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
643
644 r = Esys_StirRandom_Finish(NULL);
645 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
646 }
647
648 void
check_HMAC_Start(void ** state)649 check_HMAC_Start(void **state)
650 {
651 TSS2_RC r;
652
653 r = Esys_HMAC_Start(NULL,
654 0,
655 ESYS_TR_PASSWORD,
656 ESYS_TR_NONE, ESYS_TR_NONE, NULL, 0, NULL);
657 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
658
659 r = Esys_HMAC_Start_Async(NULL,
660 0,
661 ESYS_TR_PASSWORD,
662 ESYS_TR_NONE, ESYS_TR_NONE, NULL, 0);
663 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
664
665 r = Esys_HMAC_Start_Finish(NULL, NULL);
666 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
667 }
668
669 void
check_HashSequenceStart(void ** state)670 check_HashSequenceStart(void **state)
671 {
672 TSS2_RC r;
673
674 r = Esys_HashSequenceStart(NULL,
675 ESYS_TR_NONE,
676 ESYS_TR_NONE, ESYS_TR_NONE, NULL, 0, NULL);
677 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
678
679 r = Esys_HashSequenceStart_Async(NULL,
680 ESYS_TR_NONE,
681 ESYS_TR_NONE, ESYS_TR_NONE, NULL, 0);
682 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
683
684 r = Esys_HashSequenceStart_Finish(NULL, NULL);
685 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
686 }
687
688 void
check_SequenceUpdate(void ** state)689 check_SequenceUpdate(void **state)
690 {
691 TSS2_RC r;
692
693 r = Esys_SequenceUpdate(NULL,
694 0,
695 ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE, NULL);
696 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
697
698 r = Esys_SequenceUpdate_Async(NULL,
699 0,
700 ESYS_TR_PASSWORD,
701 ESYS_TR_NONE, ESYS_TR_NONE, NULL);
702 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
703
704 r = Esys_SequenceUpdate_Finish(NULL);
705 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
706 }
707
708 void
check_SequenceComplete(void ** state)709 check_SequenceComplete(void **state)
710 {
711 TSS2_RC r;
712
713 r = Esys_SequenceComplete(NULL,
714 0,
715 ESYS_TR_PASSWORD,
716 ESYS_TR_NONE, ESYS_TR_NONE, NULL, 0, NULL, NULL);
717 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
718
719 r = Esys_SequenceComplete_Async(NULL,
720 0,
721 ESYS_TR_PASSWORD,
722 ESYS_TR_NONE, ESYS_TR_NONE, NULL, 0);
723 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
724
725 r = Esys_SequenceComplete_Finish(NULL, NULL, NULL);
726 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
727 }
728
729 void
check_EventSequenceComplete(void ** state)730 check_EventSequenceComplete(void **state)
731 {
732 TSS2_RC r;
733
734 r = Esys_EventSequenceComplete(NULL,
735 0,
736 0,
737 ESYS_TR_PASSWORD,
738 ESYS_TR_PASSWORD, ESYS_TR_NONE, NULL, NULL);
739 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
740
741 r = Esys_EventSequenceComplete_Async(NULL,
742 0,
743 0,
744 ESYS_TR_PASSWORD,
745 ESYS_TR_PASSWORD, ESYS_TR_NONE, NULL);
746 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
747
748 r = Esys_EventSequenceComplete_Finish(NULL, NULL);
749 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
750 }
751
752 void
check_Certify(void ** state)753 check_Certify(void **state)
754 {
755 TSS2_RC r;
756
757 r = Esys_Certify(NULL,
758 0,
759 0,
760 ESYS_TR_PASSWORD,
761 ESYS_TR_PASSWORD, ESYS_TR_NONE, NULL, NULL, NULL, NULL);
762 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
763
764 r = Esys_Certify_Async(NULL,
765 0,
766 0,
767 ESYS_TR_PASSWORD,
768 ESYS_TR_PASSWORD, ESYS_TR_NONE, NULL, NULL);
769 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
770
771 r = Esys_Certify_Finish(NULL, NULL, NULL);
772 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
773 }
774
775 void
check_CertifyCreation(void ** state)776 check_CertifyCreation(void **state)
777 {
778 TSS2_RC r;
779
780 r = Esys_CertifyCreation(NULL,
781 0,
782 0,
783 ESYS_TR_PASSWORD,
784 ESYS_TR_NONE,
785 ESYS_TR_NONE, NULL, NULL, NULL, NULL, NULL, NULL);
786 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
787
788 r = Esys_CertifyCreation_Async(NULL,
789 0,
790 0,
791 ESYS_TR_PASSWORD,
792 ESYS_TR_NONE,
793 ESYS_TR_NONE, NULL, NULL, NULL, NULL);
794 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
795
796 r = Esys_CertifyCreation_Finish(NULL, NULL, NULL);
797 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
798 }
799
800 void
check_Quote(void ** state)801 check_Quote(void **state)
802 {
803 TSS2_RC r;
804
805 r = Esys_Quote(NULL,
806 0,
807 ESYS_TR_PASSWORD,
808 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL, NULL, NULL, NULL);
809 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
810
811 r = Esys_Quote_Async(NULL,
812 0,
813 ESYS_TR_PASSWORD,
814 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL, NULL);
815 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
816
817 r = Esys_Quote_Finish(NULL, NULL, NULL);
818 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
819 }
820
821 void
check_GetSessionAuditDigest(void ** state)822 check_GetSessionAuditDigest(void **state)
823 {
824 TSS2_RC r;
825
826 r = Esys_GetSessionAuditDigest(NULL,
827 0,
828 0,
829 0,
830 ESYS_TR_PASSWORD,
831 ESYS_TR_PASSWORD,
832 ESYS_TR_NONE, NULL, NULL, NULL, NULL);
833 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
834
835 r = Esys_GetSessionAuditDigest_Async(NULL,
836 0,
837 0,
838 0,
839 ESYS_TR_PASSWORD,
840 ESYS_TR_PASSWORD,
841 ESYS_TR_NONE, NULL, NULL);
842 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
843
844 r = Esys_GetSessionAuditDigest_Finish(NULL, NULL, NULL);
845 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
846 }
847
848 void
check_GetCommandAuditDigest(void ** state)849 check_GetCommandAuditDigest(void **state)
850 {
851 TSS2_RC r;
852
853 r = Esys_GetCommandAuditDigest(NULL,
854 0,
855 0,
856 ESYS_TR_PASSWORD,
857 ESYS_TR_PASSWORD,
858 ESYS_TR_NONE, NULL, NULL, NULL, NULL);
859 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
860
861 r = Esys_GetCommandAuditDigest_Async(NULL,
862 0,
863 0,
864 ESYS_TR_PASSWORD,
865 ESYS_TR_PASSWORD,
866 ESYS_TR_NONE, NULL, NULL);
867 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
868
869 r = Esys_GetCommandAuditDigest_Finish(NULL, NULL, NULL);
870 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
871 }
872
873 void
check_GetTime(void ** state)874 check_GetTime(void **state)
875 {
876 TSS2_RC r;
877
878 r = Esys_GetTime(NULL,
879 0,
880 0,
881 ESYS_TR_PASSWORD,
882 ESYS_TR_PASSWORD, ESYS_TR_NONE, NULL, NULL, NULL, NULL);
883 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
884
885 r = Esys_GetTime_Async(NULL,
886 0,
887 0,
888 ESYS_TR_PASSWORD,
889 ESYS_TR_PASSWORD, ESYS_TR_NONE, NULL, NULL);
890 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
891
892 r = Esys_GetTime_Finish(NULL, NULL, NULL);
893 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
894 }
895
896 void
check_Commit(void ** state)897 check_Commit(void **state)
898 {
899 TSS2_RC r;
900
901 r = Esys_Commit(NULL,
902 0,
903 ESYS_TR_PASSWORD,
904 ESYS_TR_NONE,
905 ESYS_TR_NONE, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
906 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
907
908 r = Esys_Commit_Async(NULL,
909 0,
910 ESYS_TR_PASSWORD,
911 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL, NULL);
912 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
913
914 r = Esys_Commit_Finish(NULL, NULL, NULL, NULL, NULL);
915 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
916 }
917
918 void
check_EC_Ephemeral(void ** state)919 check_EC_Ephemeral(void **state)
920 {
921 TSS2_RC r;
922
923 r = Esys_EC_Ephemeral(NULL,
924 ESYS_TR_NONE,
925 ESYS_TR_NONE, ESYS_TR_NONE, 0, NULL, NULL);
926 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
927
928 r = Esys_EC_Ephemeral_Async(NULL,
929 ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, 0);
930 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
931
932 r = Esys_EC_Ephemeral_Finish(NULL, NULL, NULL);
933 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
934 }
935
936 void
check_VerifySignature(void ** state)937 check_VerifySignature(void **state)
938 {
939 TSS2_RC r;
940
941 r = Esys_VerifySignature(NULL,
942 0,
943 ESYS_TR_NONE,
944 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL, NULL);
945 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
946
947 r = Esys_VerifySignature_Async(NULL,
948 0,
949 ESYS_TR_NONE,
950 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL);
951 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
952
953 r = Esys_VerifySignature_Finish(NULL, NULL);
954 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
955 }
956
957 void
check_Sign(void ** state)958 check_Sign(void **state)
959 {
960 TSS2_RC r;
961
962 r = Esys_Sign(NULL,
963 0,
964 ESYS_TR_PASSWORD,
965 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL, NULL, NULL);
966 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
967
968 r = Esys_Sign_Async(NULL,
969 0,
970 ESYS_TR_PASSWORD,
971 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL, NULL);
972 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
973
974 r = Esys_Sign_Finish(NULL, NULL);
975 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
976 }
977
978 void
check_SetCommandCodeAuditStatus(void ** state)979 check_SetCommandCodeAuditStatus(void **state)
980 {
981 TSS2_RC r;
982
983 r = Esys_SetCommandCodeAuditStatus(NULL,
984 0,
985 ESYS_TR_PASSWORD,
986 ESYS_TR_NONE,
987 ESYS_TR_NONE, 0, NULL, NULL);
988 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
989
990 r = Esys_SetCommandCodeAuditStatus_Async(NULL,
991 0,
992 ESYS_TR_PASSWORD,
993 ESYS_TR_NONE,
994 ESYS_TR_NONE, 0, NULL, NULL);
995 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
996
997 r = Esys_SetCommandCodeAuditStatus_Finish(NULL);
998 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
999 }
1000
1001 void
check_PCR_Extend(void ** state)1002 check_PCR_Extend(void **state)
1003 {
1004 TSS2_RC r;
1005
1006 r = Esys_PCR_Extend(NULL,
1007 0, ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE, NULL);
1008 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1009
1010 r = Esys_PCR_Extend_Async(NULL,
1011 0,
1012 ESYS_TR_PASSWORD,
1013 ESYS_TR_NONE, ESYS_TR_NONE, NULL);
1014 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1015
1016 r = Esys_PCR_Extend_Finish(NULL);
1017 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1018 }
1019
1020 void
check_PCR_Event(void ** state)1021 check_PCR_Event(void **state)
1022 {
1023 TSS2_RC r;
1024
1025 r = Esys_PCR_Event(NULL,
1026 0,
1027 ESYS_TR_PASSWORD,
1028 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL);
1029 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1030
1031 r = Esys_PCR_Event_Async(NULL,
1032 0,
1033 ESYS_TR_PASSWORD,
1034 ESYS_TR_NONE, ESYS_TR_NONE, NULL);
1035 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1036
1037 r = Esys_PCR_Event_Finish(NULL, NULL);
1038 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1039 }
1040
1041 void
check_PCR_Read(void ** state)1042 check_PCR_Read(void **state)
1043 {
1044 TSS2_RC r;
1045
1046 r = Esys_PCR_Read(NULL,
1047 ESYS_TR_NONE,
1048 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL, NULL, NULL);
1049 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1050
1051 r = Esys_PCR_Read_Async(NULL,
1052 ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, NULL);
1053 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1054
1055 r = Esys_PCR_Read_Finish(NULL, NULL, NULL, NULL);
1056 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1057 }
1058
1059 void
check_PCR_Allocate(void ** state)1060 check_PCR_Allocate(void **state)
1061 {
1062 TSS2_RC r;
1063
1064 r = Esys_PCR_Allocate(NULL,
1065 0,
1066 ESYS_TR_PASSWORD,
1067 ESYS_TR_NONE,
1068 ESYS_TR_NONE, NULL, NULL, NULL, NULL, NULL);
1069 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1070
1071 r = Esys_PCR_Allocate_Async(NULL,
1072 0,
1073 ESYS_TR_PASSWORD,
1074 ESYS_TR_NONE, ESYS_TR_NONE, NULL);
1075 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1076
1077 r = Esys_PCR_Allocate_Finish(NULL, NULL, NULL, NULL, NULL);
1078 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1079 }
1080
1081 void
check_PCR_SetAuthPolicy(void ** state)1082 check_PCR_SetAuthPolicy(void **state)
1083 {
1084 TSS2_RC r;
1085
1086 r = Esys_PCR_SetAuthPolicy(NULL,
1087 0,
1088 ESYS_TR_PASSWORD,
1089 ESYS_TR_NONE, ESYS_TR_NONE, NULL, 0, 0);
1090 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1091
1092 r = Esys_PCR_SetAuthPolicy_Async(NULL,
1093 0,
1094 ESYS_TR_PASSWORD,
1095 ESYS_TR_NONE, ESYS_TR_NONE, NULL, 0, 0);
1096 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1097
1098 r = Esys_PCR_SetAuthPolicy_Finish(NULL);
1099 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1100 }
1101
1102 void
check_PCR_SetAuthValue(void ** state)1103 check_PCR_SetAuthValue(void **state)
1104 {
1105 TSS2_RC r;
1106
1107 r = Esys_PCR_SetAuthValue(NULL,
1108 0,
1109 ESYS_TR_PASSWORD,
1110 ESYS_TR_NONE, ESYS_TR_NONE, NULL);
1111 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1112
1113 r = Esys_PCR_SetAuthValue_Async(NULL,
1114 0,
1115 ESYS_TR_PASSWORD,
1116 ESYS_TR_NONE, ESYS_TR_NONE, NULL);
1117 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1118
1119 r = Esys_PCR_SetAuthValue_Finish(NULL);
1120 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1121 }
1122
1123 void
check_PCR_Reset(void ** state)1124 check_PCR_Reset(void **state)
1125 {
1126 TSS2_RC r;
1127
1128 r = Esys_PCR_Reset(NULL, 0, ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE);
1129 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1130
1131 r = Esys_PCR_Reset_Async(NULL,
1132 0, ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE);
1133 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1134
1135 r = Esys_PCR_Reset_Finish(NULL);
1136 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1137 }
1138
1139 void
check_PolicySigned(void ** state)1140 check_PolicySigned(void **state)
1141 {
1142 TSS2_RC r;
1143
1144 r = Esys_PolicySigned(NULL,
1145 0,
1146 0,
1147 ESYS_TR_NONE,
1148 ESYS_TR_NONE,
1149 ESYS_TR_NONE, NULL, NULL, NULL, 0, NULL, NULL, NULL);
1150 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1151
1152 r = Esys_PolicySigned_Async(NULL,
1153 0,
1154 0,
1155 ESYS_TR_NONE,
1156 ESYS_TR_NONE,
1157 ESYS_TR_NONE, NULL, NULL, NULL, 0, NULL);
1158 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1159
1160 r = Esys_PolicySigned_Finish(NULL, NULL, NULL);
1161 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1162 }
1163
1164 void
check_PolicySecret(void ** state)1165 check_PolicySecret(void **state)
1166 {
1167 TSS2_RC r;
1168
1169 r = Esys_PolicySecret(NULL,
1170 0,
1171 0,
1172 ESYS_TR_PASSWORD,
1173 ESYS_TR_NONE,
1174 ESYS_TR_NONE, NULL, NULL, NULL, 0, NULL, NULL);
1175 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1176
1177 r = Esys_PolicySecret_Async(NULL,
1178 0,
1179 0,
1180 ESYS_TR_PASSWORD,
1181 ESYS_TR_NONE,
1182 ESYS_TR_NONE, NULL, NULL, NULL, 0);
1183 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1184
1185 r = Esys_PolicySecret_Finish(NULL, NULL, NULL);
1186 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1187 }
1188
1189 void
check_PolicyTicket(void ** state)1190 check_PolicyTicket(void **state)
1191 {
1192 TSS2_RC r;
1193
1194 r = Esys_PolicyTicket(NULL,
1195 0,
1196 ESYS_TR_NONE,
1197 ESYS_TR_NONE,
1198 ESYS_TR_NONE, NULL, NULL, NULL, NULL, NULL);
1199 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1200
1201 r = Esys_PolicyTicket_Async(NULL,
1202 0,
1203 ESYS_TR_NONE,
1204 ESYS_TR_NONE,
1205 ESYS_TR_NONE, NULL, NULL, NULL, NULL, NULL);
1206 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1207
1208 r = Esys_PolicyTicket_Finish(NULL);
1209 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1210 }
1211
1212 void
check_PolicyOR(void ** state)1213 check_PolicyOR(void **state)
1214 {
1215 TSS2_RC r;
1216
1217 r = Esys_PolicyOR(NULL, 0, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, NULL);
1218 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1219
1220 r = Esys_PolicyOR_Async(NULL,
1221 0, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, NULL);
1222 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1223
1224 r = Esys_PolicyOR_Finish(NULL);
1225 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1226 }
1227
1228 void
check_PolicyPCR(void ** state)1229 check_PolicyPCR(void **state)
1230 {
1231 TSS2_RC r;
1232
1233 r = Esys_PolicyPCR(NULL,
1234 0, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL);
1235 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1236
1237 r = Esys_PolicyPCR_Async(NULL,
1238 0,
1239 ESYS_TR_NONE,
1240 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL);
1241 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1242
1243 r = Esys_PolicyPCR_Finish(NULL);
1244 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1245 }
1246
1247 void
check_PolicyLocality(void ** state)1248 check_PolicyLocality(void **state)
1249 {
1250 TSS2_RC r;
1251
1252 r = Esys_PolicyLocality(NULL,
1253 ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, 0, 0);
1254 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1255
1256 r = Esys_PolicyLocality_Async(NULL,
1257 ESYS_TR_NONE,
1258 ESYS_TR_NONE, ESYS_TR_NONE, 0, 0);
1259 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1260
1261 r = Esys_PolicyLocality_Finish(NULL);
1262 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1263 }
1264
1265 void
check_PolicyNV(void ** state)1266 check_PolicyNV(void **state)
1267 {
1268 TSS2_RC r;
1269
1270 r = Esys_PolicyNV(NULL,
1271 0,
1272 0,
1273 0,
1274 ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE, NULL, 0, 0);
1275 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1276
1277 r = Esys_PolicyNV_Async(NULL,
1278 0,
1279 0,
1280 0,
1281 ESYS_TR_PASSWORD,
1282 ESYS_TR_NONE, ESYS_TR_NONE, NULL, 0, 0);
1283 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1284
1285 r = Esys_PolicyNV_Finish(NULL);
1286 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1287 }
1288
1289 void
check_PolicyCounterTimer(void ** state)1290 check_PolicyCounterTimer(void **state)
1291 {
1292 TSS2_RC r;
1293
1294 r = Esys_PolicyCounterTimer(NULL,
1295 0,
1296 ESYS_TR_NONE,
1297 ESYS_TR_NONE, ESYS_TR_NONE, NULL, 0, 0);
1298 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1299
1300 r = Esys_PolicyCounterTimer_Async(NULL,
1301 0,
1302 ESYS_TR_NONE,
1303 ESYS_TR_NONE, ESYS_TR_NONE, NULL, 0, 0);
1304 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1305
1306 r = Esys_PolicyCounterTimer_Finish(NULL);
1307 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1308 }
1309
1310 void
check_PolicyCommandCode(void ** state)1311 check_PolicyCommandCode(void **state)
1312 {
1313 TSS2_RC r;
1314
1315 r = Esys_PolicyCommandCode(NULL,
1316 0, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, 0);
1317 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1318
1319 r = Esys_PolicyCommandCode_Async(NULL,
1320 0,
1321 ESYS_TR_NONE,
1322 ESYS_TR_NONE, ESYS_TR_NONE, 0);
1323 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1324
1325 r = Esys_PolicyCommandCode_Finish(NULL);
1326 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1327 }
1328
1329 void
check_PolicyPhysicalPresence(void ** state)1330 check_PolicyPhysicalPresence(void **state)
1331 {
1332 TSS2_RC r;
1333
1334 r = Esys_PolicyPhysicalPresence(NULL,
1335 0,
1336 ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE);
1337 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1338
1339 r = Esys_PolicyPhysicalPresence_Async(NULL,
1340 0,
1341 ESYS_TR_NONE,
1342 ESYS_TR_NONE, ESYS_TR_NONE);
1343 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1344
1345 r = Esys_PolicyPhysicalPresence_Finish(NULL);
1346 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1347 }
1348
1349 void
check_PolicyCpHash(void ** state)1350 check_PolicyCpHash(void **state)
1351 {
1352 TSS2_RC r;
1353
1354 r = Esys_PolicyCpHash(NULL,
1355 ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, 0, NULL);
1356 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1357
1358 r = Esys_PolicyCpHash_Async(NULL,
1359 ESYS_TR_NONE,
1360 ESYS_TR_NONE, ESYS_TR_NONE, 0, NULL);
1361 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1362
1363 r = Esys_PolicyCpHash_Finish(NULL);
1364 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1365 }
1366
1367 void
check_PolicyNameHash(void ** state)1368 check_PolicyNameHash(void **state)
1369 {
1370 TSS2_RC r;
1371
1372 r = Esys_PolicyNameHash(NULL,
1373 ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, 0, NULL);
1374 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1375
1376 r = Esys_PolicyNameHash_Async(NULL,
1377 ESYS_TR_NONE,
1378 ESYS_TR_NONE, ESYS_TR_NONE, 0, NULL);
1379 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1380
1381 r = Esys_PolicyNameHash_Finish(NULL);
1382 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1383 }
1384
1385 void
check_PolicyDuplicationSelect(void ** state)1386 check_PolicyDuplicationSelect(void **state)
1387 {
1388 TSS2_RC r;
1389
1390 r = Esys_PolicyDuplicationSelect(NULL,
1391 ESYS_TR_NONE,
1392 ESYS_TR_NONE,
1393 ESYS_TR_NONE, 0, NULL, NULL, 0);
1394 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1395
1396 r = Esys_PolicyDuplicationSelect_Async(NULL,
1397 ESYS_TR_NONE,
1398 ESYS_TR_NONE,
1399 ESYS_TR_NONE, 0, NULL, NULL, 0);
1400 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1401
1402 r = Esys_PolicyDuplicationSelect_Finish(NULL);
1403 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1404 }
1405
1406 void
check_PolicyAuthorize(void ** state)1407 check_PolicyAuthorize(void **state)
1408 {
1409 TSS2_RC r;
1410
1411 r = Esys_PolicyAuthorize(NULL,
1412 0,
1413 ESYS_TR_NONE,
1414 ESYS_TR_NONE,
1415 ESYS_TR_NONE, NULL, NULL, NULL, NULL);
1416 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1417
1418 r = Esys_PolicyAuthorize_Async(NULL,
1419 0,
1420 ESYS_TR_NONE,
1421 ESYS_TR_NONE,
1422 ESYS_TR_NONE, NULL, NULL, NULL, NULL);
1423 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1424
1425 r = Esys_PolicyAuthorize_Finish(NULL);
1426 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1427 }
1428
1429 void
check_PolicyAuthValue(void ** state)1430 check_PolicyAuthValue(void **state)
1431 {
1432 TSS2_RC r;
1433
1434 r = Esys_PolicyAuthValue(NULL, 0, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE);
1435 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1436
1437 r = Esys_PolicyAuthValue_Async(NULL,
1438 0, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE);
1439 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1440
1441 r = Esys_PolicyAuthValue_Finish(NULL);
1442 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1443 }
1444
1445 void
check_PolicyPassword(void ** state)1446 check_PolicyPassword(void **state)
1447 {
1448 TSS2_RC r;
1449
1450 r = Esys_PolicyPassword(NULL, 0, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE);
1451 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1452
1453 r = Esys_PolicyPassword_Async(NULL,
1454 0, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE);
1455 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1456
1457 r = Esys_PolicyPassword_Finish(NULL);
1458 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1459 }
1460
1461 void
check_PolicyGetDigest(void ** state)1462 check_PolicyGetDigest(void **state)
1463 {
1464 TSS2_RC r;
1465
1466 r = Esys_PolicyGetDigest(NULL,
1467 0, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, NULL);
1468 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1469
1470 r = Esys_PolicyGetDigest_Async(NULL,
1471 0, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE);
1472 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1473
1474 r = Esys_PolicyGetDigest_Finish(NULL, NULL);
1475 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1476 }
1477
1478 void
check_PolicyNvWritten(void ** state)1479 check_PolicyNvWritten(void **state)
1480 {
1481 TSS2_RC r;
1482
1483 r = Esys_PolicyNvWritten(NULL,
1484 0, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, 0);
1485 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1486
1487 r = Esys_PolicyNvWritten_Async(NULL,
1488 0,
1489 ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, 0);
1490 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1491
1492 r = Esys_PolicyNvWritten_Finish(NULL);
1493 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1494 }
1495
1496 void
check_PolicyTemplate(void ** state)1497 check_PolicyTemplate(void **state)
1498 {
1499 TSS2_RC r;
1500
1501 r = Esys_PolicyTemplate(NULL,
1502 ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, 0, NULL);
1503 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1504
1505 r = Esys_PolicyTemplate_Async(NULL,
1506 ESYS_TR_NONE,
1507 ESYS_TR_NONE, ESYS_TR_NONE, 0, NULL);
1508 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1509
1510 r = Esys_PolicyTemplate_Finish(NULL);
1511 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1512 }
1513
1514 void
check_PolicyAuthorizeNV(void ** state)1515 check_PolicyAuthorizeNV(void **state)
1516 {
1517 TSS2_RC r;
1518
1519 r = Esys_PolicyAuthorizeNV(NULL,
1520 0,
1521 0,
1522 0, ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE);
1523 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1524
1525 r = Esys_PolicyAuthorizeNV_Async(NULL,
1526 0,
1527 0,
1528 0,
1529 ESYS_TR_PASSWORD,
1530 ESYS_TR_NONE, ESYS_TR_NONE);
1531 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1532
1533 r = Esys_PolicyAuthorizeNV_Finish(NULL);
1534 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1535 }
1536
1537 void
check_CreatePrimary(void ** state)1538 check_CreatePrimary(void **state)
1539 {
1540 TSS2_RC r;
1541
1542 r = Esys_CreatePrimary(NULL,
1543 0,
1544 ESYS_TR_PASSWORD,
1545 ESYS_TR_NONE,
1546 ESYS_TR_NONE,
1547 NULL,
1548 NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
1549 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1550
1551 r = Esys_CreatePrimary_Async(NULL,
1552 0,
1553 ESYS_TR_PASSWORD,
1554 ESYS_TR_NONE,
1555 ESYS_TR_NONE, NULL, NULL, NULL, NULL);
1556 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1557
1558 r = Esys_CreatePrimary_Finish(NULL, NULL, NULL, NULL, NULL, NULL);
1559 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1560 }
1561
1562 void
check_HierarchyControl(void ** state)1563 check_HierarchyControl(void **state)
1564 {
1565 TSS2_RC r;
1566
1567 r = Esys_HierarchyControl(NULL,
1568 0,
1569 ESYS_TR_PASSWORD,
1570 ESYS_TR_NONE, ESYS_TR_NONE, 0, 0);
1571 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1572
1573 r = Esys_HierarchyControl_Async(NULL,
1574 0,
1575 ESYS_TR_PASSWORD,
1576 ESYS_TR_NONE, ESYS_TR_NONE, 0, 0);
1577 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1578
1579 r = Esys_HierarchyControl_Finish(NULL);
1580 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1581 }
1582
1583 void
check_SetPrimaryPolicy(void ** state)1584 check_SetPrimaryPolicy(void **state)
1585 {
1586 TSS2_RC r;
1587
1588 r = Esys_SetPrimaryPolicy(NULL,
1589 0,
1590 ESYS_TR_PASSWORD,
1591 ESYS_TR_NONE, ESYS_TR_NONE, NULL, 0);
1592 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1593
1594 r = Esys_SetPrimaryPolicy_Async(NULL,
1595 0,
1596 ESYS_TR_PASSWORD,
1597 ESYS_TR_NONE, ESYS_TR_NONE, NULL, 0);
1598 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1599
1600 r = Esys_SetPrimaryPolicy_Finish(NULL);
1601 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1602 }
1603
1604 void
check_ChangePPS(void ** state)1605 check_ChangePPS(void **state)
1606 {
1607 TSS2_RC r;
1608
1609 r = Esys_ChangePPS(NULL, 0, ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE);
1610 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1611
1612 r = Esys_ChangePPS_Async(NULL,
1613 0, ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE);
1614 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1615
1616 r = Esys_ChangePPS_Finish(NULL);
1617 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1618 }
1619
1620 void
check_ChangeEPS(void ** state)1621 check_ChangeEPS(void **state)
1622 {
1623 TSS2_RC r;
1624
1625 r = Esys_ChangeEPS(NULL, 0, ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE);
1626 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1627
1628 r = Esys_ChangeEPS_Async(NULL,
1629 0, ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE);
1630 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1631
1632 r = Esys_ChangeEPS_Finish(NULL);
1633 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1634 }
1635
1636 void
check_Clear(void ** state)1637 check_Clear(void **state)
1638 {
1639 TSS2_RC r;
1640
1641 r = Esys_Clear(NULL, 0, ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE);
1642 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1643
1644 r = Esys_Clear_Async(NULL, 0, ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE);
1645 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1646
1647 r = Esys_Clear_Finish(NULL);
1648 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1649 }
1650
1651 void
check_ClearControl(void ** state)1652 check_ClearControl(void **state)
1653 {
1654 TSS2_RC r;
1655
1656 r = Esys_ClearControl(NULL,
1657 0, ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE, 0);
1658 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1659
1660 r = Esys_ClearControl_Async(NULL,
1661 0,
1662 ESYS_TR_PASSWORD,
1663 ESYS_TR_NONE, ESYS_TR_NONE, 0);
1664 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1665
1666 r = Esys_ClearControl_Finish(NULL);
1667 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1668 }
1669
1670 void
check_HierarchyChangeAuth(void ** state)1671 check_HierarchyChangeAuth(void **state)
1672 {
1673 TSS2_RC r;
1674
1675 r = Esys_HierarchyChangeAuth(NULL,
1676 0,
1677 ESYS_TR_PASSWORD,
1678 ESYS_TR_NONE, ESYS_TR_NONE, NULL);
1679 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1680
1681 r = Esys_HierarchyChangeAuth_Async(NULL,
1682 0,
1683 ESYS_TR_PASSWORD,
1684 ESYS_TR_NONE, ESYS_TR_NONE, NULL);
1685 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1686
1687 r = Esys_HierarchyChangeAuth_Finish(NULL);
1688 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1689 }
1690
1691 void
check_DictionaryAttackLockReset(void ** state)1692 check_DictionaryAttackLockReset(void **state)
1693 {
1694 TSS2_RC r;
1695
1696 r = Esys_DictionaryAttackLockReset(NULL,
1697 0,
1698 ESYS_TR_PASSWORD,
1699 ESYS_TR_NONE, ESYS_TR_NONE);
1700 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1701
1702 r = Esys_DictionaryAttackLockReset_Async(NULL,
1703 0,
1704 ESYS_TR_PASSWORD,
1705 ESYS_TR_NONE, ESYS_TR_NONE);
1706 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1707
1708 r = Esys_DictionaryAttackLockReset_Finish(NULL);
1709 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1710 }
1711
1712 void
check_DictionaryAttackParameters(void ** state)1713 check_DictionaryAttackParameters(void **state)
1714 {
1715 TSS2_RC r;
1716
1717 r = Esys_DictionaryAttackParameters(NULL,
1718 0,
1719 ESYS_TR_PASSWORD,
1720 ESYS_TR_NONE, ESYS_TR_NONE, 0, 0, 0);
1721 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1722
1723 r = Esys_DictionaryAttackParameters_Async(NULL,
1724 0,
1725 ESYS_TR_PASSWORD,
1726 ESYS_TR_NONE,
1727 ESYS_TR_NONE, 0, 0, 0);
1728 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1729
1730 r = Esys_DictionaryAttackParameters_Finish(NULL);
1731 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1732 }
1733
1734 void
check_PP_Commands(void ** state)1735 check_PP_Commands(void **state)
1736 {
1737 TSS2_RC r;
1738
1739 r = Esys_PP_Commands(NULL,
1740 0,
1741 ESYS_TR_PASSWORD,
1742 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL);
1743 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1744
1745 r = Esys_PP_Commands_Async(NULL,
1746 0,
1747 ESYS_TR_PASSWORD,
1748 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL);
1749 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1750
1751 r = Esys_PP_Commands_Finish(NULL);
1752 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1753 }
1754
1755 void
check_SetAlgorithmSet(void ** state)1756 check_SetAlgorithmSet(void **state)
1757 {
1758 TSS2_RC r;
1759
1760 r = Esys_SetAlgorithmSet(NULL,
1761 0,
1762 ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE, 0);
1763 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1764
1765 r = Esys_SetAlgorithmSet_Async(NULL,
1766 0,
1767 ESYS_TR_PASSWORD,
1768 ESYS_TR_NONE, ESYS_TR_NONE, 0);
1769 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1770
1771 r = Esys_SetAlgorithmSet_Finish(NULL);
1772 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1773 }
1774
1775 void
check_FieldUpgradeStart(void ** state)1776 check_FieldUpgradeStart(void **state)
1777 {
1778 TSS2_RC r;
1779
1780 r = Esys_FieldUpgradeStart(NULL,
1781 0,
1782 0,
1783 ESYS_TR_PASSWORD,
1784 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL);
1785 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1786
1787 r = Esys_FieldUpgradeStart_Async(NULL,
1788 0,
1789 0,
1790 ESYS_TR_PASSWORD,
1791 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL);
1792 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1793
1794 r = Esys_FieldUpgradeStart_Finish(NULL);
1795 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1796 }
1797
1798 void
check_FieldUpgradeData(void ** state)1799 check_FieldUpgradeData(void **state)
1800 {
1801 TSS2_RC r;
1802
1803 r = Esys_FieldUpgradeData(NULL,
1804 ESYS_TR_NONE,
1805 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL, NULL);
1806 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1807
1808 r = Esys_FieldUpgradeData_Async(NULL,
1809 ESYS_TR_NONE,
1810 ESYS_TR_NONE, ESYS_TR_NONE, NULL);
1811 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1812
1813 r = Esys_FieldUpgradeData_Finish(NULL, NULL, NULL);
1814 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1815 }
1816
1817 void
check_FirmwareRead(void ** state)1818 check_FirmwareRead(void **state)
1819 {
1820 TSS2_RC r;
1821
1822 r = Esys_FirmwareRead(NULL,
1823 ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, 0, NULL);
1824 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1825
1826 r = Esys_FirmwareRead_Async(NULL,
1827 ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, 0);
1828 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1829
1830 r = Esys_FirmwareRead_Finish(NULL, NULL);
1831 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1832 }
1833
1834 void
check_ContextSave(void ** state)1835 check_ContextSave(void **state)
1836 {
1837 TSS2_RC r;
1838
1839 r = Esys_ContextSave(NULL, 0, NULL);
1840 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1841
1842 r = Esys_ContextSave_Async(NULL, 0);
1843 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1844
1845 r = Esys_ContextSave_Finish(NULL, NULL);
1846 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1847 }
1848
1849 void
check_ContextLoad(void ** state)1850 check_ContextLoad(void **state)
1851 {
1852 TSS2_RC r;
1853
1854 r = Esys_ContextLoad(NULL, NULL, NULL);
1855 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1856
1857 r = Esys_ContextLoad_Async(NULL, NULL);
1858 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1859
1860 r = Esys_ContextLoad_Finish(NULL, NULL);
1861 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1862 }
1863
1864 void
check_FlushContext(void ** state)1865 check_FlushContext(void **state)
1866 {
1867 TSS2_RC r;
1868
1869 r = Esys_FlushContext(NULL, 0);
1870 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1871
1872 r = Esys_FlushContext_Async(NULL, 0);
1873 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1874
1875 r = Esys_FlushContext_Finish(NULL);
1876 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1877 }
1878
1879 void
check_EvictControl(void ** state)1880 check_EvictControl(void **state)
1881 {
1882 TSS2_RC r;
1883
1884 r = Esys_EvictControl(NULL,
1885 0,
1886 0,
1887 ESYS_TR_PASSWORD,
1888 ESYS_TR_NONE, ESYS_TR_NONE, 0, NULL);
1889 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1890
1891 r = Esys_EvictControl_Async(NULL,
1892 0,
1893 0,
1894 ESYS_TR_PASSWORD,
1895 ESYS_TR_NONE, ESYS_TR_NONE, 0);
1896 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1897
1898 r = Esys_EvictControl_Finish(NULL, NULL);
1899 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1900 }
1901
1902 void
check_ReadClock(void ** state)1903 check_ReadClock(void **state)
1904 {
1905 TSS2_RC r;
1906
1907 r = Esys_ReadClock(NULL, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, NULL);
1908 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1909
1910 r = Esys_ReadClock_Async(NULL, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE);
1911 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1912
1913 r = Esys_ReadClock_Finish(NULL, NULL);
1914 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1915 }
1916
1917 void
check_ClockSet(void ** state)1918 check_ClockSet(void **state)
1919 {
1920 TSS2_RC r;
1921
1922 r = Esys_ClockSet(NULL, 0, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, 0);
1923 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1924
1925 r = Esys_ClockSet_Async(NULL,
1926 0, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, 0);
1927 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1928
1929 r = Esys_ClockSet_Finish(NULL);
1930 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1931 }
1932
1933 void
check_ClockRateAdjust(void ** state)1934 check_ClockRateAdjust(void **state)
1935 {
1936 TSS2_RC r;
1937
1938 r = Esys_ClockRateAdjust(NULL,
1939 0,
1940 ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE, 0);
1941 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1942
1943 r = Esys_ClockRateAdjust_Async(NULL,
1944 0,
1945 ESYS_TR_PASSWORD,
1946 ESYS_TR_NONE, ESYS_TR_NONE, 0);
1947 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1948
1949 r = Esys_ClockRateAdjust_Finish(NULL);
1950 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1951 }
1952
1953 void
check_GetCapability(void ** state)1954 check_GetCapability(void **state)
1955 {
1956 TSS2_RC r;
1957
1958 r = Esys_GetCapability(NULL,
1959 ESYS_TR_NONE,
1960 ESYS_TR_NONE, ESYS_TR_NONE, 0, 0, 0, NULL, NULL);
1961 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1962
1963 r = Esys_GetCapability_Async(NULL,
1964 ESYS_TR_NONE,
1965 ESYS_TR_NONE, ESYS_TR_NONE, 0, 0, 0);
1966 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1967
1968 r = Esys_GetCapability_Finish(NULL, NULL, NULL);
1969 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1970 }
1971
1972 void
check_TestParms(void ** state)1973 check_TestParms(void **state)
1974 {
1975 TSS2_RC r;
1976
1977 r = Esys_TestParms(NULL, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, NULL);
1978 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1979
1980 r = Esys_TestParms_Async(NULL,
1981 ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE, NULL);
1982 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1983
1984 r = Esys_TestParms_Finish(NULL);
1985 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1986 }
1987
1988 void
check_NV_DefineSpace(void ** state)1989 check_NV_DefineSpace(void **state)
1990 {
1991 TSS2_RC r;
1992
1993 r = Esys_NV_DefineSpace(NULL,
1994 0,
1995 ESYS_TR_PASSWORD,
1996 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL, NULL);
1997 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
1998
1999 r = Esys_NV_DefineSpace_Async(NULL,
2000 0,
2001 ESYS_TR_PASSWORD,
2002 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL);
2003 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2004
2005 r = Esys_NV_DefineSpace_Finish(NULL, NULL);
2006 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2007 }
2008
2009 void
check_NV_UndefineSpace(void ** state)2010 check_NV_UndefineSpace(void **state)
2011 {
2012 TSS2_RC r;
2013
2014 r = Esys_NV_UndefineSpace(NULL,
2015 0,
2016 0, ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE);
2017 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2018
2019 r = Esys_NV_UndefineSpace_Async(NULL,
2020 0,
2021 0,
2022 ESYS_TR_PASSWORD,
2023 ESYS_TR_NONE, ESYS_TR_NONE);
2024 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2025
2026 r = Esys_NV_UndefineSpace_Finish(NULL);
2027 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2028 }
2029
2030 void
check_NV_UndefineSpaceSpecial(void ** state)2031 check_NV_UndefineSpaceSpecial(void **state)
2032 {
2033 TSS2_RC r;
2034
2035 r = Esys_NV_UndefineSpaceSpecial(NULL,
2036 0,
2037 0,
2038 ESYS_TR_PASSWORD,
2039 ESYS_TR_PASSWORD, ESYS_TR_NONE);
2040 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2041
2042 r = Esys_NV_UndefineSpaceSpecial_Async(NULL,
2043 0,
2044 0,
2045 ESYS_TR_PASSWORD,
2046 ESYS_TR_PASSWORD, ESYS_TR_NONE);
2047 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2048
2049 r = Esys_NV_UndefineSpaceSpecial_Finish(NULL);
2050 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2051 }
2052
2053 void
check_NV_ReadPublic(void ** state)2054 check_NV_ReadPublic(void **state)
2055 {
2056 TSS2_RC r;
2057
2058 r = Esys_NV_ReadPublic(NULL,
2059 0,
2060 ESYS_TR_NONE,
2061 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL);
2062 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2063
2064 r = Esys_NV_ReadPublic_Async(NULL,
2065 0, ESYS_TR_NONE, ESYS_TR_NONE, ESYS_TR_NONE);
2066 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2067
2068 r = Esys_NV_ReadPublic_Finish(NULL, NULL, NULL);
2069 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2070 }
2071
2072 void
check_NV_Write(void ** state)2073 check_NV_Write(void **state)
2074 {
2075 TSS2_RC r;
2076
2077 r = Esys_NV_Write(NULL,
2078 0,
2079 0, ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE, NULL, 0);
2080 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2081
2082 r = Esys_NV_Write_Async(NULL,
2083 0,
2084 0,
2085 ESYS_TR_PASSWORD,
2086 ESYS_TR_NONE, ESYS_TR_NONE, NULL, 0);
2087 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2088
2089 r = Esys_NV_Write_Finish(NULL);
2090 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2091 }
2092
2093 void
check_NV_Increment(void ** state)2094 check_NV_Increment(void **state)
2095 {
2096 TSS2_RC r;
2097
2098 r = Esys_NV_Increment(NULL,
2099 0, 0, ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE);
2100 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2101
2102 r = Esys_NV_Increment_Async(NULL,
2103 0,
2104 0,
2105 ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE);
2106 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2107
2108 r = Esys_NV_Increment_Finish(NULL);
2109 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2110 }
2111
2112 void
check_NV_Extend(void ** state)2113 check_NV_Extend(void **state)
2114 {
2115 TSS2_RC r;
2116
2117 r = Esys_NV_Extend(NULL,
2118 0,
2119 0, ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE, NULL);
2120 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2121
2122 r = Esys_NV_Extend_Async(NULL,
2123 0,
2124 0,
2125 ESYS_TR_PASSWORD,
2126 ESYS_TR_NONE, ESYS_TR_NONE, NULL);
2127 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2128
2129 r = Esys_NV_Extend_Finish(NULL);
2130 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2131 }
2132
2133 void
check_NV_SetBits(void ** state)2134 check_NV_SetBits(void **state)
2135 {
2136 TSS2_RC r;
2137
2138 r = Esys_NV_SetBits(NULL,
2139 0, 0, ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE, 0);
2140 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2141
2142 r = Esys_NV_SetBits_Async(NULL,
2143 0,
2144 0,
2145 ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE, 0);
2146 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2147
2148 r = Esys_NV_SetBits_Finish(NULL);
2149 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2150 }
2151
2152 void
check_NV_WriteLock(void ** state)2153 check_NV_WriteLock(void **state)
2154 {
2155 TSS2_RC r;
2156
2157 r = Esys_NV_WriteLock(NULL,
2158 0, 0, ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE);
2159 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2160
2161 r = Esys_NV_WriteLock_Async(NULL,
2162 0,
2163 0,
2164 ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE);
2165 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2166
2167 r = Esys_NV_WriteLock_Finish(NULL);
2168 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2169 }
2170
2171 void
check_NV_GlobalWriteLock(void ** state)2172 check_NV_GlobalWriteLock(void **state)
2173 {
2174 TSS2_RC r;
2175
2176 r = Esys_NV_GlobalWriteLock(NULL,
2177 0,
2178 ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE);
2179 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2180
2181 r = Esys_NV_GlobalWriteLock_Async(NULL,
2182 0,
2183 ESYS_TR_PASSWORD,
2184 ESYS_TR_NONE, ESYS_TR_NONE);
2185 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2186
2187 r = Esys_NV_GlobalWriteLock_Finish(NULL);
2188 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2189 }
2190
2191 void
check_NV_Read(void ** state)2192 check_NV_Read(void **state)
2193 {
2194 TSS2_RC r;
2195
2196 r = Esys_NV_Read(NULL,
2197 0,
2198 0,
2199 ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE, 0, 0, NULL);
2200 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2201
2202 r = Esys_NV_Read_Async(NULL,
2203 0,
2204 0,
2205 ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE, 0, 0);
2206 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2207
2208 r = Esys_NV_Read_Finish(NULL, NULL);
2209 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2210 }
2211
2212 void
check_NV_ReadLock(void ** state)2213 check_NV_ReadLock(void **state)
2214 {
2215 TSS2_RC r;
2216
2217 r = Esys_NV_ReadLock(NULL,
2218 0, 0, ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE);
2219 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2220
2221 r = Esys_NV_ReadLock_Async(NULL,
2222 0,
2223 0, ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE);
2224 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2225
2226 r = Esys_NV_ReadLock_Finish(NULL);
2227 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2228 }
2229
2230 void
check_NV_ChangeAuth(void ** state)2231 check_NV_ChangeAuth(void **state)
2232 {
2233 TSS2_RC r;
2234
2235 r = Esys_NV_ChangeAuth(NULL,
2236 0,
2237 ESYS_TR_PASSWORD, ESYS_TR_NONE, ESYS_TR_NONE, NULL);
2238 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2239
2240 r = Esys_NV_ChangeAuth_Async(NULL,
2241 0,
2242 ESYS_TR_PASSWORD,
2243 ESYS_TR_NONE, ESYS_TR_NONE, NULL);
2244 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2245
2246 r = Esys_NV_ChangeAuth_Finish(NULL);
2247 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2248 }
2249
2250 void
check_NV_Certify(void ** state)2251 check_NV_Certify(void **state)
2252 {
2253 TSS2_RC r;
2254
2255 r = Esys_NV_Certify(NULL,
2256 0,
2257 0,
2258 0,
2259 ESYS_TR_PASSWORD,
2260 ESYS_TR_PASSWORD,
2261 ESYS_TR_NONE, NULL, NULL, 0, 0, NULL, NULL);
2262 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2263
2264 r = Esys_NV_Certify_Async(NULL,
2265 0,
2266 0,
2267 0,
2268 ESYS_TR_PASSWORD,
2269 ESYS_TR_PASSWORD, ESYS_TR_NONE, NULL, NULL, 0, 0);
2270 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2271
2272 r = Esys_NV_Certify_Finish(NULL, NULL, NULL);
2273 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2274 }
2275
2276 void
check_Vendor_TCG_Test(void ** state)2277 check_Vendor_TCG_Test(void **state)
2278 {
2279 TSS2_RC r;
2280
2281 r = Esys_Vendor_TCG_Test(NULL,
2282 ESYS_TR_NONE,
2283 ESYS_TR_NONE, ESYS_TR_NONE, NULL, NULL);
2284 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2285
2286 r = Esys_Vendor_TCG_Test_Async(NULL,
2287 ESYS_TR_NONE,
2288 ESYS_TR_NONE, ESYS_TR_NONE, NULL);
2289 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2290
2291 r = Esys_Vendor_TCG_Test_Finish(NULL, NULL);
2292 assert_int_equal(r, TSS2_ESYS_RC_BAD_REFERENCE);
2293 }
2294
2295 int
main(void)2296 main(void)
2297 {
2298 const struct CMUnitTest tests[] = {
2299 cmocka_unit_test(check_Startup),
2300 cmocka_unit_test(check_Shutdown),
2301 cmocka_unit_test(check_SelfTest),
2302 cmocka_unit_test(check_IncrementalSelfTest),
2303 cmocka_unit_test(check_GetTestResult),
2304 cmocka_unit_test(check_StartAuthSession),
2305 cmocka_unit_test(check_PolicyRestart),
2306 cmocka_unit_test(check_Create),
2307 cmocka_unit_test(check_Load),
2308 cmocka_unit_test(check_LoadExternal),
2309 cmocka_unit_test(check_ReadPublic),
2310 cmocka_unit_test(check_ActivateCredential),
2311 cmocka_unit_test(check_MakeCredential),
2312 cmocka_unit_test(check_Unseal),
2313 cmocka_unit_test(check_ObjectChangeAuth),
2314 cmocka_unit_test(check_CreateLoaded),
2315 cmocka_unit_test(check_Duplicate),
2316 cmocka_unit_test(check_Rewrap),
2317 cmocka_unit_test(check_Import),
2318 cmocka_unit_test(check_RSA_Encrypt),
2319 cmocka_unit_test(check_RSA_Decrypt),
2320 cmocka_unit_test(check_ECDH_KeyGen),
2321 cmocka_unit_test(check_ECDH_ZGen),
2322 cmocka_unit_test(check_ECC_Parameters),
2323 cmocka_unit_test(check_ZGen_2Phase),
2324 cmocka_unit_test(check_EncryptDecrypt),
2325 cmocka_unit_test(check_EncryptDecrypt2),
2326 cmocka_unit_test(check_Hash),
2327 cmocka_unit_test(check_HMAC),
2328 cmocka_unit_test(check_GetRandom),
2329 cmocka_unit_test(check_StirRandom),
2330 cmocka_unit_test(check_HMAC_Start),
2331 cmocka_unit_test(check_HashSequenceStart),
2332 cmocka_unit_test(check_SequenceUpdate),
2333 cmocka_unit_test(check_SequenceComplete),
2334 cmocka_unit_test(check_EventSequenceComplete),
2335 cmocka_unit_test(check_Certify),
2336 cmocka_unit_test(check_CertifyCreation),
2337 cmocka_unit_test(check_Quote),
2338 cmocka_unit_test(check_GetSessionAuditDigest),
2339 cmocka_unit_test(check_GetCommandAuditDigest),
2340 cmocka_unit_test(check_GetTime),
2341 cmocka_unit_test(check_Commit),
2342 cmocka_unit_test(check_EC_Ephemeral),
2343 cmocka_unit_test(check_VerifySignature),
2344 cmocka_unit_test(check_Sign),
2345 cmocka_unit_test(check_SetCommandCodeAuditStatus),
2346 cmocka_unit_test(check_PCR_Extend),
2347 cmocka_unit_test(check_PCR_Event),
2348 cmocka_unit_test(check_PCR_Read),
2349 cmocka_unit_test(check_PCR_Allocate),
2350 cmocka_unit_test(check_PCR_SetAuthPolicy),
2351 cmocka_unit_test(check_PCR_SetAuthValue),
2352 cmocka_unit_test(check_PCR_Reset),
2353 cmocka_unit_test(check_PolicySigned),
2354 cmocka_unit_test(check_PolicySecret),
2355 cmocka_unit_test(check_PolicyTicket),
2356 cmocka_unit_test(check_PolicyOR),
2357 cmocka_unit_test(check_PolicyPCR),
2358 cmocka_unit_test(check_PolicyLocality),
2359 cmocka_unit_test(check_PolicyNV),
2360 cmocka_unit_test(check_PolicyCounterTimer),
2361 cmocka_unit_test(check_PolicyCommandCode),
2362 cmocka_unit_test(check_PolicyPhysicalPresence),
2363 cmocka_unit_test(check_PolicyCpHash),
2364 cmocka_unit_test(check_PolicyNameHash),
2365 cmocka_unit_test(check_PolicyDuplicationSelect),
2366 cmocka_unit_test(check_PolicyAuthorize),
2367 cmocka_unit_test(check_PolicyAuthValue),
2368 cmocka_unit_test(check_PolicyPassword),
2369 cmocka_unit_test(check_PolicyGetDigest),
2370 cmocka_unit_test(check_PolicyNvWritten),
2371 cmocka_unit_test(check_PolicyTemplate),
2372 cmocka_unit_test(check_PolicyAuthorizeNV),
2373 cmocka_unit_test(check_CreatePrimary),
2374 cmocka_unit_test(check_HierarchyControl),
2375 cmocka_unit_test(check_SetPrimaryPolicy),
2376 cmocka_unit_test(check_ChangePPS),
2377 cmocka_unit_test(check_ChangeEPS),
2378 cmocka_unit_test(check_Clear),
2379 cmocka_unit_test(check_ClearControl),
2380 cmocka_unit_test(check_HierarchyChangeAuth),
2381 cmocka_unit_test(check_DictionaryAttackLockReset),
2382 cmocka_unit_test(check_DictionaryAttackParameters),
2383 cmocka_unit_test(check_PP_Commands),
2384 cmocka_unit_test(check_SetAlgorithmSet),
2385 cmocka_unit_test(check_FieldUpgradeStart),
2386 cmocka_unit_test(check_FieldUpgradeData),
2387 cmocka_unit_test(check_FirmwareRead),
2388 cmocka_unit_test(check_ContextSave),
2389 cmocka_unit_test(check_ContextLoad),
2390 cmocka_unit_test(check_FlushContext),
2391 cmocka_unit_test(check_EvictControl),
2392 cmocka_unit_test(check_ReadClock),
2393 cmocka_unit_test(check_ClockSet),
2394 cmocka_unit_test(check_ClockRateAdjust),
2395 cmocka_unit_test(check_GetCapability),
2396 cmocka_unit_test(check_TestParms),
2397 cmocka_unit_test(check_NV_DefineSpace),
2398 cmocka_unit_test(check_NV_UndefineSpace),
2399 cmocka_unit_test(check_NV_UndefineSpaceSpecial),
2400 cmocka_unit_test(check_NV_ReadPublic),
2401 cmocka_unit_test(check_NV_Write),
2402 cmocka_unit_test(check_NV_Increment),
2403 cmocka_unit_test(check_NV_Extend),
2404 cmocka_unit_test(check_NV_SetBits),
2405 cmocka_unit_test(check_NV_WriteLock),
2406 cmocka_unit_test(check_NV_GlobalWriteLock),
2407 cmocka_unit_test(check_NV_Read),
2408 cmocka_unit_test(check_NV_ReadLock),
2409 cmocka_unit_test(check_NV_ChangeAuth),
2410 cmocka_unit_test(check_NV_Certify),
2411 cmocka_unit_test(check_Vendor_TCG_Test),
2412 };
2413 return cmocka_run_group_tests(tests, NULL, NULL);
2414 }
2415