diff --git a/src/tpm2/crypto/CryptEcc.h b/src/tpm2/crypto/CryptEcc.h index fe338479..282e12f0 100644 --- a/src/tpm2/crypto/CryptEcc.h +++ b/src/tpm2/crypto/CryptEcc.h @@ -3,7 +3,7 @@ /* Structure definitions used for ECC */ /* Written by Ken Goldman */ /* IBM Thomas J. Watson Research Center */ -/* $Id: CryptEcc.h 1532 2019-11-26 14:28:36Z kgoldman $ */ +/* $Id: CryptEcc.h 1594 2020-03-26 22:15:48Z kgoldman $ */ /* */ /* Licenses and Notices */ /* */ @@ -55,7 +55,7 @@ /* arising in any way out of use or reliance upon this specification or any */ /* information herein. */ /* */ -/* (c) Copyright IBM Corp. and others, 2016 - 2019 */ +/* (c) Copyright IBM Corp. and others, 2016 - 2020 */ /* */ /********************************************************************************/ @@ -76,7 +76,28 @@ typedef struct ECC_CURVE const ECC_CURVE_DATA *curveData; // the address of the curve data const BYTE *OID; } ECC_CURVE; + + +/* 10.1.2.2.1 Macros */ +/* This macro is used to instance an ECC_CURVE_DATA structure for the curve. This structure is + referenced by the ECC_CURVE structure */ +#define CURVE_DATA_DEF(CURVE) \ + const ECC_CURVE_DATA CURVE = { \ + (bigNum)&CURVE##_p_DATA, (bigNum)&CURVE##_n_DATA, (bigNum)&CURVE##_h_DATA, \ + (bigNum)&CURVE##_a_DATA, (bigNum)&CURVE##_b_DATA, \ + {(bigNum)&CURVE##_gX_DATA, (bigNum)&CURVE##_gY_DATA, (bigNum)&BN_ONE} }; + extern const ECC_CURVE eccCurves[ECC_CURVE_COUNT]; + +#define CURVE_DEF(CURVE) \ + { \ + TPM_ECC_##CURVE, \ + CURVE##_KEY_SIZE, \ + CURVE##_KDF, \ + CURVE##_SIGN, \ + &##CURVE, \ + OID_ECC_##CURVE \ + } #define CURVE_NAME(N) #endif