rev180: Move SM2KeyExchange prototype into header file

Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
This commit is contained in:
Stefan Berger 2023-12-13 14:43:39 -05:00 committed by Stefan Berger
parent 1832a89202
commit a8fe6dd40d
2 changed files with 24 additions and 10 deletions

View File

@ -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_

View File

@ -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