wip
better sm2 impl