mirror of
https://github.com/stefanberger/libtpms
synced 2026-01-09 05:50:48 +00:00
rev180: Move SM2KeyExchange prototype into header file
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
parent
1832a89202
commit
a8fe6dd40d
@ -83,6 +83,30 @@ LIB_EXPORT TPM_RC CryptEcc2PhaseKeyExchange(
|
||||
TPMS_ECC_POINT* QsB, // IN: static public party B key
|
||||
TPMS_ECC_POINT* QeB // IN: ephemeral public party B key
|
||||
);
|
||||
# if ALG_SM2
|
||||
|
||||
//*** SM2KeyExchange()
|
||||
// This function performs the key exchange defined in SM2.
|
||||
// The first step is to compute
|
||||
// 'tA' = ('dsA' + 'deA' avf(Xe,A)) mod 'n'
|
||||
// Then, compute the 'Z' value from
|
||||
// 'outZ' = ('h' 'tA' mod 'n') ('QsA' + [avf('QeB.x')]('QeB')).
|
||||
// The function will compute the ephemeral public key from the ephemeral
|
||||
// private key.
|
||||
// All points are required to be on the curve of 'inQsA'. The function will fail
|
||||
// catastrophically if this is not the case
|
||||
// Return Type: TPM_RC
|
||||
// TPM_RC_NO_RESULT the value for dsA does not give a valid point on the
|
||||
// curve
|
||||
LIB_EXPORT TPM_RC SM2KeyExchange(
|
||||
TPMS_ECC_POINT* outZ, // OUT: the computed point
|
||||
TPM_ECC_CURVE curveId, // IN: the curve for the computations
|
||||
TPM2B_ECC_PARAMETER* dsAIn, // IN: static private TPM key
|
||||
TPM2B_ECC_PARAMETER* deAIn, // IN: ephemeral private TPM key
|
||||
TPMS_ECC_POINT* QsBIn, // IN: static public party B key
|
||||
TPMS_ECC_POINT* QeBIn // IN: ephemeral public party B key
|
||||
);
|
||||
# endif
|
||||
#endif // CC_ZGen_2Phase
|
||||
|
||||
#endif // _CRYPT_ECC_KEY_EXCHANGE_FP_H_
|
||||
|
||||
@ -64,16 +64,6 @@
|
||||
|
||||
#include "Tpm.h"
|
||||
|
||||
LIB_EXPORT TPM_RC
|
||||
SM2KeyExchange(
|
||||
TPMS_ECC_POINT *outZ, // OUT: the computed point
|
||||
TPM_ECC_CURVE curveId, // IN: the curve for the computations
|
||||
TPM2B_ECC_PARAMETER *dsAIn, // IN: static private TPM key
|
||||
TPM2B_ECC_PARAMETER *deAIn, // IN: ephemeral private TPM key
|
||||
TPMS_ECC_POINT *QsBIn, // IN: static public party B key
|
||||
TPMS_ECC_POINT *QeBIn // IN: ephemeral public party B key
|
||||
);
|
||||
|
||||
#if CC_ZGen_2Phase == YES
|
||||
|
||||
//** Functions
|
||||
|
||||
Loading…
Reference in New Issue
Block a user