func needMech(t *testing.T, p *Ctx, sh SessionHandle, mech uint) {
	slots, err := p.GetSlotList(true)
	if err != nil {
		t.Fatal("GetSlotList:", err)
	}
	_, err = p.GetMechanismInfo(slots[0], []*Mechanism{NewMechanism(mech, nil)})
	if err == nil {
		return
	}
	e, ok := err.(Error)
	if !ok || e != CKR_MECHANISM_INVALID {
		t.Fatal("GetMechanismInfo:", err)
	}
	t.Skipf("skipping test; mech 0x%X not supported by softhsm", mech)
}
test whether mech is available; skip the test if it isn't
package pkcs11
import (
	"bytes"
	"testing"
)
const notFound = 0xffffffff