Line | Count | Source (jump to first uncovered line) |
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 "CryptoEngine.h" |
9 | | #include "OsslCryptoEngine.h" |
10 | | static void Trap(const char *function, int line, int code); |
11 | | FAIL_FUNCTION TpmFailFunction = (FAIL_FUNCTION)&Trap; |
12 | | // |
13 | | // |
14 | | // Functions |
15 | | // |
16 | | // FAILURE_TRAP() |
17 | | // |
18 | | // This function is called if the caller to _cpri__InitCryptoUnits() doesn't provide a call back address. |
19 | | // |
20 | | static void |
21 | | Trap( |
22 | | const char *function, |
23 | | int line, |
24 | | int code |
25 | | ) |
26 | 0 | { |
27 | 0 | UNREFERENCED(function); |
28 | 0 | UNREFERENCED(line); |
29 | 0 | UNREFERENCED(code); |
30 | 0 | abort(); |
31 | 0 | } |
32 | | // |
33 | | // |
34 | | // _cpri__InitCryptoUnits() |
35 | | // |
36 | | // This function calls the initialization functions of the other crypto modules that are part of the crypto engine |
37 | | // for this implementation. This function should be called as a result of _TPM_Init(). The parameter to this |
38 | | // function is a call back function it TPM.lib that is called when the crypto engine has a failure. |
39 | | // |
40 | | LIB_EXPORT CRYPT_RESULT |
41 | | _cpri__InitCryptoUnits( |
42 | | FAIL_FUNCTION failFunction |
43 | | ) |
44 | 231 | { |
45 | 231 | TpmFailFunction = failFunction; |
46 | 231 | _cpri__RngStartup(); |
47 | 231 | _cpri__HashStartup(); |
48 | 231 | _cpri__SymStartup(); |
49 | 231 | #ifdef TPM_ALG_RSA |
50 | 231 | _cpri__RsaStartup(); |
51 | 231 | #endif |
52 | 231 | #ifdef TPM_ALG_ECC |
53 | 231 | _cpri__EccStartup(); |
54 | 231 | #endif |
55 | 231 | return CRYPT_SUCCESS; |
56 | 231 | } |
57 | | // |
58 | | // |
59 | | // _cpri__StopCryptoUnits() |
60 | | // |
61 | | // This function calls the shutdown functions of the other crypto modules that are part of the crypto engine |
62 | | // for this implementation. |
63 | | // |
64 | | LIB_EXPORT void |
65 | | _cpri__StopCryptoUnits( |
66 | | void |
67 | | ) |
68 | 0 | { |
69 | 0 | return; |
70 | 0 | } |
71 | | // |
72 | | // |
73 | | // _cpri__Startup() |
74 | | // |
75 | | // This function calls the startup functions of the other crypto modules that are part of the crypto engine for |
76 | | // this implementation. This function should be called during processing of TPM2_Startup(). |
77 | | // |
78 | | LIB_EXPORT BOOL |
79 | | _cpri__Startup( |
80 | | void |
81 | | ) |
82 | 462 | { |
83 | 462 | return( _cpri__HashStartup() |
84 | 462 | && _cpri__RngStartup() |
85 | 462 | #ifdef TPM_ALG_RSA |
86 | 462 | && _cpri__RsaStartup() |
87 | 462 | #endif // TPM_ALG_RSA |
88 | 462 | #ifdef TPM_ALG_ECC |
89 | 462 | && _cpri__EccStartup() |
90 | 462 | #endif // TPM_ALG_ECC |
91 | 462 | && _cpri__SymStartup()); |
92 | 462 | } |