personalCert = PORT_Strdup(optarg);
personalCert = PORT_Strdup(optstate->value);
main(int argc, char **argv) {    CRMFCertRequest *certReq, *certReq2;    CRMFCertReqMsg *certReqMsg;    CRMFCertReqMsg *secondMsg;    char *configdir;    int irv;    SECStatus rv;    SECKEYPrivateKey *privKey;    SECKEYPublicKey  *pubKey;    int o;    PRBool hclInit = PR_FALSE, pArg = PR_FALSE, eArg = PR_FALSE,            sArg = PR_FALSE;    printf ("\ncrmftest v1.0\n");    while (-1 != (o = getopt(argc, argv, "d:p:e:s:"))) {        switch(o) {	case 'd':	    configdir = PORT_Strdup(optarg);	    rv = InitHCL(configdir);	    if (rv != SECSuccess) {	        printf ("InitHCL failed\n");		return 101;	    }	      	    hclInit = PR_TRUE;	    break;	case 'p':	    personalCert = PORT_Strdup(optarg);	    if (personalCert == NULL) {	        return 603;	    }	    pArg = PR_TRUE;	    break;	case 'e':	    recoveryEncrypter = PORT_Strdup(optarg);	    if (recoveryEncrypter == NULL) {	        return 602;	    }	    eArg = PR_TRUE;	    break;	case 's':	    caCertName = PORT_Strdup(optarg);	    if (caCertName == NULL) {	        return 604;	    }	    sArg = PR_TRUE;	    break;	default:	  Usage();	  return 601;	}    }    if (!hclInit || !pArg || !eArg || !sArg) {        Usage();	return 600;    }    InitPKCS11();        irv = CreateCertRequest(&certReq, &privKey, &pubKey);    if (irv != 0 || certReq == NULL) {        goto loser;    }    certReqMsg = CRMF_CreateCertReqMsg();    secondMsg  = CRMF_CreateCertReqMsg();    CRMF_CertReqMsgSetCertRequest(certReqMsg, certReq);    CRMF_CertReqMsgSetCertRequest(secondMsg,  certReq);    irv = AddProofOfPossession(certReqMsg, privKey, pubKey, crmfSignature);    irv = AddProofOfPossession(secondMsg, privKey, pubKey, crmfKeyAgreement);    irv = Encode (certReqMsg, secondMsg, configdir);    if (irv != 0) {        goto loser;    }        rv = CRMF_DestroyCertRequest (certReq);    if (rv != SECSuccess) {        printf ("Error when destroy certificate request.\n");	irv = 100;	goto loser;    }    rv = CRMF_DestroyCertReqMsg(certReqMsg);    CRMF_DestroyCertReqMsg(secondMsg);    irv = Decode (configdir);    if (irv != 0) {        printf("Error while decoding\n");	goto loser;    }    if ((irv = DoCMMFStuff(configdir)) != 0) {        printf ("CMMF tests failed.\n");	goto loser;    }    if ((irv = DoKeyRecovery(configdir, privKey)) != 0) {        printf ("Error doing key recovery\n");	goto loser;    }    if ((irv = DoChallengeResponse(configdir, privKey, pubKey)) != 0) {        printf ("Error doing challenge-response\n");	goto loser;    }    printf ("Exiting successfully!!!\n\n");    irv = 0; loser:    CloseHCL();    PORT_Free(configdir);    return irv;}