mech.mechanism = pk11_mapSignKeyType(key->keyType);
mech.mechanism = PK11_MapSignKeyType(key->keyType);
pk11_backupGetSignLength(SECKEYPrivateKey *key){    PK11SlotInfo *slot = key->pkcs11Slot;    CK_MECHANISM mech = {0, NULL, 0 };    PRBool owner = PR_TRUE;    CK_SESSION_HANDLE session;    CK_ULONG len;    CK_RV crv;    unsigned char h_data[20]  = { 0 };    unsigned char buf[20]; /* obviously to small */    CK_ULONG smallLen = sizeof(buf);    mech.mechanism = pk11_mapSignKeyType(key->keyType);    session = pk11_GetNewSession(slot,&owner);    if (!owner || !(slot->isThreadSafe)) PK11_EnterSlotMonitor(slot);    crv = PK11_GETTAB(slot)->C_SignInit(session,&mech,key->pkcs11ID);    if (crv != CKR_OK) {	if (!owner || !(slot->isThreadSafe)) PK11_ExitSlotMonitor(slot);	pk11_CloseSession(slot,session,owner);	PORT_SetError( PK11_MapError(crv) );	return -1;    }    len = 0;    crv = PK11_GETTAB(slot)->C_Sign(session,h_data,sizeof(h_data),					NULL, &len);    /* now call C_Sign with too small a buffer to clear the session state */    (void) PK11_GETTAB(slot)->			C_Sign(session,h_data,sizeof(h_data),buf,&smallLen);	    if (!owner || !(slot->isThreadSafe)) PK11_ExitSlotMonitor(slot);    pk11_CloseSession(slot,session,owner);    if (crv != CKR_OK) {	PORT_SetError( PK11_MapError(crv) );	return -1;    }    return len;}