I have ported the openssl for QNX6 and I have modified the “Configure” and added a configuration for the MPC5200B target.
I have made the following change in the configuartion file:
“qnx6-mpc5200b-qcc”, “qcc:-Vgcc_ntoppcbe -DCPU=MPC5200b -DVARIANT_be -DTERMIOS::(unknown)::-lsocket::”,
After configuring the openssl when I do “Make” the lib’s(libcrypto.a,libssl.a) are generated.
I created a sample application which does signing and verification. I built the code with the openssl Lib(libcrypto.a,libssl.a).
The sample application looks like this.
/***************************************/
int main()
{
EC_KEY *eckey ;
int ret;
ECDSA_SIG *sig = NULL;
unsigned char dgst[20]= "myapplication";
size_t readchar = 0 ;
eckey = EC_KEY_new();
if (eckey == NULL)
{
printf("Could not generate key\n");
}
else
printf(" EC_KEY_new() success\n");
eckey->group = EC_GROUP_new_by_curve_name(NID_sect163k1);
if (eckey->group == NULL)
{
/* error */
}
else
printf(" EC_GROUP_new_by_curve_name() success\n");
if (!EC_KEY_generate_key(eckey))
{
printf("\n\n Error in key generation\n");
}
else
printf("\n\n ECC Private and Public key pair generated Successfully.\n");
sig = ECDSA_do_sign(dgst,(int)readchar, eckey);
if(sig == NULL)
printf("\n\n Signing Failed");
ret = ECDSA_do_verify(dgst,(int)readchar , sig, eckey);
if(ret == 0 ||ret == -1 )
printf("\n\n Verfication Failed");
else
printf("\n ECC Signing and Verfication using OpenSSL is done Successfully.\n");
return 0;
}
/***************************************/
But “EC_KEY_generate_key(eckey)” fails subsequently “ECDSA_do_sign” and “ECDSA_do_verify”.
The same code runs on windows.Does that mean openssl is not ported properly? Am I missing something here?
It will be great if I get some pointers.
regards
Nayak