• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: BSD-2-Clause */
2 /***********************************************************************;
3  * Copyright (c) 2015 - 2017, Intel Corporation
4  * All rights reserved.
5  ***********************************************************************/
6 
7 #ifdef HAVE_CONFIG_H
8 #include <config.h>
9 #endif
10 
11 #include "tss2_tpm2_types.h"
12 #include "tss2_mu.h"
13 #include "sysapi_util.h"
14 
Tss2_Sys_ChangePPS_Prepare(TSS2_SYS_CONTEXT * sysContext,TPMI_RH_PLATFORM authHandle)15 TSS2_RC Tss2_Sys_ChangePPS_Prepare(
16     TSS2_SYS_CONTEXT *sysContext,
17     TPMI_RH_PLATFORM authHandle)
18 {
19     _TSS2_SYS_CONTEXT_BLOB *ctx = syscontext_cast(sysContext);
20     TSS2_RC rval;
21 
22     if (!ctx)
23         return TSS2_SYS_RC_BAD_REFERENCE;
24 
25     rval = CommonPreparePrologue(ctx, TPM2_CC_ChangePPS);
26     if (rval)
27         return rval;
28 
29     rval = Tss2_MU_UINT32_Marshal(authHandle, ctx->cmdBuffer,
30                                   ctx->maxCmdSize,
31                                   &ctx->nextData);
32     if (rval)
33         return rval;
34 
35     ctx->decryptAllowed = 0;
36     ctx->encryptAllowed = 0;
37     ctx->authAllowed = 1;
38 
39     return CommonPrepareEpilogue(ctx);
40 }
41 
Tss2_Sys_ChangePPS_Complete(TSS2_SYS_CONTEXT * sysContext)42 TSS2_RC Tss2_Sys_ChangePPS_Complete (
43     TSS2_SYS_CONTEXT *sysContext)
44 {
45     _TSS2_SYS_CONTEXT_BLOB *ctx = syscontext_cast(sysContext);
46 
47     if (!ctx)
48         return TSS2_SYS_RC_BAD_REFERENCE;
49 
50     return CommonComplete(ctx);
51 }
52 
Tss2_Sys_ChangePPS(TSS2_SYS_CONTEXT * sysContext,TPMI_RH_PLATFORM authHandle,TSS2L_SYS_AUTH_COMMAND const * cmdAuthsArray,TSS2L_SYS_AUTH_RESPONSE * rspAuthsArray)53 TSS2_RC Tss2_Sys_ChangePPS(
54     TSS2_SYS_CONTEXT *sysContext,
55     TPMI_RH_PLATFORM authHandle,
56     TSS2L_SYS_AUTH_COMMAND const *cmdAuthsArray,
57     TSS2L_SYS_AUTH_RESPONSE *rspAuthsArray)
58 {
59     _TSS2_SYS_CONTEXT_BLOB *ctx = syscontext_cast(sysContext);
60     TSS2_RC rval;
61 
62     rval = Tss2_Sys_ChangePPS_Prepare(sysContext, authHandle);
63     if (rval)
64         return rval;
65 
66     rval = CommonOneCall(ctx, cmdAuthsArray, rspAuthsArray);
67     if (rval)
68         return rval;
69 
70     return Tss2_Sys_ChangePPS_Complete(sysContext);
71 }
72