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 "SetAlgorithmSet_fp.h"
10 TPM_RC
TPM2_SetAlgorithmSet(SetAlgorithmSet_In * in)11 TPM2_SetAlgorithmSet(
12    SetAlgorithmSet_In     *in            // IN: input parameter list
13    )
14 {
15    TPM_RC       result;
16 
17    // The command needs NV update. Check if NV is available.
18    // A TPM_RC_NV_UNAVAILABLE or TPM_RC_NV_RATE error may be returned at
19    // this point
20    result = NvIsAvailable();
21    if(result != TPM_RC_SUCCESS) return result;
22 
23 // Internal Data Update
24    gp.algorithmSet = in->algorithmSet;
25 
26    // Write the algorithm set changes to NV
27    NvWriteReserved(NV_ALGORITHM_SET, &gp.algorithmSet);
28 
29    return TPM_RC_SUCCESS;
30 }
31