prepare_low_pqg_params_for_asn1(&lk->u.dsa.params);
static SECItem *pk11_PackagePrivateKey(PK11Object *key){    NSSLOWKEYPrivateKey *lk = NULL;    NSSLOWKEYPrivateKeyInfo *pki = NULL;    PK11Attribute *attribute = NULL;    PLArenaPool *arena = NULL;    SECOidTag algorithm = SEC_OID_UNKNOWN;    void *dummy, *param = NULL;    SECStatus rv = SECSuccess;    SECItem *encodedKey = NULL;    if(!key) {	return NULL;    }    attribute = pk11_FindAttribute(key, CKA_KEY_TYPE);    if(!attribute) {	return NULL;    }    lk = pk11_GetPrivKey(key, *(CK_KEY_TYPE *)attribute->attrib.pValue);    pk11_FreeAttribute(attribute);    if(!lk) {	return NULL;    }    arena = PORT_NewArena(2048); 	/* XXX different size? */    if(!arena) {	rv = SECFailure;	goto loser;    }    pki = (NSSLOWKEYPrivateKeyInfo*)PORT_ArenaZAlloc(arena, 					sizeof(NSSLOWKEYPrivateKeyInfo));    if(!pki) {	rv = SECFailure;	goto loser;    }    pki->arena = arena;    param = NULL;    switch(lk->keyType) {	case NSSLOWKEYRSAKey:	    dummy = SEC_ASN1EncodeItem(arena, &pki->privateKey, lk,				       nsslowkey_RSAPrivateKeyTemplate);	    algorithm = SEC_OID_PKCS1_RSA_ENCRYPTION;	    break;	case NSSLOWKEYDSAKey:	    dummy = SEC_ASN1EncodeItem(arena, &pki->privateKey, lk,				       nsslowkey_DSAPrivateKeyExportTemplate);	    param = SEC_ASN1EncodeItem(NULL, NULL, &(lk->u.dsa.params),				       nsslowkey_PQGParamsTemplate);	    algorithm = SEC_OID_ANSIX9_DSA_SIGNATURE;	    break;	case NSSLOWKEYDHKey:	default:	    dummy = NULL;	    break;    }     if(!dummy || ((lk->keyType == NSSLOWKEYDSAKey) && !param)) {	goto loser;    }    rv = SECOID_SetAlgorithmID(arena, &pki->algorithm, algorithm, 			       (SECItem*)param);    if(rv != SECSuccess) {	rv = SECFailure;	goto loser;    }    dummy = SEC_ASN1EncodeInteger(arena, &pki->version,				  NSSLOWKEY_PRIVATE_KEY_INFO_VERSION);    if(!dummy) {	rv = SECFailure;	goto loser;    }    encodedKey = SEC_ASN1EncodeItem(NULL, NULL, pki, 				    nsslowkey_PrivateKeyInfoTemplate);loser:    if(arena) {	PORT_FreeArena(arena, PR_TRUE);    }    if(lk && (lk != key->objectInfo)) {	nsslowkey_DestroyPrivateKey(lk);    }     if(param) {	SECITEM_ZfreeItem((SECItem*)param, PR_TRUE);    }    if(rv != SECSuccess) {	return NULL;    }    return encodedKey;}