basic SM2 implementation