[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CSM_Free3::SMTI_ExtractKeyAgreement
Hello,
I want to know if that's an error or a bad comment ? (look at text in
grass)
SM_RET_VAL CSM_Free3::SMTI_ExtractKeyAgreement(
CSM_Buffer *pOriginator, // input, Y of originator
//CSM_Buffer *pParameters, // IN,OUT may be passed in for
shared use
// OR for ESDH. (p, g, and/or IV).
CSM_Buffer *pUKM, // input/output may be passed in for shared
use.
// UserKeyMaterial (random number).
CSM_Buffer *pbufferIV, //RWC;TBD;REMOVE
// input/output may be passed in for shared
use.
// Initialization vector, part of DH
params.
CSM_OID *pEncryptionOID, // IN, specified encryption of key,
// used here in key generation, but alg not
implemented.
CSM_Buffer *pbufKeyAgree, // output, encryption key for this
recip.
long lKekLength) // Input, for OtherInfo load.
{
byte *pbyte;
CSM_Buffer tempBuffer;
CSM_Buffer k1, k2, TEK;
char achCounter1[] = {0x00, 0x00, 0x00, 0x01};
char achCounter2[] = {0x00, 0x00, 0x00, 0x02};
CSM_Buffer *pbufX = NULL; // temp spot for X value
char *pszPassword = NULL; // temp spot for password
bool checkResult;
CSM_Buffer *ptempBuff = NULL;
CSM_OID *pPreferredContentOID=NULL;
CSM_OID *pPrefDigest = NULL;
CSM_OID o(sha_1);
SME_SETUP("CSM_Free3::SMTI_ExtractKeyAgreement");
// check incoming parameters
if ((pOriginator == NULL) || /*RWC;ESDH optional (pUKM == NULL) || */
pbufKeyAgree == NULL)
SME_THROW(SM_MISSING_PARAM, NULL, NULL);
if (pEncryptionOID)
pPreferredContentOID = pEncryptionOID;
else
pPreferredContentOID = GetPrefContentEncryption();
SME(pPrefDigest = GetPrefDigest()); // save current digest alg
SME(BTISetPreferredCSInstAlgs(&o, NULL, NULL, NULL)); // set md5