char* keyToken = NULL; char pubKeyToken[MAX_CCA_PKA_TOKEN_SIZE];
unsigned char* keyToken = NULL; unsigned char pubKeyToken[MAX_CCA_PKA_TOKEN_SIZE];
static EVP_PKEY *ibm_4758_load_privkey(ENGINE* e, const char* key_id,			UI_METHOD *ui_method, void *callback_data)	{	RSA *rtmp = NULL;	EVP_PKEY *res = NULL;	char* keyToken = NULL;	char pubKeyToken[MAX_CCA_PKA_TOKEN_SIZE];	long pubKeyTokenLength = MAX_CCA_PKA_TOKEN_SIZE;	long keyTokenLength = MAX_CCA_PKA_TOKEN_SIZE;	long returnCode;	long reasonCode;	long exitDataLength = 0;	long ruleArrayLength = 0;	unsigned char exitData[8];	unsigned char ruleArray[8];	char keyLabel[64];	long keyLabelLength = strlen(key_id);	char modulus[256];	long modulusFieldLength = sizeof(modulus);	long modulusLength = 0;	char exponent[256];	long exponentLength = sizeof(exponent);	if (keyLabelLength > sizeof(keyLabel))		{		CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,		CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL);		return NULL;		}	memset(keyLabel,' ', sizeof(keyLabel));	memcpy(keyLabel, key_id, keyLabelLength);	keyToken = OPENSSL_malloc(MAX_CCA_PKA_TOKEN_SIZE + sizeof(long));	if (!keyToken)		{		CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,				ERR_R_MALLOC_FAILURE);		goto err;		}	keyRecordRead(&returnCode, &reasonCode, &exitDataLength,		exitData, &ruleArrayLength, ruleArray, keyLabel,		&keyTokenLength, keyToken+sizeof(long));	if (returnCode)		{		CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,			CCA4758_R_FAILED_LOADING_PRIVATE_KEY);		goto err;		}	publicKeyExtract(&returnCode, &reasonCode, &exitDataLength,		exitData, &ruleArrayLength, ruleArray, &keyTokenLength,		keyToken+sizeof(long), &pubKeyTokenLength, pubKeyToken);	if (returnCode)		{		CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,			CCA4758_R_FAILED_LOADING_PRIVATE_KEY);		goto err;		}	if (!getModulusAndExponent(pubKeyToken, &exponentLength,			exponent, &modulusLength, &modulusFieldLength,			modulus))		{		CCA4758err(CCA4758_F_IBM_4758_CCA_LOAD_PRIVKEY,			CCA4758_R_FAILED_LOADING_PRIVATE_KEY);		goto err;		}	(*(long*)keyToken) = keyTokenLength;	rtmp = RSA_new_method(e);	RSA_set_ex_data(rtmp, hndidx, (char *)keyToken);	rtmp->e = BN_bin2bn(exponent, exponentLength, NULL);	rtmp->n = BN_bin2bn(modulus, modulusFieldLength, NULL);	rtmp->flags |= RSA_FLAG_EXT_PKEY;	res = EVP_PKEY_new();	EVP_PKEY_assign_RSA(res, rtmp);	return res;err:	if (keyToken)		OPENSSL_free(keyToken);	if (res)		EVP_PKEY_free(res);	if (rtmp)		RSA_free(rtmp);	return NULL;	}