Coverage Report

Created: 2025-10-12 06:32

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/tpm2/Unseal.c
Line
Count
Source
1
// This file was extracted from the TCG Published
2
// Trusted Platform Module Library
3
// Part 3: Commands
4
// Family "2.0"
5
// Level 00 Revision 01.16
6
// October 30, 2014
7
8
#include "InternalRoutines.h"
9
#include "Unseal_fp.h"
10
//
11
//
12
//     Error Returns                     Meaning
13
//
14
//     TPM_RC_ATTRIBUTES                 itemHandle has wrong attributes
15
//     TPM_RC_TYPE                       itemHandle is not a KEYEDHASH data object
16
//
17
TPM_RC
18
TPM2_Unseal(
19
   Unseal_In         *in,
20
   Unseal_Out        *out
21
   )
22
0
{
23
0
   OBJECT                    *object;
24
25
// Input Validation
26
27
   // Get pointer to loaded object
28
0
   object = ObjectGet(in->itemHandle);
29
30
   // Input handle must be a data object
31
0
   if(object->publicArea.type != TPM_ALG_KEYEDHASH)
32
0
       return TPM_RC_TYPE + RC_Unseal_itemHandle;
33
0
   if(   object->publicArea.objectAttributes.decrypt == SET
34
0
      || object->publicArea.objectAttributes.sign == SET
35
0
      || object->publicArea.objectAttributes.restricted == SET)
36
0
       return TPM_RC_ATTRIBUTES + RC_Unseal_itemHandle;
37
38
// Command Output
39
40
   // Copy data
41
0
   MemoryCopy2B(&out->outData.b, &object->sensitive.sensitive.bits.b,
42
0
                sizeof(out->outData.t.buffer));
43
44
0
   return TPM_RC_SUCCESS;
45
0
}