• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* This file includes functions that were extracted from the TPM2
2  * source, but were present in files not included in compilation.
3  */
4 #include "Global.h"
5 #include "CryptoEngine.h"
6 
7 #ifdef TPM_ALG_ECC
8 #include "CpriDataEcc.h"
9 #include "CpriDataEcc.c"
10 
_cpri__EccGetParametersByCurveId(TPM_ECC_CURVE curveId)11 const ECC_CURVE *_cpri__EccGetParametersByCurveId(
12   TPM_ECC_CURVE curveId         // IN: the curveID
13   )
14 {
15    int          i;
16    for(i = 0; i < ECC_CURVE_COUNT; i++)
17    {
18        if(eccCurves[i].curveId == curveId)
19            return &eccCurves[i];
20    }
21    FAIL(FATAL_ERROR_INTERNAL);
22 
23    return NULL; // Never reached.
24 }
25 
_cpri__GetCurveIdByIndex(UINT16 i)26 TPM_ECC_CURVE _cpri__GetCurveIdByIndex(
27   UINT16 i)
28 {
29     if(i >= ECC_CURVE_COUNT)
30         return TPM_ECC_NONE;
31     return eccCurves[i].curveId;
32 }
33 
_cpri__EccGetCurveCount(void)34 UINT32 _cpri__EccGetCurveCount(
35   void)
36 {
37     return ECC_CURVE_COUNT;
38 }
39 
40 #endif // TPM_ALG_ECC
41