blob: b674138d3b531fa1624f04789e938c711aae16d0 [file] [log] [blame]
Vadim Bendebury56797522015-05-20 10:32:25 -07001// 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//
16TPM_RC
17TPM2_ReadPublic(
18 ReadPublic_In *in, // IN: input parameter list
19 ReadPublic_Out *out // OUT: output parameter list
20 )
21{
22 OBJECT *object;
23
24// Input Validation
25
26 // Get loaded object pointer
27 object = ObjectGet(in->objectHandle);
28
29 // Can not read public area of a sequence object
30 if(ObjectIsSequence(object))
31 return TPM_RC_SEQUENCE;
32
33// Command Output
34
35 // Compute size of public area in canonical form
36 out->outPublic.t.size = TPMT_PUBLIC_Marshal(&object->publicArea, NULL, NULL);
37
38 // Copy public area to output
39 out->outPublic.t.publicArea = object->publicArea;
40
41 // Copy name to output
ChromeOS Developere85c65b2015-07-10 10:12:43 -070042 out->name.t.size = ObjectGetName(in->objectHandle, &out->name.t.name);
Vadim Bendebury56797522015-05-20 10:32:25 -070043
44 // Copy qualified name to output
45 ObjectGetQualifiedName(in->objectHandle, &out->qualifiedName);
46
47 return TPM_RC_SUCCESS;
48}