blob: a9dd0b46acf9e593c5226b0dfb213f8fde04f70d [file] [log] [blame]
Vadim Bendeburyfea3a142015-05-28 18:53:22 -07001/*
2 * Copyright 2015 The Chromium OS Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file.
5 */
6
7#ifndef __TPM2_CPRIECC_FP_H
8#define __TPM2_CPRIECC_FP_H
9
Vadim Bendeburyc00055c2015-05-29 22:50:18 -070010LIB_EXPORT CRYPT_RESULT _cpri__C_2_2_KeyExchange(
11 TPMS_ECC_POINT *outZ1, // OUT: a computed point
12 TPMS_ECC_POINT *outZ2, // OUT: and optional second point
13 TPM_ECC_CURVE curveId, // IN: the curve for the computations
14 TPM_ALG_ID scheme, // IN: the key exchange scheme
15 TPM2B_ECC_PARAMETER *dsA, // IN: static private TPM key
16 TPM2B_ECC_PARAMETER *deA, // IN: ephemeral private TPM key
17 TPMS_ECC_POINT *QsB, // IN: static public party B key
18 TPMS_ECC_POINT *QeB // IN: ephemeral public party B key
19 );
20LIB_EXPORT CRYPT_RESULT _cpri__C_2_2_KeyExchange(
21 TPMS_ECC_POINT *outZ1, // OUT: a computed point
22 TPMS_ECC_POINT *outZ2, // OUT: and optional second point
23 TPM_ECC_CURVE curveId, // IN: the curve for the computations
24 TPM_ALG_ID scheme, // IN: the key exchange scheme
25 TPM2B_ECC_PARAMETER *dsA, // IN: static private TPM key
26 TPM2B_ECC_PARAMETER *deA, // IN: ephemeral private TPM key
27 TPMS_ECC_POINT *QsB, // IN: static public party B key
28 TPMS_ECC_POINT *QeB // IN: ephemeral public party B key
29 );
30LIB_EXPORT CRYPT_RESULT _cpri__EccCommitCompute(
31 TPMS_ECC_POINT *K, // OUT: [d]B or [r]Q
32 TPMS_ECC_POINT *L, // OUT: [r]B
33 TPMS_ECC_POINT *E, // OUT: [r]M
34 TPM_ECC_CURVE curveId, // IN: the curve for the computations
35 TPMS_ECC_POINT *M, // IN: M (optional)
36 TPMS_ECC_POINT *B, // IN: B (optional)
37 TPM2B_ECC_PARAMETER *d, // IN: d (required)
38 TPM2B_ECC_PARAMETER *r // IN: the computed r value (required)
39 );
40LIB_EXPORT UINT32 _cpri__EccGetCurveCount(
41 void
42 );
43LIB_EXPORT const ECC_CURVE * _cpri__EccGetParametersByCurveId(
44 TPM_ECC_CURVE curveId // IN: the curveID
45 );
46LIB_EXPORT CRYPT_RESULT _cpri__EccPointMultiply(
47 TPMS_ECC_POINT *Rout, // OUT: the product point R
48 TPM_ECC_CURVE curveId, // IN: the curve to use
49 TPM2B_ECC_PARAMETER *dIn, // IN: value to multiply against the
50 // curve generator
51 TPMS_ECC_POINT *Qin, // IN: point Q
52 TPM2B_ECC_PARAMETER *uIn // IN: scalar value for the multiplier
53 // of Q
54 );
Vadim Bendebury0a050712015-05-29 11:35:04 -070055LIB_EXPORT BOOL _cpri__EccIsPointOnCurve(
56 TPM_ECC_CURVE curveId, // IN: the curve selector
57 TPMS_ECC_POINT *Q // IN: the point.
58 );
Vadim Bendeburyc00055c2015-05-29 22:50:18 -070059LIB_EXPORT CRYPT_RESULT _cpri__GenerateKeyEcc(
60 TPMS_ECC_POINT *Qout, // OUT: the public point
61 TPM2B_ECC_PARAMETER *dOut, // OUT: the private scalar
62 TPM_ECC_CURVE curveId, // IN: the curve identifier
63 TPM_ALG_ID hashAlg, // IN: hash algorithm to use in the key
64 // generation process
65 TPM2B *seed, // IN: the seed to use
66 const char *label, // IN: A label for the generation
67 // process.
68 TPM2B *extra, // IN: Party 1 data for the KDF
69 UINT32 *counter // IN/OUT: Counter value to allow KDF
70 // iteration to be propagated across
71 // multiple functions
72 );
73LIB_EXPORT TPM_ECC_CURVE _cpri__GetCurveIdByIndex(
74 UINT16 i
75);
76LIB_EXPORT CRYPT_RESULT _cpri__GetEphemeralEcc(
77 TPMS_ECC_POINT *Qout, // OUT: the public point
78 TPM2B_ECC_PARAMETER *dOut, // OUT: the private scalar
79 TPM_ECC_CURVE curveId // IN: the curve for the key
80 );
81LIB_EXPORT CRYPT_RESULT _cpri__SignEcc(
82 TPM2B_ECC_PARAMETER *rOut, // OUT: r component of the signature
83 TPM2B_ECC_PARAMETER *sOut, // OUT: s component of the signature
84 TPM_ALG_ID scheme, // IN: the scheme selector
85 TPM_ALG_ID hashAlg, // IN: the hash algorithm if need
86 TPM_ECC_CURVE curveId, // IN: the curve used in the signature
87 // process
88 TPM2B_ECC_PARAMETER *dIn, // IN: the private key
89 TPM2B *digest, // IN: the digest to sign
90 TPM2B_ECC_PARAMETER *kIn // IN: k for input
91 );
Vadim Bendeburyfea3a142015-05-28 18:53:22 -070092LIB_EXPORT BOOL _cpri__EccStartup(void);
Vadim Bendeburyc00055c2015-05-29 22:50:18 -070093LIB_EXPORT CRYPT_RESULT _cpri__ValidateSignatureEcc(
94 TPM2B_ECC_PARAMETER *rIn, // IN: r component of the signature
95 TPM2B_ECC_PARAMETER *sIn, // IN: s component of the signature
96 TPM_ALG_ID scheme, // IN: the scheme selector
97 TPM_ALG_ID hashAlg, // IN: the hash algorithm used (not used
98 // in all schemes)
99 TPM_ECC_CURVE curveId, // IN: the curve used in the signature
100 // process
101 TPMS_ECC_POINT *Qin, // IN: the public point of the key
102 TPM2B *digest // IN: the digest that was signed
103 );
Vadim Bendeburyfea3a142015-05-28 18:53:22 -0700104
105#endif // __TPM2_CPRIECC_FP_H