CCA4758err(CCA4758_F_IBM_4758_CCA_SIGN,
CCA4758err(CCA4758_F_CCA_RSA_SIGN,
static int cca_rsa_sign(int type, const unsigned char *m, unsigned int m_len,		unsigned char *sigret, unsigned int *siglen, const RSA *rsa)	{	long returnCode;	long reasonCode;	long exitDataLength = 0;	unsigned char exitData[8];	long ruleArrayLength = 1;	unsigned char ruleArray[8] = "PKCS-1.1";	long outputLength=256;	long outputBitLength;	long keyTokenLength;	unsigned char *hashBuffer = NULL;	unsigned char* keyToken = (unsigned char*)RSA_get_ex_data(rsa, hndidx);	long length = SSL_SIG_LEN;	long keyLength ;	X509_SIG sig;	ASN1_TYPE parameter;	X509_ALGOR algorithm;	ASN1_OCTET_STRING digest;	keyTokenLength = *(long*)keyToken;	keyToken+=sizeof(long);	if (type == NID_md5 || type == NID_sha1)		{		sig.algor = &algorithm;		algorithm.algorithm = OBJ_nid2obj(type);		if (!algorithm.algorithm)			{			CCA4758err(CCA4758_F_IBM_4758_CCA_SIGN,				CCA4758_R_UNKNOWN_ALGORITHM_TYPE);			return 0;			}		if (!algorithm.algorithm->length)			{			CCA4758err(CCA4758_F_IBM_4758_CCA_SIGN,				CCA4758_R_ASN1_OID_UNKNOWN_FOR_MD);			return 0;			}		parameter.type = V_ASN1_NULL;		parameter.value.ptr = NULL;		algorithm.parameter = &parameter;		sig.digest = &digest;		sig.digest->data = (unsigned char*)m;		sig.digest->length = m_len;		length = i2d_X509_SIG(&sig, NULL);		}	keyLength = RSA_size(rsa);	if (length - RSA_PKCS1_PADDING > keyLength)		{		CCA4758err(CCA4758_F_IBM_4758_CCA_SIGN,			CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL);		return 0;		}	switch (type)		{		case NID_md5_sha1 :			if (m_len != SSL_SIG_LEN)				{				CCA4758err(CCA4758_F_IBM_4758_CCA_SIGN,				CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL);				return 0;				}			hashBuffer = (unsigned char*)m;			length = m_len;			break;		case NID_md5 :			{			unsigned char *ptr;			ptr = hashBuffer = OPENSSL_malloc(					(unsigned int)keyLength+1);			if (!hashBuffer)				{				CCA4758err(CCA4758_F_IBM_4758_CCA_VERIFY,						ERR_R_MALLOC_FAILURE);				return 0;				}			i2d_X509_SIG(&sig, &ptr);			}			break;		case NID_sha1 :			{			unsigned char *ptr;			ptr = hashBuffer = OPENSSL_malloc(					(unsigned int)keyLength+1);			if (!hashBuffer)				{				CCA4758err(CCA4758_F_IBM_4758_CCA_VERIFY,						ERR_R_MALLOC_FAILURE);				return 0;				}			i2d_X509_SIG(&sig, &ptr);			}			break;		default:			return 0;		}	digitalSignatureGenerate(&returnCode, &reasonCode, &exitDataLength,		exitData, &ruleArrayLength, ruleArray, &keyTokenLength,		keyToken, &length, hashBuffer, &outputLength, &outputBitLength,		sigret);	if (type == NID_sha1 || type == NID_md5)		{		OPENSSL_cleanse(hashBuffer, keyLength+1);		OPENSSL_free(hashBuffer);		}	*siglen = outputLength;	return ((returnCode || reasonCode) ? 0 : 1);	}