aboutsummaryrefslogtreecommitdiff
path: root/stubs_ecc.c
blob: 4cb2acc81c30d401796eb4007686406e6513cd90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* This file includes functions that were extracted from the TPM2
 * source, but were present in files not included in compilation.
 */
#include "Global.h"
#include "CryptoEngine.h"

#ifdef TPM_ALG_ECC
#include "CpriDataEcc.h"
#include "CpriDataEcc.c"

const ECC_CURVE *_cpri__EccGetParametersByCurveId(
  TPM_ECC_CURVE curveId         // IN: the curveID
  )
{
   int          i;
   for(i = 0; i < ECC_CURVE_COUNT; i++)
   {
       if(eccCurves[i].curveId == curveId)
           return &eccCurves[i];
   }
   FAIL(FATAL_ERROR_INTERNAL);

   return NULL; // Never reached.
}

TPM_ECC_CURVE _cpri__GetCurveIdByIndex(
  UINT16 i)
{
    if(i >= ECC_CURVE_COUNT)
        return TPM_ECC_NONE;
    return eccCurves[i].curveId;
}

UINT32 _cpri__EccGetCurveCount(
  void)
{
    return ECC_CURVE_COUNT;
}

#endif // TPM_ALG_ECC