blob: 954904cd89022efd86f843c33b37519a4594fa7a [file] [log] [blame]
Vadim Bendebury56797522015-05-20 10:32:25 -07001// 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 "EC_Ephemeral_fp.h"
10#ifdef TPM_ALG_ECC
11//
12//
13// Error Returns Meaning
14//
nagendra modaduguc62fd932016-10-12 16:59:08 -070015// TPM_RC_NO_RESULT private key generation failed
Vadim Bendebury56797522015-05-20 10:32:25 -070016//
17TPM_RC
18TPM2_EC_Ephemeral(
19 EC_Ephemeral_In *in, // IN: input parameter list
20 EC_Ephemeral_Out *out // OUT: output parameter list
21 )
22{
23 TPM2B_ECC_PARAMETER r;
24
25 // Get the random value that will be used in the point multiplications
26 // Note: this does not commit the count.
27 if(!CryptGenerateR(&r,
28 NULL,
29 in->curveID,
30 NULL))
31 return TPM_RC_NO_RESULT;
32
33 CryptEccPointMultiply(&out->Q.t.point, in->curveID, &r, NULL);
34
35 // commit the count value
36 out->counter = CryptCommit();
37
38 return TPM_RC_SUCCESS;
39}
40#endif