SECKEYEncryptedPrivateKeyInfo *epki = NULL;
EncryptedPrivateKeyInfo *epki = NULL;
seckey_put_private_key(SECKEYKeyDBHandle *keydb, DBT *index, SECItem *pwitem,		       SECKEYLowPrivateKey *pk, char *nickname, PRBool update,		       SECOidTag algorithm){    SECKEYDBKey *dbkey = NULL;    SECKEYEncryptedPrivateKeyInfo *epki = NULL;    PLArenaPool *temparena = NULL, *permarena = NULL;    SECItem *dummy = NULL;    SECItem *salt = NULL;    SECStatus rv = SECFailure;    if((keydb == NULL) || (index == NULL) || (pwitem == NULL) ||	(pk == NULL))	return SECFailure;	    permarena = PORT_NewArena(SEC_ASN1_DEFAULT_ARENA_SIZE);    if(permarena == NULL)	return SECFailure;    dbkey = (SECKEYDBKey *)PORT_ArenaZAlloc(permarena, sizeof(SECKEYDBKey));    if(dbkey == NULL)	goto loser;    dbkey->arena = permarena;    dbkey->nickname = nickname;    /* TNH - for RC4, the salt should be created here */	    epki = seckey_encrypt_private_key(pk, pwitem, keydb, algorithm);    if(epki == NULL)	goto loser;    temparena = epki->arena;    /* extract salt for db key */    switch(algorithm)    {	case SEC_OID_RC4:	    rv = SECITEM_CopyItem(permarena, &(dbkey->salt), 		&(epki->algorithm.parameters));	    epki->algorithm.parameters.len = 0;		epki->algorithm.parameters.data = NULL;	    break;	default:            /* TNH - this should not be necessary */	    salt = SEC_PKCS5GetSalt(&epki->algorithm);	    if(salt != NULL)	    {		rv = SECITEM_CopyItem(permarena, &(dbkey->salt), salt);		SECITEM_ZfreeItem(salt, PR_TRUE);	    }	    break;    }    dummy = SEC_ASN1EncodeItem(permarena, &(dbkey->derPK), epki, 	SECKEY_EncryptedPrivateKeyInfoTemplate);    if(dummy == NULL)	rv = SECFailure;    else	rv = put_dbkey(keydb, index, dbkey, update);    /* let success fall through */loser:    if(rv != SECSuccess)	if(permarena != NULL)	    PORT_FreeArena(permarena, PR_TRUE);    if(temparena != NULL)	PORT_FreeArena(temparena, PR_TRUE);    return rv;}