1 // This file was extracted from the TCG Published
2 // Trusted Platform Module Library
3 // Part 4: Supporting Routines
4 // Family "2.0"
5 // Level 00 Revision 01.16
6 // October 30, 2014
7 
8 #include "PlatformData.h"
9 #include "TpmError.h"
10 
11 static BOOL s_RsaKeyCacheEnabled;
12 
13 //
14 //
15 //          Functions
16 //
17 //          _plat__LocalityGet()
18 //
19 //     Get the most recent command locality in locality value form. This is an integer value for locality and not a
20 //     locality structure The locality can be 0-4 or 32-255. 5-31 is not allowed.
21 //
22 LIB_EXPORT unsigned char
_plat__LocalityGet(void)23 _plat__LocalityGet(
24      void
25      )
26 {
27      return s_locality;
28 }
29 //
30 //
31 //          _plat__LocalitySet()
32 //
33 //     Set the most recent command locality in locality value form
34 //
35 LIB_EXPORT void
_plat__LocalitySet(unsigned char locality)36 _plat__LocalitySet(
37      unsigned char       locality
38      )
39 {
40      if(locality > 4 && locality < 32)
41          locality = 0;
42      s_locality = locality;
43      return;
44 }
45 //
46 //
47 //          _plat__IsRsaKeyCacheEnabled()
48 //
49 //     This function is used to check if the RSA key cache is enabled or not.
50 //
51 LIB_EXPORT int
_plat__IsRsaKeyCacheEnabled(void)52 _plat__IsRsaKeyCacheEnabled(
53      void
54      )
55 {
56      return s_RsaKeyCacheEnabled;
57 }
58