Coverage Report

Created: 2023-06-07 06:46

/src/tpm2/ReadPublic.c
Line
Count
Source (jump to first uncovered line)
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 "ReadPublic_fp.h"
10
//
11
//
12
//     Error Returns                     Meaning
13
//
14
//     TPM_RC_SEQUENCE                   can not read the public area of a sequence object
15
//
16
TPM_RC
17
TPM2_ReadPublic(
18
   ReadPublic_In     *in,                // IN: input parameter list
19
   ReadPublic_Out    *out                // OUT: output parameter list
20
   )
21
0
{
22
0
   OBJECT                    *object;
23
24
// Input Validation
25
26
   // Get loaded object pointer
27
0
   object = ObjectGet(in->objectHandle);
28
29
   // Can not read public area of a sequence object
30
0
   if(ObjectIsSequence(object))
31
0
       return TPM_RC_SEQUENCE;
32
33
// Command Output
34
35
   // Compute size of public area in canonical form
36
0
   out->outPublic.t.size = TPMT_PUBLIC_Marshal(&object->publicArea, NULL, NULL);
37
38
   // Copy public area to output
39
0
   out->outPublic.t.publicArea = object->publicArea;
40
41
   // Copy name to output
42
0
   out->name.t.size = ObjectGetName(in->objectHandle, &out->name.t.name);
43
44
   // Copy qualified name to output
45
0
   ObjectGetQualifiedName(in->objectHandle, &out->qualifiedName);
46
47
0
   return TPM_RC_SUCCESS;
48
0
}